9595301c34b8e4818baa37a72eff7e5cbfcfcb4e
hiram
  Tue Sep 13 13:20:15 2022 -0700
now working thru trackDb although the generated html needs to be fixed up refs #29811

diff --git src/hg/utils/automation/asmHubTrackDb.sh src/hg/utils/automation/asmHubTrackDb.sh
index a51003a..1a54622 100755
--- src/hg/utils/automation/asmHubTrackDb.sh
+++ src/hg/utils/automation/asmHubTrackDb.sh
@@ -1,35 +1,27 @@
 #!/bin/bash
 
 set -beEu -o pipefail
 
 if [ $# -ne 2 ]; then
   printf "usage: trackDb.sh <asmId> <pathTo/assembly hub build directory> > trackDb.txt\n" 1>&2
   printf "expecting to find *.ucsc.2bit and bbi/ files at given path\n" 1>&2
   exit 255
 fi
 
 export asmId=$1
 export buildDir=$2
-# hubLinks is for mouseStrains specific hub only
-export hubLinks="/hive/data/genomes/asmHubs/hubLinks"
-export accessionId=`echo "$asmId" | awk -F"_" '{printf "%s_%s", $1, $2}'`
-export gcX=`echo $asmId | cut -c1-3`
-export d0=`echo $asmId | cut -c5-7`
-export d1=`echo $asmId | cut -c8-10`
-export d2=`echo $asmId | cut -c11-13`
-export hubPath="$gcX/$d0/$d1/$d2/$asmId"
 
 export scriptDir="$HOME/kent/src/hg/utils/automation"
 
 # technique to set variables based on the name in another variable:
 
 if [ -s "$buildDir/dropTracks.list" ]; then
   printf "# reading dropTracks.list\n" 1>&2
   for dropTrack in `cat "$buildDir/dropTracks.list"`
   do
      notTrack="not_${dropTrack}"
 #      printf "# %s\n" "${notTrack}" 1>&2
      eval $notTrack="1"
   done
 fi
 
@@ -790,44 +782,51 @@
 priority 40
 visibility pack
 color 150,0,0
 type bigBed 12 .
 bigDataUrl bbi/%s.ensGene.bb
 searchIndex name
 searchTrix ixIxx/%s.ensGene.ix
 html html/%s.ensGene\n\n" "${ensVersion}" "${asmId}" "${asmId}" "${asmId}"
 
 $scriptDir/asmHubEnsGene.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/bbi/$asmId > $buildDir/html/$asmId.ensGene.html "${ensVersion}"
 
 else
   printf "# no ensGene found\n" 1>&2
 fi
 
+# hubLinks is for mouseStrains specific hub only
+export hubLinks="/hive/data/genomes/asmHubs/hubLinks"
 if [ -s ${hubLinks}/${asmId}/rnaSeqData/$asmId.trackDb.txt ]; then
   printf "include rnaSeqData/%s.trackDb.txt\n\n" "${asmId}"
 fi
 ##  for mouse strain hubs only
 if [ -s "${buildDir}/$asmId.bigMaf.trackDb.txt" ]; then
   printf "include %s.bigMaf.trackDb.txt\n\n" "${asmId}"
 fi
 
 ###################################################################
 # check for lastz/chain/net available
 
 export lz=`ls -d ${buildDir}/trackData/lastz.* 2> /dev/null | wc -l`
 
 if [ "${lz}" -gt 0 ]; then
+  export gcX=`echo $asmId | cut -c1-3`
+  export d0=`echo $asmId | cut -c5-7`
+  export d1=`echo $asmId | cut -c8-10`
+  export d2=`echo $asmId | cut -c11-13`
+  export hubPath="$gcX/$d0/$d1/$d2/$asmId"
   if [ "${lz}" -eq 1 ]; then
     export lastzDir=`ls -d ${buildDir}/trackData/lastz.*`
     export oOrganism=`basename "${lastzDir}" | sed -e 's/lastz.//;'`
     # single chainNet here, no need for a composite track, does the symLinks too
     ~/kent/src/hg/utils/automation/asmHubChainNetTrackDb.sh $asmId $buildDir
     $scriptDir/asmHubChainNet.pl $asmId $buildDir/html/$asmId.names.tab $oOrganism $hubPath > $buildDir/html/$asmId.chainNet.html
   else
     # multiple chainNets here, create composite track, does the symLinks too
     ~/kent/src/hg/utils/automation/asmHubChainNetTrackDb.pl $buildDir
     $scriptDir/asmHubChainNetComposite.pl $asmId $buildDir/html/$asmId.names.tab $hubPath > $buildDir/html/$asmId.chainNet.html
   fi
 fi
 
 ###################################################################
 # crisprAll track
@@ -852,22 +851,30 @@
 bigDataUrl bbi/%s.crisprAll.bb
 # details page is not using a mysql table but a tab-sep file
 detailsTabUrls _offset=bbi/%s.crisprAllDetails.tab
 url http://crispor.tefor.net/crispor.py?org=\$D&pos=\$S:\${&pam=NGG
 urlLabel Click here to show this guide on Crispor.org, with expression oligos, validation primers and more
 tableBrowser noGenome
 noGenomeReason This track is too big for whole-genome Table Browser access, it would lead to a timeout in your internet browser. Please see the CRISPR Track documentation, the section \"Data Access\", for bulk-download options. Contact us if you encounter difficulties with downloading the data.
 denseCoverage 0
 scoreFilterMax 100
 " "${asmId}" "${asmId}" "${asmId}"
 
 $scriptDir/asmHubCrisprAll.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/$asmId.crisprAll.html
 
 fi
 
+# accessionId only used for include statements for other trackDb.txt files
+export accessionId="${asmId}"
+case ${asmId} in
+   GC*)
+     accessionId=`echo "$asmId" | awk -F"_" '{printf "%s_%s", $1, $2}'`
+     ;;
+esac
+
 if [ -s "${buildDir}/$asmId.userTrackDb.txt" ]; then
   printf "\ninclude %s.userTrackDb.txt\n" "${accessionId}"
 fi
 
 if [ -s "${buildDir}/$asmId.trackDbOverrides.txt" ]; then
   printf "\ninclude %s.trackDbOverrides.txt\n" "${accessionId}"
 fi