2ac0b5334f5f839dfe9b853c804fe5d4b35c1175
hiram
  Thu Apr 7 13:29:10 2022 -0700
move the userTrackDb include to the end add correct chainNet.html for composite track and check for including trackDbOverrides refs #29203

diff --git src/hg/utils/automation/asmHubTrackDb.sh src/hg/utils/automation/asmHubTrackDb.sh
index ba88ee3..f2cb344 100755
--- src/hg/utils/automation/asmHubTrackDb.sh
+++ src/hg/utils/automation/asmHubTrackDb.sh
@@ -617,31 +617,36 @@
 printf "track allGaps
 shortLabel All Gaps
 longLabel All gaps of unknown nucleotides (N's), including AGP annotated gaps
 group map
 visibility dense
 type bigBed 3
 bigDataUrl bbi/%s.allGaps.bb
 html html/%s.allGaps\n\n" "${asmId}" "${asmId}"
 $scriptDir/asmHubAllGaps.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/$asmId.agp.gz https://hgdownload.soe.ucsc.edu/hubs/VGP/genomes/$asmId $buildDir/bbi/$asmId > $buildDir/html/$asmId.allGaps.html
 fi
 
 ###################################################################
 # augustus genes
 if [ -s ${buildDir}/trackData/augustus/${asmId}.augustus.bb ]; then
 rm -f ${buildDir}/bbi/${asmId}.augustus.bb
+rm -f ${buildDir}/genes/${asmId}.augustus.gtf.gz
 ln -s ../trackData/augustus/${asmId}.augustus.bb ${buildDir}/bbi/${asmId}.augustus.bb
+if [ -s ${buildDir}/trackData/augustus/${asmId}.augustus.gtf.gz ]; then
+    mkdir -p $buildDir/genes
+    ln -s ../trackData/augustus/${asmId}.augustus.gtf.gz ${buildDir}/genes/${asmId}.augustus.gtf.gz
+fi
 
 export augustusVis="dense"
 
 if [ "${haveNcbiGene}" = "no" -a "${haveNcbiRefSeq}" = "no" ]; then
    augustusVis="pack"
 fi
 printf "track augustus
 shortLabel Augustus
 longLabel Augustus Gene Predictions
 group genes
 visibility %s
 color 180,0,0
 type bigGenePred
 bigDataUrl bbi/%s.augustus.bb
 html html/%s.augustus\n\n" "${augustusVis}" "${asmId}" "${asmId}"
@@ -712,49 +717,46 @@
 
 $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
 
 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
 
-if [ -s "${buildDir}/$asmId.userTrackDb.txt" ]; then
-  printf "include %s.userTrackDb.txt\n\n" "${accessionId}"
-fi
-
 ###################################################################
 # check for lastz/chain/net available
 
 export lz=`ls -d ${buildDir}/trackData/lastz.* 2> /dev/null | wc -l`
 
 if [ "${lz}" -gt 0 ]; then
   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
 
 if [ -s ${buildDir}/trackData/crisprAll/crispr.bb ]; then
 
 rm -f $buildDir/bbi/${asmId}.crisprAll.bb
 rm -f $buildDir/bbi/${asmId}.crisprAllDetails.tab
 ln -s ../trackData/crisprAll/crispr.bb ${buildDir}/bbi/${asmId}.crisprAll.bb
 ln -s ../trackData/crisprAll/crisprDetails.tab $buildDir/bbi/${asmId}.crisprAllDetails.tab
 
 printf "track crisprAllTargets
 visibility hide
@@ -769,19 +771,22 @@
 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
 
-if [ -s "${buildDir}/$asmId.trackDbOverrides.txt" ]; then
-  printf "\ninclude %s.trackDbOverrides.txt\n\n" "${accessionId}"
+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