f29b65452a1cca8a5bc62f007100b313e589d036
braney
  Sun Sep 6 15:11:36 2026 -0700
quickLift: lift a bigNet track, refs #20824

A net is not an ordinary track to lift.  It is an alignment of two assemblies,
so only its target side moves to the new reference; the query side names a third
assembly and is carried across untouched.  And the browser draws a net by
recursion, so what really has to survive the lift is the tree: a row's level only
means anything relative to the row above it.

chainNetLoadRangeQuickLift() maps each row's target range with
quickLiftIntervalsToBedClip, which is the same code every other quickLift track
uses, so a net row lands where a bed of the same span would.  The surviving rows
then go to the same helpToNet() the unlifted path uses, so there is one tree
builder and not two.  The row collection either path does is now cnlHelperNew and
cnlHelperAddBigNet.

validateOneTdb lets bigNet into a quickLift hub.  Its chain track is not offered,
so a lifted net's details page has no chain to follow and says so rather than
looking for a track this assembly does not have.  bigNetLoadOne lifts the same
way for that page, unclipped, so it reports the item's whole extent.

bigNetFromInterval passes -1 as the cached chromId.  bbiCachedChromLookup leaves
the buffer alone when the id matches the one before it, so a cache that outlives
the buffer hands back stale bytes.

Measured against the standalone liftOver tool, on hg19 chr22's mouse net lifted
to hg38: 36 of 36 source rows in the sampled window land on the same coordinates,
counting the one liftOver will not take whole, whose two ends it does place
exactly where the browser puts them.  Against hg38's own mouse net, computed
independently, 1.02% of the drawn pixels differ.

diff --git src/hg/hgTracks/netTrack.c src/hg/hgTracks/netTrack.c
index c28d64ef9b1..d50538edd38 100644
--- src/hg/hgTracks/netTrack.c
+++ src/hg/hgTracks/netTrack.c
@@ -235,32 +235,36 @@
 	}
     }
 }
 
 static void netDraw(struct track *tg, int seqStart, int seqEnd,
         struct hvGfx *hvg, int xOff, int yOff, int width,
         MgFont *font, Color color, enum trackVisibility vis)
 /* Draw routine for netAlign type tracks.  This will load
  * the items as well as drawing them. */
 {
 /* Load Net. */
 struct chainNet *net;
 if (tg->isBigBed)
     {
     char *fileName = hReplaceGbdb(trackDbSetting(tg->tdb, "bigDataUrl"));
+    char *quickLiftFile = trackDbSetting(tg->tdb, "quickLiftUrl");
     if (fileName == NULL)
         errAbort("No bigDataUrl in track %s", tg->track);
+    if (quickLiftFile != NULL)
+        net = chainNetLoadRangeQuickLift(quickLiftFile, fileName, chromName, seqStart, seqEnd);
+    else
         net = chainNetLoadRangeHub(fileName, chromName, seqStart, seqEnd);
     }
 else
     net = chainNetLoadRange(database, tg->table, chromName,
 	seqStart, seqEnd, NULL);
 
 if (net != NULL)
     {
     /* Copy parameters to statics for recursive routine. */
     rTg = tg;
     rHvg = hvg;
     rX = xOff;
 
     /* Clear cache. */
     netColorClearCache();