ab84356e6829bc2a0d2939f232dadb6acdd92e2f
hiram
  Thu May 21 15:35:01 2026 -0700
correctly get the "query" short and longLabel in the track statement refs #37380

diff --git src/hg/utils/automation/asmHubChainNetTrackDb.sh src/hg/utils/automation/asmHubChainNetTrackDb.sh
index e355b623c09..17b49fbc4e8 100755
--- src/hg/utils/automation/asmHubChainNetTrackDb.sh
+++ src/hg/utils/automation/asmHubChainNetTrackDb.sh
@@ -107,34 +107,47 @@
     fi
   else
     printf "# there is NO chainLiftOver${OtherDb}.bb\n" 1>&2
   fi
 
   if [ -s "$buildDir/trackData/$lastzDir/axtChain/${accessionId}.${otherDb}.quick.bb" ]; then
     printf "# making quickLift/${otherDb}.bb\n" 1>&2
     ln -s ../trackData/$lastzDir/axtChain/${accessionId}.${otherDb}.quick.bb $buildDir/quickLift/${otherDb}.bb
     ln -s ../trackData/$lastzDir/axtChain/${accessionId}.${otherDb}.quickLink.bb $buildDir/quickLift/${otherDb}.link.bb
   else
     printf "# there is NO chainQuickLift${OtherDb}.bb\n" 1>&2
   fi
 
   otherPrefix=`echo $otherDb | cut -c1-2`
   if [ "${otherPrefix}" = "GC" ]; then
-    sciName=`grep -i 'organism name:' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*organism name: *//i; s/ *(.*//;'`
-    organism=`grep -i 'organism name:' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*organism name: *.*(//i; s/).*//;'`
-    taxId=`grep -i 'taxid:' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*taxid: *//i;'`
-    o_date=`grep -i 'date:' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    # Construct path to query assembly directory: /hive/data/genomes/asmHubs/GCF/000/001/635/GCF_000001635.27/
+    gcPrefix=`echo $otherDb | sed -e 's/_.*//'`
+    numbers=`echo $otherDb | sed -e 's/GC[AF]_//; s/\.[0-9]*$//'`
+    d1=`echo $numbers | cut -c1-3`
+    d2=`echo $numbers | cut -c4-6`
+    d3=`echo $numbers | cut -c7-9`
+    queryBuildDir="/hive/data/genomes/asmHubs/$gcPrefix/$d1/$d2/$d3/$otherDb"
+    queryAsmReport=`ls -d $queryBuildDir/*assembly_report.txt 2> /dev/null || true`
+    if [ -s "${queryAsmReport}" ]; then
+      sciName=`grep -i 'organism name:' ${queryAsmReport} | head -1 | tr -d "\r" | sed -e 's/.*organism name: *//i; s/ *(.*//;'`
+      organism=`grep -i 'organism name:' ${queryAsmReport} | head -1 | tr -d "\r" | sed -e 's/.*organism name: *.*(//i; s/).*//;'`
+      taxId=`grep -i 'taxid:' ${queryAsmReport} | head -1 | tr -d "\r" | sed -e 's/.*taxid: *//i;'`
+      o_date=`grep -i 'date:' ${queryAsmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    else
+      printf "# ERROR: can not find assembly_report.txt for query assembly $otherDb in $queryBuildDir/\n" 1>&2
+      exit 255
+    fi
     matrix=""
     linGap=""
     minScore=""
   else
     organism=`/cluster/bin/x86_64/hgsql -N -e "select organism from dbDb where name=\"$otherDb\"" hgcentraltest`
     sciName=`/cluster/bin/x86_64/hgsql -N -e "select scientificName from dbDb where name=\"$otherDb\"" hgcentraltest`
     taxId=`/cluster/bin/x86_64/hgsql -N -e "select taxId from dbDb where name=\"$otherDb\"" hgcentraltest`
     o_date=`/cluster/bin/x86_64/hgsql -N -e "select description from dbDb where name=\"$otherDb\"" hgcentraltest`
     matrix=`~/kent/src/hg/utils/phyloTrees/findScores.pl $otherDb $targetDb 2>&1 | grep matrix`
     minScore=`~/kent/src/hg/utils/phyloTrees/findScores.pl $otherDb $targetDb 2>&1 | grep MinScore`
    linGap=`~/kent/src/hg/utils/phyloTrees/findScores.pl $otherDb $targetDb 2>&1 | grep LinearGap`
   fi
 
   printf "##############################################################################
 # $otherDb - $organism - $sciName - taxId: $taxId