916b1db3c50ed46600f8c13acb742cb9dd205f6d
braney
  Fri May 27 17:11:10 2016 -0700
support connections to other chroms in longRange display.  Also,
longTabix in trackHubs

diff --git src/hg/lib/longRange.c src/hg/lib/longRange.c
index e2d6c4a..43e8f09 100644
--- src/hg/lib/longRange.c
+++ src/hg/lib/longRange.c
@@ -56,63 +56,64 @@
 ptr++;
 *e = atoi(ptr);
 ptr = strchr(ptr, ',');
 if (ptr == NULL)
     errAbort("bad longTabix bed name %s\n", bed->name);
 ptr++;
 *score = sqlDouble(ptr);
 
 return otherChrom;
 }
 
 struct longRange *parseLongTabix(struct bed *beds, unsigned *maxWidth, double minScore)
 /* Parse longTabix format into longRange structures */
 {
 struct longRange *longRangeList = NULL;
+*maxWidth = 1;
 for(; beds; beds=beds->next)
     {
     double score;
     unsigned otherS;
     unsigned otherE;
     char *otherChrom = getOther(beds, &otherS, &otherE, &score);
     if (score < minScore)
         continue;
 
     struct longRange *longRange;
     AllocVar(longRange);
     slAddHead(&longRangeList, longRange);
 
     unsigned otherCenter = (otherS + otherE)/2;
     unsigned otherWidth = otherE - otherS;
     unsigned thisWidth = beds->chromEnd - beds->chromStart;
     unsigned center = (beds->chromEnd + beds->chromStart) / 2;
 
     // don't have oriented feet at the moment
     longRange->sOrient = longRange->eOrient = 0;
     longRange->id = beds->score;
     longRange->score = score;
     longRange->name = beds->name;
     
-    if (otherCenter < center)
+    if (sameString(beds->chrom, otherChrom) && (otherCenter < center))
         {
         longRange->s = otherCenter;
         longRange->sw = otherWidth;
         longRange->sChrom = otherChrom;
         longRange->e = center;
         longRange->ew = thisWidth;
         longRange->eChrom = beds->chrom;
         }
     else
         {
         longRange->s = center;
         longRange->sw = thisWidth;
         longRange->sChrom = beds->chrom;
         longRange->e = otherCenter;
         longRange->ew = otherWidth;
         longRange->eChrom = otherChrom;
         }
     unsigned longRangeWidth = longRange->e - longRange->s;
-    if (longRangeWidth > *maxWidth)
+    if (sameString(longRange->eChrom,longRange->sChrom) && ( longRangeWidth > *maxWidth))
         *maxWidth = longRangeWidth;
     }
 return longRangeList;
 }