d940328d55a16ecab8d511291de63332893cbcb8
braney
  Thu Jan 20 15:44:36 2011 -0800
some stubs to support ENCODE GIS Chia-pet track
diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 295340f..7270b63 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -7719,30 +7719,117 @@
 
 Color getSeqColor(char *seqName, struct hvGfx *hvg)
 /* Return color of chromosome/scaffold/contig/numeric string. */
 {
 return getSeqColorDefault(seqName, hvg, chromColor[0]);
 }
 
 Color lfChromColor(struct track *tg, void *item, struct hvGfx *hvg)
 /* Return color of chromosome for linked feature type items
  * where the chromosome is listed somewhere in the lf->name. */
 {
 struct linkedFeatures *lf = item;
 return getSeqColorDefault(lf->name, hvg, tg->ixColor);
 }
 
+Color interactionColor(struct track *tg, void *item, struct hvGfx *hvg)
+{
+char *name = tg->itemName(tg, item);
+struct linkedFeatures *lf = item;
+if (slCount(lf->components) == 2)
+    return MG_BLACK;
+//errAbort("name %s\n", name);
+//errAbort("name %s chrom %s\n", b->name, b->chrom);
+return getSeqColorDefault(name, hvg, tg->ixColor);
+}
+
+void interactionLeftLabels(struct track *tg, int seqStart, int seqEnd,
+	struct hvGfx *hvg, int xOff, int yOff, int width, int height,
+	boolean withCenterLabels, MgFont *font, Color color,
+	enum trackVisibility vis)
+{
+/*
+struct linkedFeatures *lf, *lfList = track->items;
+for (lf = lfList; lf != NULL; lf = lf->next)
+    {
+    if (tg->itemLabelColor != NULL)
+	color = tg->itemLabelColor(track, lf, hvg);
+    int itemHeight = tg->itemHeight(track, lf);
+    hvGfxTextRight(hvg, xOff, y, width - 1,
+	itemHeight, color, font, tg->itemName(tg, lf));
+    }
+    */
+}
+
+void interactionLoad(struct track *tg)
+{
+loadGappedBed(tg);
+}
+
+char *interactionName(struct track *tg, void *item)
+{
+struct linkedFeatures *lf = item;
+if (slCount(lf->components) == 2)
+    return "";
+
+char buffer[10 * 1024], *name = buffer;
+safef(buffer, sizeof buffer, "%s", lf->name);
+char *ptr;
+
+if (startsWith(chromName, buffer))
+    {
+    name = strchr(buffer,'-');
+    name++;
+    ptr = strchr(name,':');
+    *ptr = 0;
+    }
+else
+    {
+    ptr = strchr(buffer,':');
+    *ptr = 0;
+    }
+
+//return linkedFeaturesName(tg, item);
+return cloneString(name);
+}
+
+void interactionMethods(struct track *tg)
+{
+tg->freeItems = linkedFeaturesFreeItems;
+tg->drawItems = linkedFeaturesDraw;
+tg->drawItemAt = linkedFeaturesDrawAt;
+tg->mapItemName = linkedFeaturesName;
+tg->totalHeight = tgFixedTotalHeightNoOverflow;
+//tg->totalHeight = linkedFeaturesHeight;
+tg->itemHeight = tgFixedItemHeight;
+//tg->itemHeight = linkedFeaturesItemHeight;
+tg->itemStart = linkedFeaturesItemStart;
+tg->itemEnd = linkedFeaturesItemEnd;
+tg->itemNameColor = linkedFeaturesNameColor;
+tg->nextPrevExon = linkedFeaturesNextPrevItem;
+tg->nextPrevItem = linkedFeaturesLabelNextPrevItem;
+tg->loadItems = interactionLoad;
+//tg->itemName = cactusName;
+tg->itemName = interactionName;
+//tg->itemName = linkedFeaturesName;
+//tg->mapItemName = refGeneMapName;
+tg->itemColor = interactionColor;
+tg->itemNameColor = linkedFeaturesNameColor;
+//tg->drawLeftLabels = interactionLeftLabels;
+tg->canPack = TRUE;
+}
+
 #ifndef GBROWSE
 void loadRnaGene(struct track *tg)
 /* Load up rnaGene from database table to track items. */
 {
 bedLoadItem(tg, "rnaGene", (ItemLoader)rnaGeneLoad);
 }
 
 void freeRnaGene(struct track *tg)
 /* Free up rnaGene items. */
 {
 rnaGeneFreeList((struct rnaGene**)&tg->items);
 }
 
 Color rnaGeneColor(struct track *tg, void *item, struct hvGfx *hvg)
 /* Return color of rnaGene track item. */
@@ -11604,30 +11691,34 @@
     {
     repeatMethods(track);
     }
 else if (sameWord(type, "ld2"))
     {
     ldMethods(track);
     }
 else if (sameWord(type, "factorSource"))
     {
     factorSourceMethods(track);
     }
 else if (sameWord(type, "remote"))
     {
     remoteMethods(track);
     }
+else if (sameWord(type, "interaction"))
+    {
+    interactionMethods(track);
+    }
 #endif /* GBROWSE */
 }
 
 static void compositeLoad(struct track *track)
 /* Load all subtracks */
 {
 struct track *subtrack;
 long thisTime = 0, lastTime = 0;
 for (subtrack = track->subtracks; subtrack != NULL; subtrack = subtrack->next)
     {
     if (isSubtrackVisible(subtrack) &&
 	( limitedVisFromComposite(subtrack) != tvHide))
 	{
 	lastTime = clock1000();
 	if (!subtrack->loadItems) // This could happen if track type has no handler (eg, for new types)