src/hg/hgTracks/bamTrack.c 1.16

1.16 2009/11/20 20:45:54 angie
Needed to be a bit more careful setting both stub coordinates and lfs->end -- was getting lfs->end too short, resulting in too short cachedDna in cds.c in some cases.
Index: src/hg/hgTracks/bamTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/bamTrack.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -B -U 4 -r1.15 -r1.16
--- src/hg/hgTracks/bamTrack.c	17 Nov 2009 18:03:55 -0000	1.15
+++ src/hg/hgTracks/bamTrack.c	20 Nov 2009 20:45:54 -0000	1.16
@@ -238,9 +238,9 @@
 if (lf->next != NULL)
     slSort(&lf, linkedFeaturesCmpStart);
 lfs->orientation = 0;
 lfs->start = lf->start;
-lfs->end = lf->next ? lf->next->end : lf->end;
+lfs->end = lf->next ? max(lf->next->end, lf->end) : lf->end;
 lfs->features = lf;
 return lfs;
 }
 
@@ -272,9 +272,13 @@
 	    // edge of the window.
 	    struct linkedFeatures *stub;
 	    if (core->mpos < 0)
 		{
-		int offscreen = (lf->orientation > 0) ? winEnd + 10 : winStart - 10;
+		int offscreen;
+		if (lf->orientation > 0)
+		    offscreen = max(winEnd, lf->end) + 10;
+		else
+		    offscreen = min(winStart, lf->start) - 10;
 		if (offscreen < 0) offscreen = 0;
 		stub = lfStub(offscreen, -lf->orientation);
 		}
 	    else