ea5a8d3dbf39d8ae5bc62fcf37d7c2247d6a2725
max
  Tue Jan 24 02:02:39 2012 -0800
first go on marker display
diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index d89ecb9..7d50e30 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -12217,76 +12217,118 @@
             if(pass)
                 slAddTail(&newList, lf);
             }
         else
             errAbort("Couldn't find article with displayId: '%s'", lf->name);
         sqlFreeResult(&sr);
         }
     tg->items = newList;
     }
 hFreeConn(&conn);
 }
 
 static void t2gMapItem(struct track *tg, struct hvGfx *hvg, void *item,
 				char *itemName, char *mapItemName, int start, int end,
 				int x, int y, int width, int height)
+/* create mouse overs with titles for t2g bed features */
 {
 if(!theImgBox || tg->limitedVis != tvDense || !tdbIsCompositeChild(tg->tdb))
     {
     char query[1024], title[4096];
     char *label = NULL;
     char *articleTable = t2gArticleTable(tg);
     if(!isEmpty(articleTable))
         {
         struct sqlConnection *conn = hAllocConn(database);
         safef(query, sizeof(query), "select title from %s where displayId = '%s'", articleTable, mapItemName);
         label = sqlQuickQuery(conn, query, title, sizeof(title));
         hFreeConn(&conn);
         }
     if(isEmpty(label))
         label = mapItemName;
     mapBoxHc(hvg, start, end, x, y, width, height, tg->track, mapItemName, label);
     }
 }
 
+char *splitPart(char* string, int index)
+/* splits string with | and returns part index (is there no easier way to do this?)*/
+{
+    char* name2;
+    name2 = cloneString(string);
+    char **parts = NULL;
+	AllocArray(parts, 2);
+    chopString(name2, "|", parts, 2);
+    return (char *)parts[index];
+}
+
+static void t2gMarkerMapItem(struct track *tg, struct hvGfx *hvg, void *item,
+				char *itemName, char *mapItemName, int start, int end,
+				int x, int y, int width, int height) 
+/* split item name on | and show second part as mouse over*/
+{
+char* itemNamePart2 = splitPart(itemName, 1);
+
+genericMapItem(tg, hvg, item,
+		    itemNamePart2, mapItemName, start, end,
+		    x, y, width, height);
+}
+
+char *t2gMarkerItemName(struct track *tg, void *item)
+/* split item name on | and shows first part as name */
+{
+    struct bed *bed = item;
+
+    return splitPart(bed->name, 0);
+
+}
+
 static void t2gMethods(struct track *tg)
 {
+if (startsWith("t2gMarker", tg->table))
+{
+    tg->mapItem = t2gMarkerMapItem;
+    tg->itemName = t2gMarkerItemName;
+}
+else
+{
 tg->loadItems = t2gLoadItems;
 tg->mapItem = t2gMapItem;
 }
+}
 
 
 void fillInFromType(struct track *track, struct trackDb *tdb)
 /* Fill in various function pointers in track from type field of tdb. */
 {
 char *typeLine = tdb->type, *words[8], *type;
 int wordCount;
 if (typeLine == NULL)
     return;
 wordCount = chopLine(cloneString(typeLine), words);
 if (wordCount <= 0)
     return;
 type = words[0];
 
 #ifndef GBROWSE
 if (sameWord(type, "bed"))
     {
     complexBedMethods(track, tdb, FALSE, wordCount, words);
     /* bed.h includes genePred.h so should be able to use these trackDb
        settings. */
     if (trackDbSetting(track->tdb, GENEPRED_CLASS_TBL) !=NULL)
         track->itemColor = genePredItemClassColor;
+    
     if (startsWith("t2g", track->table))
         t2gMethods(track);
     }
 /*
 else if (sameWord(type, "bedLogR"))
     {
     wordCount++;
     words[1] = "9";
     complexBedMethods(track, tdb, FALSE, wordCount, words);
     //track->bedSize = 10;
     }
     */
 else if (sameWord(type, "bigBed"))
     {
     bigBedMethods(track, tdb, wordCount, words);