c1e66c5c9d45f0965156318e2782714ee93b04ab braney Mon Oct 19 16:08:32 2015 -0700 more work on bigMaf. Works in hgc and hgTables now. #15935 diff --git src/hg/hgTables/maf.c src/hg/hgTables/maf.c index 711c2aa..42162d1 100644 --- src/hg/hgTables/maf.c +++ src/hg/hgTables/maf.c @@ -5,43 +5,44 @@ #include "common.h" #include "hash.h" #include "linefile.h" #include "dystring.h" #include "portable.h" #include "obscure.h" #include "jksql.h" #include "cheapcgi.h" #include "cart.h" #include "web.h" #include "trackDb.h" #include "maf.h" #include "hgMaf.h" #include "hgTables.h" +#include "hubConnect.h" boolean isMafTable(char *database, struct trackDb *track, char *table) /* Return TRUE if table is maf. */ { if (track == NULL) return FALSE; if (isEmpty(track->type)) return FALSE; if (sameString(track->table, table)) { - if (startsWithWord("maf",track->type) || startsWithWord("wigMaf",track->type)) + if (startsWithWord("maf",track->type) || startsWithWord("wigMaf",track->type) || startsWithWord("bigMaf",track->type)) return TRUE; } else { struct slRef *tdbRefList = trackDbListGetRefsToDescendantLeaves(track->subtracks); struct slRef *tdbRef; for (tdbRef = tdbRefList; tdbRef != NULL; tdbRef = tdbRef->next) { struct trackDb *childTdb = tdbRef->val; if(sameString(childTdb->table, table)) { if (startsWithWord("maf",childTdb->type) || startsWithWord("wigMaf",childTdb->type)) return TRUE; break; } @@ -75,43 +76,49 @@ /* this shouldn't happen */ printf("cannot find custom track file %s\n", mafFile); return; } } mafWriteStart(stdout, NULL); for (region = regionList; region != NULL; region = region->next) { struct bed *bedList = cookedBedList(conn, table, region, lm, NULL); struct bed *bed = NULL; for (bed = bedList; bed != NULL; bed = bed->next) { struct mafAli *mafList = NULL, *maf = NULL; char dbChrom[64]; - safef(dbChrom, sizeof(dbChrom), "%s.%s", database, bed->chrom); + safef(dbChrom, sizeof(dbChrom), "%s.%s", hubConnectSkipHubPrefix(database), bed->chrom); /* For MAF, we clip to viewing window (region) instead of showing * entire items that happen to overlap the window/region, which is * what we get from cookedBedList. */ if (bed->chromStart < region->start) bed->chromStart = region->start; if (bed->chromEnd > region->end) bed->chromEnd = region->end; if (bed->chromStart >= bed->chromEnd) continue; if (ct == NULL) { - if (mafFile != NULL) + if (isBigBed(database, table, curTrack, ctLookupName)) + { + char *fileName = trackDbSetting(track, "bigDataUrl"); + struct bbiFile *bbi = bigBedFileOpen(fileName); + mafList = bigMafLoadInRegion(bbi, bed->chrom, bed->chromStart, bed->chromEnd); + } + else if (mafFile != NULL) mafList = mafLoadInRegion2(conn, conn, table, bed->chrom, bed->chromStart, bed->chromEnd, mafFile); else mafList = mafLoadInRegion(conn, table, bed->chrom, bed->chromStart, bed->chromEnd); } else mafList = mafLoadInRegion2(ctConn, ctConn2, ct->dbTableName, bed->chrom, bed->chromStart, bed->chromEnd, mafFile); for (maf = mafList; maf != NULL; maf = maf->next) { struct mafAli *subset = mafSubset(maf, dbChrom, bed->chromStart, bed->chromEnd); if (subset != NULL) {