6b0035d19769346baffe193ef9419c269d46f8d8
max
  Wed Sep 9 06:09:41 2026 -0700
hprc2annot: pcLAI column 10 is the ancestry centroid, not a segment coordinate

Reading the pcLAI authors' own format description
(github.com/AI-sandbox/hprc-pclai, README "Output format (BED)") while building
the same annotation as a native hg38 track showed that column 10 of the source
BED had been described wrongly here. It is not the PCA coordinate of a longer
ancestry segment the window belongs to; the authors call it the centroid, the
discretized pcLAI ancestry of the window written as the PCA centroid of its
ancestry cluster. That is why it only ever takes four values -- four clusters,
not four long shared segments. The old reading also implied a segmentation step
the method does not have: pcLAI predicts one coordinate per window, and the
blocks visible in the display are runs of windows with similar predictions.

Field renamed pcaSegment -> centroid in pclai.as with the description corrected,
and the mouseOver, the detailsScript exportFields and the description page
follow. The README also settles that windows are a fixed 1000 SNPs rather than a
fixed number of bases, and that thickStart is specified to equal chromStart, so
the occasional thickStart == chromStart-1 the converter works around is a bug in
their files rather than something we misread.

A field name and its description live inside each bigBed, so editing pclai.as
does nothing to a built collection. hprc2annotRewriteAs.sh re-emits a built
bigBed with the current .as -- no re-download, no column change, item count
checked across the round trip, and safe to re-run, unlike hprc2annotFixBed.sh.
All 460 pclai.bb were rewritten with it. Worth knowing: those files had been
built from an older pclai.as than the tree and nothing had noticed, so this is
the tool to run after any .as description edit.

genark: the "...Url" inside a detailsScript value must not be rebased the way
bigDataUrl is. hgc resolves a relative detailsScript Url against the track's own
bigDataUrl when it builds the details page, and bigDataUrl has already been
rebased, so the prefix landed twice: the pcLAI scatterplot had been asking for
contrib/hprc2annot/contrib/hprc2annot/pclaiRefPanel.json and quietly getting
nothing on every GenArk hub. In this layout the panel file is symlinked beside
the .bb, so relative-to-the-.bb is the bare file name; rebaseBeside() does that
and is idempotent, so addContrib can be re-run.

refs #35415

diff --git src/hg/makeDb/trackDb/contrib/hprc2annot/hprc2annot.trackDb.txt src/hg/makeDb/trackDb/contrib/hprc2annot/hprc2annot.trackDb.txt
index 2e2eeb9c115..23a6ccee16e 100644
--- src/hg/makeDb/trackDb/contrib/hprc2annot/hprc2annot.trackDb.txt
+++ src/hg/makeDb/trackDb/contrib/hprc2annot/hprc2annot.trackDb.txt
@@ -1,27 +1,27 @@
 # trackDb stanzas for the hprc2annot GenArk contributed track collection.
 # HPRC Release 2 annotations on the ~462 HPRC assembly hubs, refs #35415.
 #
 # hprc2annotMakeTrackDb.py reads this file, keeps only the stanzas whose
 # bigDataUrl file is present in a given assembly's hub directory, and writes
 # the per-assembly trackDb.txt. Stanzas are separated by blank lines; comment
 # lines are ignored. Paths here are relative to the assembly's hub directory;
 # genark addContrib rewrites them to contrib/hprc2annot/... when it wires the
 # collection into each assembly's hub.txt.
 #
 # dataVersion values come from the HPRC index CSV file names (see the makeDoc,
-# src/hg/makeDb/doc/contrib/hprc2annot.txt); update them when HPRC reissues a
+# src/hg/makeDb/doc/contrib/hprc2annot/hprc2annot.txt); update them when HPRC reissues a
 # track.
 
 track hprcCatGenes
 shortLabel CAT Genes
 longLabel CAT (Comparative Annotation Toolkit) gene annotations
 type bigGenePred
 bigDataUrl catGenes.bb
 group genes
 priority 10
 visibility pack
 labelFields name,name2
 defaultLabelFields name2
 searchIndex name,name2
 baseColorDefault genomicCodons
 dataVersion HPRC Release 2, CAT genes v1.3
@@ -80,33 +80,33 @@
 filterType.original multipleListOr
 filterLabel.original SEDEF original call
 mouseOver Duplicate of ${partner}<br>Identity: ${pctMatch}%<br>Aligned length: ${alnLen} bp<br>Satellite bases: ${satBases}
 dataVersion HPRC Release 2, SEDEF segdups v1.1
 html ../docs/segdups
 
 track hprcPclai
 shortLabel pcLAI Ancestry
 longLabel Pangenome local ancestry inference (pcLAI)
 type bigBed 9 +
 bigDataUrl pclai.bb
 group compGeno
 priority 30
 visibility pack
 itemRgb on
-mouseOver Window ${window}<br>PCA coordinates (PC1,PC2): ${pca}<br>Segment PCA: ${pcaSegment}<br>Confidence: ${score}
+mouseOver Window ${window}<br>Window PC1,PC2: ${pca}<br>Ancestry centroid: ${centroid}<br>Confidence: ${score}
 dataVersion HPRC Release 2, pcLAI v1.1
-detailsScript.scatterPlot.pca {"dataUrl":"../pclaiRefPanel.json","exportFields":["pca","pcaSegment"],"title":"Position in ancestry space","xLabel":"PC1","yLabel":"PC2"}
+detailsScript.scatterPlot.pca {"dataUrl":"../pclaiRefPanel.json","exportFields":["pca","centroid"],"title":"Position in ancestry space","xLabel":"PC1","yLabel":"PC2"}
 html ../docs/pclai
 
 track hprcMethylation
 shortLabel Methylation
 longLabel ONT 5mC CpG methylation
 type bigWig 0 100
 bigDataUrl methylation.bw
 group regulation
 priority 40
 visibility full
 autoScale off
 viewLimits 0:100
 maxHeightPixels 100:40:8
 color 0,0,200
 dataVersion HPRC Release 2, ONT methylation v1.0