353a34ac7e7638457db3f55e57452069113d860b
braney
  Sun Sep 6 13:34:28 2026 -0700
Add a bigNet track type, a net of alignments in a bigBed, refs #20824

Track hubs have had no way to show a real net.  The usual stand-in is a
net rendered as a maf, which loses the level structure that makes a net
useful for establishing orthologous sequence.  bigNet holds the netAlign
columns in a bigBed, so a hub can carry the net itself.

The format is bed6+20: the target in chrom/chromStart/chromEnd, the query
sequence in name, the query strand in strand, then level and the rest of
the netAlign fields.  The trackDb line is

type bigNet <targetDb> <chainTrack>

mirroring type netAlign.  chainTrack is the plain trackDb name of the
bigChain track in the same hub; hgc adds the hub prefix itself.

chainNetLoadRangeHub() builds a chainNet from a bigBed range query and
hands it to the same helpToNet() the SQL path uses, so the nesting is
rebuilt the same way.  netDraw picks its loader off tg->isBigBed and the
drawing code below that is untouched.  genericNetClick does the same for
the details page and follows the named chain track for the alignment.

Also bounds the level walk in helpToNet() by help->maxDepth.  It could
read one past the end of the levels array.

netToBigNet converts a net file to bedToBigBed input.  It writes the tab
line itself rather than calling bigNetTabOut, because autoSql prints a
double with %g and that drops digits off a chain score.

diff --git src/hg/utils/netToBigNet/tests/expected/simpleTest.bigNet src/hg/utils/netToBigNet/tests/expected/simpleTest.bigNet
new file mode 100644
index 00000000000..36eb62c542c
--- /dev/null
+++ src/hg/utils/netToBigNet/tests/expected/simpleTest.bigNet
@@ -0,0 +1,14 @@
+chr22	11474667	11479535	chr9	1000	+	1	88449095	88454102	23550	2697	75185.0	top	-1	-1	3069	0	0	854	2910	-1	-1	-1	-1	1600	553
+chr22	11474911	11474928	chr9	1000	+	2	88449345	88449345	0	0	0.0	gap	-1	-1	-1	0	0	0	0	-1	-1	-1	-1	0	0
+chr22	11475306	11475318	chr9	1000	+	2	88449713	88449713	0	0	0.0	gap	-1	-1	-1	0	0	0	0	-1	-1	-1	-1	0	0
+chr22	11475444	11475471	chr9	1000	+	2	88449826	88449826	0	0	0.0	gap	-1	-1	-1	0	0	0	0	-1	-1	-1	-1	0	0
+chr22	11475503	11477149	chr9	1000	+	2	88449858	88450640	0	0	0.0	gap	-1	-1	-1	0	0	854	502	-1	-1	-1	-1	0	0
+chr22	11475503	11477149	chr11	1000	+	3	58769938	58770722	56275	115	2236.0	nonSyn	-1	-1	80	0	0	854	40	-1	-1	-1	-1	0	0
+chr22	11475573	11477104	chr11	1000	+	4	58770018	58770677	0	0	0.0	gap	-1	-1	-1	0	0	854	40	-1	-1	-1	-1	0	0
+chr22	11477657	11477669	chr9	1000	+	2	88451155	88451155	0	0	0.0	gap	-1	-1	-1	0	0	0	0	-1	-1	-1	-1	0	0
+chr22	11478751	11478917	chr9	1000	+	2	88452236	88453333	0	0	0.0	gap	-1	-1	-1	0	0	0	862	-1	-1	-1	-1	166	0
+chr22	11478751	11478917	chr11	1000	-	3	58780620	58780786	45179	166	4743.0	nonSyn	-1	-1	166	0	0	0	114	-1	-1	-1	-1	166	0
+chr22	11479115	11479238	chr9	1000	+	2	88453526	88453910	0	0	0.0	gap	-1	-1	-1	0	0	0	337	-1	-1	-1	-1	123	0
+chr22	11479115	11479238	chr11	1000	+	3	58751189	58751305	46828	115	2574.0	nonSyn	-1	-1	116	0	0	0	0	-1	-1	-1	-1	123	0
+chr22	11479296	11479395	chr9	1000	+	2	88453968	88453968	0	0	0.0	gap	-1	-1	-1	0	0	0	0	-1	-1	-1	-1	41	0
+chr22	11479296	11479395	chr11	1000	+	3	58751359	58751472	46828	95	2126.0	nonSyn	-1	-1	113	0	0	0	0	-1	-1	-1	-1	41	0