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/htdocs/goldenPath/help/trackDb/trackDbLibrary.shtml src/hg/htdocs/goldenPath/help/trackDb/trackDbLibrary.shtml
index 6e5550b8eaf..90543346bd7 100644
--- src/hg/htdocs/goldenPath/help/trackDb/trackDbLibrary.shtml
+++ src/hg/htdocs/goldenPath/help/trackDb/trackDbLibrary.shtml
@@ -160,30 +160,31 @@
     <P>Valid settings:</P>
     <P>
     <A onclick="return jumpTo(this);" HREF="#">altGraphX</A>,
     <A onclick="return jumpTo(this);" HREF="#">bam</A>,
     <A onclick="return jumpTo(this);" HREF="#">bed</A>,
     <A onclick="return jumpTo(this);" HREF="#">bed5FloatScore</A>,
     <A onclick="return jumpTo(this);" HREF="#">bedGraph</A>,
     <A onclick="return jumpTo(this);" HREF="#">bedRnaElements</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigBarChart</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigBed</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigInteract</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigLolly</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigPsl</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigChain</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigMaf</A>,
+    <A onclick="return jumpTo(this);" HREF="#">bigNet</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigWig</A>,
     <A onclick="return jumpTo(this);" HREF="#">broadPeak</A>,
     <A onclick="return jumpTo(this);" HREF="#">chain</A>,
     <A onclick="return jumpTo(this);" HREF="#">clonePos</A>,
     <A onclick="return jumpTo(this);" HREF="#">coloredExon</A>,
     <A onclick="return jumpTo(this);" HREF="#">ctgPos</A>,
     <A onclick="return jumpTo(this);" HREF="#">downloadsOnly</A>,
     <A onclick="return jumpTo(this);" HREF="#">encodeFiveC</A>,
     <A onclick="return jumpTo(this);" HREF="#">expRatio</A>,
     <A onclick="return jumpTo(this);" HREF="#">factorSource</A>,
     <A onclick="return jumpTo(this);" HREF="#">genePred</A>,
     <A onclick="return jumpTo(this);" HREF="#">gvf</A>,
     <A onclick="return jumpTo(this);" HREF="#">hic</A>,
     <A onclick="return jumpTo(this);" HREF="#">ld2</A>,
     <A onclick="return jumpTo(this);" HREF="#">narrowPeak</A>,
@@ -210,30 +211,31 @@
     <div class="format"><code>type</code></div>
     <P class="isRequired">Required: <span class="red">Yes</span></P>
     <P>Declares the format of the data and is used to
     determine display methods and options.</P>
     <P>Valid settings for a hub:</P>
     <P>
     <A onclick="return jumpTo(this);" HREF="#">bam/cram</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigBarChart</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigBed</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigChain</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigGenePred</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigInteract</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigLolly</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigMaf</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigNarrowPeak</A>,
+    <A onclick="return jumpTo(this);" HREF="#">bigNet</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigPsl</A>,
     <A onclick="return jumpTo(this);" HREF="#">bigWig</A>,
     <A onclick="return jumpTo(this);" HREF="#">halSnake</A>,
     <A onclick="return jumpTo(this);" HREF="#">hic</A>,
     <A onclick="return jumpTo(this);" HREF="#">vcfTabix</A>,
     <A onclick="return jumpTo(this);" HREF="#">vcfPhasedTrio</A>.
     </P>
     <P>Detailed descriptions of each type can be found
     below.  In many cases the type setting includes additional
     parameters to further specify the data format.  Some track types
     have additional setting requirements, to be discussed
     below.</P>
     <P><B>Example:</B></P>
     <pre>   type bigBed 6 +</pre>
 </DIV>
@@ -463,41 +465,42 @@
 <DIV class="lollyMaxSize"><span class="types bigLolly"></span>
 <div class="format"><code>lollyMaxSize &lt;integer&gt;</code></div>
     The maximum size of a lollipop in the file, used to establish margins.
 </DIV>
 
 <DIV class="yAxisLabel"><span class="types bigLolly"></span>
 <div class="format"><code>yAxisLabel.&lt;integer&gt; &lt;integer&gt; &lt;on/off&gt; &lt;R,G,B&gt; &lt;string&gt; </code></div>
     Add a label on the y axis at the given position. Draw a line of color if requested.
 </DIV>
 
 <DIV class="yAxisNumLabels"><span class="types bigLolly"></span>
 <div class="format"><code>yAxisNumLabels.&lt;on/off&gt; &lt;integer&gt;</code></div>
     Turn the y axis number labels on or off
 </DIV>
 
-<DIV class="bigDataUrl"><span class="types bigBarChart bigBed bigChain bigInteract bigLolly bigMaf bigPsl bigWig bam hic vcfTabix vcfPhasedTrio"></span>
+<DIV class="bigDataUrl"><span class="types bigBarChart bigBed bigChain bigInteract bigLolly bigMaf bigNet bigPsl bigWig bam hic vcfTabix vcfPhasedTrio"></span>
 <div class="format"><code>bigDataUrl &lt;url/relativePath&gt;</code></div>
     <P class="isRequired">Required: <span class="red">For Hubs</span></P>
     <P>The location of a remote data file containing the bulk of the data for the track.
     This setting is required for all data tracks in a track hub.  </P>  
 <!-- THIS SHOULD BE FIXED for local tracks! -->
     <P>The setting is either the full URL (including <code>http:</code> or another protocol)
     or it is relative to the directory in which the trackDb file containing this setting
     is located.  The file must be in one of
     the supported remote data file formats: bam/cram, bigBarChart, bigBed, bigChain, bigLolly,
-    bigInteract, bigMaf, bigPsl, bigGenePred, bigMethyl, bigNarrowPeak, bigWig, vcfTabix, or hic.
+    bigInteract, bigMaf, bigNet, bigPsl, bigGenePred, bigMethyl, bigNarrowPeak, bigWig, vcfTabix,
+    or hic.
     Note that bam/cram and vcfTabix/vcfPhasedTrio types require a separate
     index file that must have the same name as the data file plus a
     standard suffix (".bai" and ".tbi" respectively), unless
     <A onclick="jumpTo(this)" HREF="#">bigDataIndex</A> is used.
     All occurrences of the  string <code>$D</code> in the URL will be
     substituted with the genome assembly database name.  This allows a
     trackDb entry to be used with for multiple assemblies.  <code>$D</code>
     substitution is not implemented for track hubs.
 
     </P> <P><B>Example:</B></P>
     <pre>   bigDataUrl http://vizhub.wustl.edu/VizHub/hg19/biBrainH3K4me1.bb</pre>
     &nbsp;&nbsp;or
     <pre>   bigDataUrl biBrainH3K4me1.bb</pre>
 </DIV>
 
@@ -1273,30 +1276,37 @@
 
 </DIV>
 
 <DIV class="bigPsl"><span class="types bigPsl"></span>
 <div class="format">
     <code>type bigPsl</code></div>
 There are no extra options that can appear on the type bigPsl line.
 </DIV>
 
 <DIV class="bigChain"><span class="types bigChain"></span>
 <div class="format">
     <code>type bigChain targetDb</code></div>
 You must specify the target database in the type bigChain line.
 </DIV>
 
+<DIV class="bigNet"><span class="types bigNet"></span>
+<div class="format">
+    <code>type bigNet targetDb chainTrack</code></div>
+You must give the target database and the name of the chain track that holds the alignments
+in the type bigNet line.  The chain track is in the same hub.
+</DIV>
+
 <DIV class="bigNarrowPeak"><span class="types bigNarrowPeak"></span>
 <div class="format">
     <code>type bigNarrowPeak</code></div>
 There are no extra options that can appear on the type bigNarrowPeak line.
 </DIV>
 
 <DIV class="bigGenePred"><span class="types bigGenePred"></span>
 <div class="format">
     <code>type bigGenePred</code></div>
 There are no extra options that can appear on the type bigGenePred line.
 </DIV>
 
 <DIV class="bigMaf"><span class="types bigMaf"></span>
 <div class="format">
     <code>type bigMaf</code></div>