src/hg/hgTables/hgTables.c 1.186
1.186 2009/05/20 20:59:56 mikep
Libified findTdbForTable, findTypeForTable, trackIsType, hIsBigBed from hgTables so that other code can easily determine if a track is a bigBed.
Index: src/hg/hgTables/hgTables.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/hgTables.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -b -B -U 4 -r1.185 -r1.186
--- src/hg/hgTables/hgTables.c 23 Apr 2009 22:42:25 -0000 1.185
+++ src/hg/hgTables/hgTables.c 20 May 2009 20:59:56 -0000 1.186
@@ -222,15 +222,8 @@
*pTable = s;
}
}
-boolean trackIsType(char *table, char *type)
-/* Return TRUE track is a specific type. Type should be something like "bed" or
- * "bigBed" or "bigWig" */
-{
-char *tdbType = findTypeForTable(database, curTrack, table);
-return (tdbType && startsWithWord(type, tdbType));
-}
static struct trackDb *getFullTrackList()
/* Get all tracks including custom tracks if any. */
{
@@ -554,15 +547,15 @@
/* Return primary table info, but don't abort if table not there. Conn should be open to db. */
{
struct hTableInfo *hti = NULL;
-if (isBigBed(table))
+if (hIsBigBed(database, table, curTrack, ctLookupName))
{
hti = bigBedToHti(table, conn);
}
else if (isCustomTrack(table))
{
- struct customTrack *ct = lookupCt(table);
+ struct customTrack *ct = ctLookupName(table);
hti = ctToHti(ct);
}
else if (sameWord(table, WIKI_TRACK_TABLE))
{
@@ -1162,9 +1155,9 @@
char *idField;
boolean showItemRgb = FALSE;
int itemRgbCol = -1; /* -1 means not found */
boolean printedColumns = FALSE;
-struct trackDb *tdb = findTdbForTable(db, curTrack, table);
+struct trackDb *tdb = findTdbForTable(db, curTrack, table, ctLookupName);
hti = getHti(db, table, conn);
idField = getIdField(db, curTrack, table, hti);
@@ -1266,9 +1259,9 @@
void doTabOutTable( char *db, char *table, FILE *f, struct sqlConnection *conn, char *fields)
/* Do tab-separated output on fields of a single table. */
{
-if (isBigBed(table))
+if (hIsBigBed(database, table, curTrack, ctLookupName))
bigBedTabOut(db, table, conn, fields, f);
else if (isCustomTrack(table))
{
struct trackDb *track = findTrack(table, fullTrackList);
@@ -1283,17 +1276,17 @@
{
char dtBuf[256];
struct sqlConnection *conn;
struct slName *fieldList = NULL, *dtfList = NULL, *field, *dtf;
-if (isBigBed(table))
+if (hIsBigBed(database, table, curTrack, ctLookupName))
{
conn = hAllocConn(db);
fieldList = bigBedGetFields(table, conn);
hFreeConn(&conn);
}
else if (isCustomTrack(table))
{
- struct customTrack *ct = lookupCt(table);
+ struct customTrack *ct = ctLookupName(table);
if ((ct!= NULL) && (ct->dbTrackType != NULL) &&
sameString(ct->dbTrackType, "maf"))
{
conn = hAllocConn(CUSTOM_TRASH);