037fad09eb0c322d3ede8e3a20fad478777d58f3 braney Tue Jul 9 14:28:33 2013 -0700 resolve newly introduced error in menu bar, notify users that hgVai doesn't work with assembly hubs, and resolve caching problems with assembly hubs (set udc cache timeout before opening hubs (otherwise the default is 0), don't open 2bit files until they are actually used) diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c index fb7dc0e..77998b7 100644 --- src/hg/lib/trackHub.c +++ src/hg/lib/trackHub.c @@ -234,30 +234,32 @@ char *defaultName = cloneString( chromList->name); slFreeList(&chromList); return defaultName; } struct chromInfo *trackHubMaybeChromInfo(char *database, char *chrom) /* Return a chromInfo structure for just this chrom in this database. * Return NULL if chrom doesn't exist. */ { struct trackHubGenome *genome = trackHubGetGenome(database); if (genome == NULL) return NULL; +if (genome->tbf == NULL) + genome->tbf = twoBitOpen(genome->twoBitPath); if (!twoBitIsSequence(genome->tbf, chrom)) return NULL; struct chromInfo *ci; AllocVar(ci); ci->chrom = cloneString(chrom); ci->fileName = genome->twoBitPath; ci->size = twoBitSeqSize(genome->tbf, chrom); return ci; } struct chromInfo *trackHubChromInfo(char *database, char *chrom) /* Return a chromInfo structure for just this chrom in this database. * errAbort if chrom doesn't exist. */ @@ -265,30 +267,32 @@ struct chromInfo *ci = trackHubMaybeChromInfo(database, chrom); if (ci == NULL) errAbort("%s is not in %s", chrom, database); return ci; } 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) { AllocVar(ci); ci->chrom = cloneString(chromList->name); ci->fileName = genome->twoBitPath; ci->size = twoBitSeqSize(genome->tbf, chromList->name); slAddHead(&ciList, ci); } slFreeList(&chromList); return ciList; } @@ -436,31 +440,30 @@ AllocVar(el); el->name = cloneString(genome); el->trackDbFile = trackHubRelativeUrl(url, trackDb); el->trackHub = hub; hashAdd(hash, el->name, el); slAddHead(&list, el); char *groups = hashFindVal(ra, "groups"); if (twoBitPath != NULL) { //printf("reading genome %s twoBitPath %s\n", genome, el->twoBitPath); el->description = hashFindVal(ra, "description"); el->organism = addHubName(hashFindVal(ra, "organism"), hub->name); hashReplace(ra, "organism", el->organism); el->defaultPos = hashFindVal(ra, "defaultPos"); el->twoBitPath = trackHubRelativeUrl(url, twoBitPath); - el->tbf = twoBitOpen(el->twoBitPath); hashReplace(ra, "htmlPath",trackHubRelativeUrl(url, hashFindVal(ra, "htmlPath"))); if (groups != NULL) el->groups = trackHubRelativeUrl(url, groups); addAssembly(genome, el, hub); } el->settingsHash = ra; hashAdd(ra, "hubName", hub->shortLabel); } /* Clean up and go home. */ lineFileClose(&lf); slReverse(&list); return list; }