src/hg/hgTables/hgTables.c 1.181
1.181 2009/04/10 20:04:29 tdreszer
Fix many instances of using composite tdb when subtrack tdb is needed
Index: src/hg/hgTables/hgTables.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/hgTables.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -b -B -U 4 -r1.180 -r1.181
--- src/hg/hgTables/hgTables.c 18 Mar 2009 01:34:52 -0000 1.180
+++ src/hg/hgTables/hgTables.c 10 Apr 2009 20:04:29 -0000 1.181
@@ -240,48 +240,10 @@
boolean trackIsType(char *table, char *type)
/* Return TRUE track is a specific type. Type should be something like "bed" or
* "bigBed" or "bigWig" */
{
-struct trackDb *tdb = NULL;
-if (isCustomTrack(table))
- {
- struct customTrack *ct = lookupCt(table);
- if (ct != NULL)
- tdb = ct->tdb;
- }
-else
- {
- if (curTrack && sameString(curTrack->tableName, table))
- tdb = curTrack;
- else
- tdb = hTrackDbForTrack(database, table);
- }
-return tdb != NULL && startsWithWord(type, tdb->type);
-}
-
-struct trackDb *findCompositeTdb(struct trackDb *track, char *table)
-/* find the tdb for the table, if it is custom or composite or ordinary */
-{
-struct trackDb *tdb = track;
-
-if (isCustomTrack(table))
- {
- struct customTrack *ct = lookupCt(table);
- tdb = ct->tdb;
- }
-else if (track && tdbIsComposite(track))
- {
- struct trackDb *subTdb;
- for (subTdb=track->subtracks; subTdb != NULL; subTdb = subTdb->next)
- {
- if (sameWord(subTdb->tableName, table))
- {
- tdb = subTdb;
- break;
- }
- }
- }
-return(tdb);
+char *tdbType = findTypeForTable(database, curTrack, table);
+return (tdbType && startsWithWord(type, tdbType));
}
static struct trackDb *getFullTrackList()
/* Get all tracks including custom tracks if any. */
@@ -1208,12 +1170,14 @@
char *idField;
boolean showItemRgb = FALSE;
int itemRgbCol = -1; /* -1 means not found */
boolean printedColumns = FALSE;
+struct trackDb *tdb = findTdbForTable(db, curTrack, table);
hti = getHti(db, table, conn);
idField = getIdField(db, curTrack, table, hti);
-showItemRgb=bedItemRgb(curTrack); /* should we expect itemRgb */
+
+showItemRgb=bedItemRgb(tdb); /* should we expect itemRgb */
/* instead of "reserved" */
/* If they didn't pass in a field list assume they want all fields. */
if (fields != NULL)