f619ad52904568bd108d65e34d2e10cb381f439e hiram Mon Sep 21 14:04:09 2020 -0700 now recognizing assembly hub chromAlias file to allow bed type custom tracks with other names refs #24396 diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c index 345cc07..1212daf 100644 --- src/hg/lib/trackHub.c +++ src/hg/lib/trackHub.c @@ -324,30 +324,31 @@ * errAbort if chrom doesn't exist. */ { struct chromInfo *ci = trackHubMaybeChromInfo(database, chrom); if (ci == NULL) errAbort("%s is not in %s", chrom, database); return ci; } static struct hash *readAliasFile(char *url) /* given the URL (might be a file) read and process into chromAlias hash * file structure: lines of white space separated words * first word is the sequence name in the assembly, words following are * alias names for that sequences name. Same format as use by IGV + * returned hash is key: sequence chrom name, hash value struct chromAlias * */ { struct hash *aliasHash = NULL; struct dyString *ds = NULL; /* adding error trapping because various net.c functions can errAbort */ struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { int sd = netUrlOpen(url); if (sd >= 0) { char *newUrl = NULL; int newSd = 0; if (netSkipHttpHeaderLinesHandlingRedirect(sd, url, &newSd, &newUrl)) @@ -414,48 +415,31 @@ if (absAliasFile) { hashReplace(genome->settingsHash, "chromAlias", absAliasFile); aliasFile = absAliasFile; } return aliasFile; } struct hash *trackHubAllChromAlias(char *database) /* Return a hash of chroms with alias names from alias file if present */ { char *aliasFile = trackHubAliasFile(database); if (aliasFile == NULL) return NULL; -#ifdef NOT -struct trackHubGenome *genome = trackHubGetGenome(database); -if (genome == NULL) - return NULL; -char *aliasFile = hashFindVal(genome->settingsHash, "chromAlias"); -char *absAliasFile = NULL; -if (aliasFile) - absAliasFile = trackHubRelativeUrl((genome->trackHub)->url, aliasFile); -if (absAliasFile) - { - hashReplace(genome->settingsHash, "chromAlias", absAliasFile); - aliasFile = absAliasFile; - } -#endif - -struct hash *aliasHash = readAliasFile(aliasFile); - -return aliasHash; +return readAliasFile(aliasFile); } /* struct hash *trackHubAllChromAlias(char *database) */ struct chromInfo *trackHubAllChromInfo(char *database) /* Return a chromInfo structure for all the chroms in this database. */ { struct trackHubGenome *genome = trackHubGetGenome(database); if (genome == NULL) return NULL; if (genome->tbf == NULL) genome->tbf = twoBitOpen(genome->twoBitPath); struct chromInfo *ci, *ciList = NULL; struct slName *chromList = twoBitSeqNames(genome->twoBitPath); for(; chromList; chromList = chromList->next)