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/lib/bigNet.as src/hg/lib/bigNet.as
new file mode 100644
index 00000000000..6ad5f2cd62c
--- /dev/null
+++ src/hg/lib/bigNet.as
@@ -0,0 +1,31 @@
+
+table bigNet
+"bigNet - a net of pairwise alignments in bigBed format"
+    (
+    string chrom;       "Reference sequence chromosome or scaffold"
+    uint   chromStart;  "Start position in chromosome"
+    uint   chromEnd;    "End position in chromosome"
+    string name;        "Name of the query sequence"
+    uint   score;       "Score (0-1000)"
+    char[1] strand;     "+ or - for strand of the query sequence"
+    uint   level;       "Depth in the net.  Odd levels are fills, even levels are gaps"
+    uint   qStart;      "Start of alignment on query sequence"
+    uint   qEnd;        "End of alignment on query sequence"
+    uint   chainId;     "Id of the chain that fills this gap.  0 for a gap"
+    uint   ali;         "Bases in gap-free alignments"
+    double chainScore;  "Score from the chain"
+    string type;        "Syntenic type: gap, top, syn, nonSyn or inv"
+    int    qOver;       "Overlap with parent gap on query side.  -1 for undefined"
+    int    qFar;        "Distance from parent gap on query side.  -1 for undefined"
+    int    qDup;        "Bases with two or more copies in query.  -1 for undefined"
+    int    tN;          "Unsequenced bases on target.  -1 for undefined"
+    int    qN;          "Unsequenced bases on query.  -1 for undefined"
+    int    tR;          "RepeatMasker bases on target.  -1 for undefined"
+    int    qR;          "RepeatMasker bases on query.  -1 for undefined"
+    int    tNewR;       "Lineage specific repeat bases on target.  -1 for undefined"
+    int    qNewR;       "Lineage specific repeat bases on query.  -1 for undefined"
+    int    tOldR;       "Bases of ancient repeats on target.  -1 for undefined"
+    int    qOldR;       "Bases of ancient repeats on query.  -1 for undefined"
+    int    tTrf;        "Bases of tandem repeats on target.  -1 for undefined"
+    int    qTrf;        "Bases of tandem repeats on query.  -1 for undefined"
+    )