8c3236684dfa12ba4f8841fab2dbe43127091148
hiram
  Thu Sep 30 18:19:24 2021 -0700
fixups to function correctly with both target and query are assembly hubs no redmine

diff --git src/hg/utils/automation/asmHubChainNetTrackDb.sh src/hg/utils/automation/asmHubChainNetTrackDb.sh
index 580818c..52583a8 100755
--- src/hg/utils/automation/asmHubChainNetTrackDb.sh
+++ src/hg/utils/automation/asmHubChainNetTrackDb.sh
@@ -53,86 +53,99 @@
   if [ -s "$buildDir/trackData/$lastzDir/axtChain/chainSyn${OtherDb}.bb" ]; then
     ln -s ../trackData/$lastzDir/axtChain/chainSyn${OtherDb}.bb $buildDir/bbi/${asmId}.chainSyn$OtherDb.bb
     ln -s ../trackData/$lastzDir/axtChain/chainSyn${OtherDb}Link.bb $buildDir/bbi/${asmId}.chainSyn${OtherDb}Link.bb
     ln -s ../trackData/$lastzDir/bigMaf/$accessionId.$otherDb.synNet.bb $buildDir/bbi/${asmId}.$otherDb.synNet.bb
     ln -s ../trackData/$lastzDir/bigMaf/$accessionId.$otherDb.synNet.summary.bb $buildDir/bbi/${asmId}.$otherDb.synNet.summary.bb
   fi
   if [ -s "$buildDir/trackData/$lastzDir/axtChain/chainRBest${OtherDb}.bb" ]; then
     ln -s ../trackData/$lastzDir/axtChain/chainRBest${OtherDb}.bb $buildDir/bbi/${asmId}.chainRBest$OtherDb.bb
     ln -s ../trackData/$lastzDir/axtChain/chainRBest${OtherDb}Link.bb $buildDir/bbi/${asmId}.chainRBest${OtherDb}Link.bb
     ln -s ../trackData/$lastzDir/bigMaf/$accessionId.$otherDb.rbestNet.bb $buildDir/bbi/${asmId}.$otherDb.rbestNet.bb
     ln -s ../trackData/$lastzDir/bigMaf/$accessionId.$otherDb.rbestNet.summary.bb $buildDir/bbi/${asmId}.$otherDb.rbestNet.summary.bb
   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/ *(.*//;'`
+    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;'`
-    ymd=`grep -i 'date' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    o_date=`grep -i 'date' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    matrix=""
+    linGap=""
+    minScore=""
   else
     organism=`hgsql -N -e "select organism from dbDb where name=\"$otherDb\"" hgcentraltest`
     sciName=`hgsql -N -e "select scientificName from dbDb where name=\"$otherDb\"" hgcentraltest`
     taxId=`hgsql -N -e "select taxId from dbDb where name=\"$otherDb\"" hgcentraltest`
     o_date=`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`
   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;'`
-    ymd=`grep -i 'date' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    o_date=`grep -i 'date' ${asmReport} | head -1 | tr -d "\r" | sed -e 's/.*date: *//i;'`
+    matrix=""
+    linGap=""
+    minScore=""
   else
     organism=`hgsql -N -e "select organism from dbDb where name=\"$otherDb\"" hgcentraltest`
     sciName=`hgsql -N -e "select scientificName from dbDb where name=\"$otherDb\"" hgcentraltest`
     taxId=`hgsql -N -e "select taxId from dbDb where name=\"$otherDb\"" hgcentraltest`
     o_date=`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
 ##############################################################################
 "
   printf "track chainNet$OtherDb
 compositeTrack on
 shortLabel $organism Chain/Net
 longLabel $organism ($o_date), Chain and Net Alignments
 subGroup1 view Views chain=Chain net=Net
 dragAndDrop subTracks
 visibility hide
 group compGeno
 noInherit on
 "
 
   printf "priority 100.1
 color 0,0,0
 altColor 100,50,0
 type bed 3
 sortOrder view=+
 "
+  if [ "x${matrix}y" = "xy" ]; then
+printf "otherDb $otherDb
+html html/$asmId.chainNet
+
+"
+else
 printf "$matrix
 $minScore
 $linGap
 matrixHeader A, C, G, T
 otherDb $otherDb
 html html/$asmId.chainNet
 
 "
+fi
 printf "    track chainNet${OtherDb}Viewchain
     shortLabel Chain
     view chain
     visibility pack
     parent chainNet$OtherDb
     spectrum on
 
         track chain$OtherDb
         parent chainNet${OtherDb}Viewchain
         subGroups view=chain
         shortLabel $organism Chain
         longLabel $organism ($o_date) Chained Alignments
         type bigChain $otherDb
         bigDataUrl bbi/$asmId.chain$OtherDb.bb
         linkDataUrl bbi/$asmId.chain${OtherDb}Link.bb