ad81d8de49a9c061fb50958f72a017ae1436497d
angie
  Fri Aug 28 08:17:19 2026 -0700
Fix regex for rerooting pango.clade-mutations.tsv to also match B's empty mutation list.
Bug caught by Claude automated review of 0b09514.  Fortunately masked in latest pangolin-data release because the lineage B annotation was preserved when rerooting the tree and did not need re-annotating.

diff --git src/hg/utils/otto/sarscov2phylo/updateLineageTreePb.sh src/hg/utils/otto/sarscov2phylo/updateLineageTreePb.sh
index 01396ed5abe..f58c25a9481 100755
--- src/hg/utils/otto/sarscov2phylo/updateLineageTreePb.sh
+++ src/hg/utils/otto/sarscov2phylo/updateLineageTreePb.sh
@@ -68,31 +68,31 @@
     > pruneRevs
 $matUtils extract -i $startingTree \
     -p -s pruneRevs -O -o gisaidAndPublic.$buildDate.masked.pruneRevs.pb.gz
 
 # Get node ID for root of lineage A, used as reference/root by Pangolin:
 $matUtils extract -i gisaidAndPublic.$buildDate.masked.pruneRevs.pb.gz -C clade-paths.prunedRevs
 lineageARoot=$(grep ^A$'\t' clade-paths.prunedRevs | cut -f 2)
 
 # Reroot protobuf to lineage A and restrict to low mutation density (highly supported nodes):
 $matUtils extract -i gisaidAndPublic.$buildDate.masked.pruneRevs.pb.gz \
     --reroot $lineageARoot \
     --max-mutation-density 2 \
     -O -o gisaidAndPublic.$buildDate.masked.reroot.pb.gz
 
 # Reroot pango.clade-mutations.tsv
-sed -re 's/\t([A-Z][0-9]+[A-Z])/\tT8782C > C28144T > \1/;' $scriptDir/pango.clade-mutations.tsv \
+sed -re 's/\t($|[A-Z][0-9]+[A-Z])/\tT8782C > C28144T > \1/;' $scriptDir/pango.clade-mutations.tsv \
     > pango.clade-mutations.reroot.tsv
 
 # Mask additional bases at the beginning and end of the genome that pangolin masks after
 # aligning input sequences.
 set +x
 for ((i=56;  $i <= 265;  i++)); do
     echo -e "N${i}N"
 done > maskPangoEnds
 for ((i=29674;  $i < 29804;  i++)); do
     echo -e "N${i}N"
 done >> maskPangoEnds
 set -x
 $matUtils mask -i gisaidAndPublic.$buildDate.masked.reroot.pb.gz -c \
     -m maskPangoEnds -o gisaidAndPublic.$buildDate.masked.reroot.pangoMasked.pb.gz