7f65d3da8f2138d847f15a8398f8dcee1a079027
braney
  Fri Aug 7 12:07:59 2026 -0700
quickLift: clip an oversized item to the chains we loaded instead of dropping it, refs #38042

quickLift loads chains for the window plus padding, capped at 1 Mb.  An item that
reaches further than that has ends where no chain reaches, remapRangeList can
place neither of them, and the whole item is dropped even though the part on
screen maps fine.  ClinVar copy number variants run to 159 Mb, so 44 of the 46 in
one window disappeared.

Pull the ends in to what the chains cover before mapping.  The browser never
draws the ends of an item that spans the window, so their exact position does not
matter, and the existing spanned-item merge still reports it.  A clipped end is
snapped to a base inside an aligned block, since remapRangeList will only place a
coordinate that lands on real alignment.

The clip is in the quickLift code, not the shared liftOver remap path.  Only
hgTracks asks for it, so the details page keeps the item's true extent.  Gated by
quickLiftClipToChains, on by default.

diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c
index 9fcef60b3b3..725939538af 100644
--- src/hg/hgTracks/bigBedTrack.c
+++ src/hg/hgTracks/bigBedTrack.c
@@ -839,31 +839,31 @@
     else if (sameString(tdb->type, "bigDbSnp"))
         {
         // bigDbSnp does not have a score field, but I want to compute the freqSourceIx from
         // trackDb and settings one time instead of for each item, so I'm overloading scoreMin.
         int freqSourceIx = scoreMin;
         lf = lfFromBigDbSnp(tdb, bb, filters, freqSourceIx, bbi, chainHash);
         }
     else
 	{
         char startBuf[16], endBuf[16];
         bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow));
         if (bigBedFilterInterval(bbi, bedRow, filters))
             {
             if (quickLiftFile)
                 {
-                if ((bed = quickLiftIntervalsToBed(bbi, chainHash, bb)) != NULL)
+                if ((bed = quickLiftIntervalsToBedClip(bbi, chainHash, bb)) != NULL)
                     {
                     bedCopy = cloneBed(bed);
                     lf = bedMungToLinkedFeatures(&bed, tdb, fieldCount,
                         scoreMin, scoreMax, useItemRgb);
                     }
                 else
                     liftFailed = TRUE;
                 }
             else
                 {
                 bed = bedLoadN(bedRow, fieldCount == 7 ? 6 : fieldCount);
                 bedCopy = cloneBed(bed);
                 lf = bedMungToLinkedFeatures(&bed, tdb, fieldCount,
                     scoreMin, scoreMax, useItemRgb);
                 }