src/hg/hgTracks/wigMafTrack.c 1.145

1.145 2010/05/07 18:29:15 kent
Fixing wigMaf tracks by being a little more careful about how the wiggle subtracks are manufactured.
Index: src/hg/hgTracks/wigMafTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/wigMafTrack.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -b -B -U 4 -r1.144 -r1.145
--- src/hg/hgTracks/wigMafTrack.c	24 Aug 2009 23:07:54 -0000	1.144
+++ src/hg/hgTracks/wigMafTrack.c	7 May 2010 18:29:15 -0000	1.145
@@ -2458,9 +2458,8 @@
 /* Make track for maf multiple alignment. */
 {
 struct track *wigTrack;
 int i;
-char *savedType;
 struct dyString *wigType;
 struct consWiggle *consWig, *consWigList = NULL;
 
 track->loadItems = wigMafLoad;
@@ -2492,37 +2491,29 @@
         if (!cartCgiUsualBoolean(cart, wigVar, first))
             continue;
         }
     first = FALSE;
-    //  manufacture and initialize wiggle subtrack
-    /* CAUTION: this code is very interdependent with
-       hgTracks.c:fillInFromType()
-       Also, both the main track and subtrack share the same tdb */
-    // restore "type" line, but change type to "wig"
-    savedType = tdb->type;
+
+    //  Manufacture and initialize wiggle subtrack, both tdb and track
+    struct trackDb *wigTdb = CloneVar(tdb);
     wigType = newDyString(64);
-    dyStringClear(wigType);
     dyStringPrintf(wigType, "type wig ");
     for (i = 1; i < wordCount; i++)
-        {
         dyStringPrintf(wigType, "%s ", words[i]);
-        }
-    dyStringPrintf(wigType, "\n");
-    tdb->type = cloneString(wigType->string);
-    wigTrack = trackFromTrackDb(tdb);
-    tdb->type = savedType;
-
-    /* replace tablename with wiggle table from "wiggle" setting */
-    wigTrack->mapName = cloneString(consWig->table);
+    wigTdb->type = cloneString(wigType->string);
+    wigTdb->tableName = consWig->table;
 
     /* Tweak wiggle left labels: replace underscore with space and
      * append 'Cons' */
     struct dyString *ds = dyStringNew(0);
     dyStringAppend(ds, consWig->leftLabel);
     if (differentString(consWig->leftLabel, DEFAULT_CONS_LABEL))
         dyStringAppend(ds, " Cons");
-    wigTrack->shortLabel = dyStringCannibalize(&ds);
-    subChar(wigTrack->shortLabel, '_', ' ');
+    wigTdb->shortLabel = dyStringCannibalize(&ds);
+    subChar(wigTdb->shortLabel, '_', ' ');
+
+    wigTrack = trackFromTrackDb(wigTdb);
+
 
     /* setup wiggle methods in subtrack */
     wigMethods(wigTrack, tdb, wordCount, words);