9cc4ce16befd7694963bdb46b6e9b4d28a6930cc hiram Thu Apr 6 14:29:04 2023 -0700 adding endpoint /list/files function to list hgdownload files refs #23589 diff --git src/hg/hubApi/apiUtils.c src/hg/hubApi/apiUtils.c index e9c386a..7499a967 100644 --- src/hg/hubApi/apiUtils.c +++ src/hg/hubApi/apiUtils.c @@ -679,15 +679,39 @@ void hubAliasSetup(struct trackHubGenome *hubGenome) /* see if this hub has an alias file and run chromAliasSetupBb() for it */ { if (hubGenome->settingsHash) { char *aliasFile = hashFindVal(hubGenome->settingsHash, "chromAliasBb"); char *absFileName = NULL; if (aliasFile) absFileName = trackHubRelativeUrl((hubGenome->trackHub)->url, aliasFile); if (absFileName) { chromAliasSetupBb(NULL, absFileName); } } } + +char *genArkPath(char *genome) +/* given a GenArk hub genome name, e.g. GCA_021951015.1 return the path: + * GCA/021/951/015/GCA_021951015.1 + * prefix that with desired server URL: https://hgdownload.soe.ucsc.edu/hubs/ + * if desired. Or suffix add /hub.txt to get the hub.txt URL + * + * already been proven that genome is a GCx_ name prefix before calling + */ +{ +struct dyString *genArkPath = dyStringNew(0); + +char tmpBuf[4]; +safencpy(tmpBuf, sizeof(tmpBuf), genome, 3); +dyStringPrintf(genArkPath, "%s/", tmpBuf); +safencpy(tmpBuf, sizeof(tmpBuf), genome+4, 3); +dyStringPrintf(genArkPath, "%s/", tmpBuf); +safencpy(tmpBuf, sizeof(tmpBuf), genome+7, 3); +dyStringPrintf(genArkPath, "%s/", tmpBuf); +safencpy(tmpBuf, sizeof(tmpBuf), genome+10, 3); +dyStringPrintf(genArkPath, "%s", tmpBuf); + +return dyStringCannibalize(&genArkPath); +}