src/hg/hgTracks/bedTrack.c 1.25

1.25 2010/05/11 01:43:26 kent
Refactoring to split the trackDb.tableName field into separate track and table fields. Similarly track.mapName field goes to the same track and table fields.
Index: src/hg/hgTracks/bedTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/bedTrack.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -b -B -U 4 -r1.24 -r1.25
--- src/hg/hgTracks/bedTrack.c	25 Mar 2010 17:46:01 -0000	1.24
+++ src/hg/hgTracks/bedTrack.c	11 May 2010 01:43:26 -0000	1.25
@@ -75,9 +75,9 @@
         topTable = words[2];
         /* if there are not too many rows in the table then can define */
         /* top table as the track or subtrack table */
         if (sameWord(topTable, "self"))
-            topTable = cloneString(tg->mapName);
+            topTable = cloneString(tg->table);
         }
     }
 
 /* Get list of items */
@@ -117,13 +117,13 @@
 	rowOffset = hOffsetPastBin(database, hDefaultChrom(database), topTable);
 	}
     else if(scoreFilterClause != NULL && tg->bedSize >= 5)
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd, scoreFilterClause, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, scoreFilterClause, &rowOffset);
 	}
     else
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd, NULL, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, NULL, &rowOffset);
 	}
     freeMem(scoreFilterClause);
     while ((row = sqlNextRow(sr)) != NULL)
 	{
@@ -207,14 +207,14 @@
     int rowOffset;
     char *scoreFilterClause = getScoreFilterClause(cart, tg->tdb,NULL);
     if (scoreFilterClause != NULL)
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
 	freeMem(scoreFilterClause);
 	}
     else
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd,
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd,
 			 NULL, &rowOffset);
 	}
 
     while ((row = sqlNextRow(sr)) != NULL)
@@ -257,14 +257,14 @@
     int rowOffset;
     char *scoreFilterClause = getScoreFilterClause(cart, tg->tdb,NULL);
     if (scoreFilterClause != NULL)
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
 	freeMem(scoreFilterClause);
 	}
     else
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd,
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd,
 			 NULL, &rowOffset);
 	}
 
     while ((row = sqlNextRow(sr)) != NULL)
@@ -452,19 +452,19 @@
           scoreMin, scoreMax, useItemRgb, 12, &lfList);
     }
 else
     {
-    /* Use tg->tdb->tableName because subtracks inherit composite track's tdb
+    /* Use tg->tdb->track because subtracks inherit composite track's tdb
      * by default, and the variable is named after the composite track. */
     char *scoreFilterClause = getScoreFilterClause(cart, tg->tdb,NULL);
     if (scoreFilterClause != NULL)
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd,scoreFilterClause, &rowOffset);
 	freeMem(scoreFilterClause);
 	}
     else
 	{
-	sr = hRangeQuery(conn, tg->mapName, chromName, winStart, winEnd, NULL, &rowOffset);
+	sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, NULL, &rowOffset);
 	}
     while ((row = sqlNextRow(sr)) != NULL)
 	{
 	bed = bedLoad12(row+rowOffset);
@@ -537,9 +537,9 @@
 	    Color textColor = hvGfxContrastingColor(hvg, color);
 	    hvGfxTextCentered(hvg, x1, y, w, heightPer, textColor, font, s);
 	    }
 	mapBoxHgcOrHgGene(hvg, bed->chromStart, bed->chromEnd, x1, y, x2 - x1, heightPer,
-                          tg->mapName, tg->mapItemName(tg, bed), NULL, directUrl, withHgsid, NULL);
+                          tg->track, tg->mapItemName(tg, bed), NULL, directUrl, withHgsid, NULL);
 	}
     }
 if (tg->subType == lfWithBarbs || tg->exonArrows)
     {
@@ -563,9 +563,9 @@
         MgFont *font, Color color, enum trackVisibility vis)
 /* Draw simple Bed items. */
 {
 if (!tg->drawItemAt)
-    errAbort("missing drawItemAt in track %s", tg->mapName);
+    errAbort("missing drawItemAt in track %s", tg->track);
 
 if (vis == tvDense && canDrawBigBedDense(tg))
     {
     bigBedDrawDense(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color);
@@ -742,9 +742,9 @@
 unsigned char r, g, b;
 
 char *colors = cloneString(trackDbSetting(tg->tdb, "colorByStrand"));
 if (!colors)
-    errAbort("colorByStrand setting missing (in %s)", tg->mapName);
+    errAbort("colorByStrand setting missing (in %s)", tg->track);
 if (chopByWhite(colors, words, sizeof(words)) != 2)
     errAbort("invalid colorByStrand setting %s (expecting pair of RGB values r,g,b r,g,b)", colors);
 if (orientation == 1)
     parseColor(words[0], &r, &g, &b);
@@ -833,9 +833,9 @@
     }
 else
     {
     linkedFeaturesMethods(track);
-    track->extraUiData = newBedUiData(track->mapName);
+    track->extraUiData = newBedUiData(track->track);
     track->loadItems = loadGappedBed;
     if (trackDbSetting(tdb, "colorByStrand"))
 	{
 	track->itemColor = lfItemColorByStrand;