ac38533f23605cb72cffcf3017838c9a10dab63e
hiram
  Wed Sep 21 16:06:17 2022 -0700
now making a track for TOGA annotations refs #29982

diff --git src/hg/utils/automation/asmHubTrackDb.sh src/hg/utils/automation/asmHubTrackDb.sh
index 4e57e69..97db060 100755
--- src/hg/utils/automation/asmHubTrackDb.sh
+++ src/hg/utils/automation/asmHubTrackDb.sh
@@ -220,30 +220,31 @@
     ln -s trackData/repeatMasker/${asmId}.fa.align.tsv.gz $buildDir/${asmId}.fa.align.tsv.gz
   fi
   ln -s ../trackData/repeatMasker/${asmId}.rmsk.bb $buildDir/bbi/${asmId}.rmsk.bb
   ln -s trackData/repeatMasker/${asmId}.sorted.fa.join.tsv.gz $buildDir/${asmId}.fa.join.tsv.gz
 
 printf "track repeatMasker
 shortLabel RepeatMasker
 longLabel RepeatMasker Repetitive Elements
 type bigRmsk 9 +
 visibility pack
 group varRep
 bigDataUrl bbi/%s.rmsk.bb\n" "${asmId}"
 if [ -s "$buildDir/bbi/${asmId}.rmsk.align.bb" ]; then
   printf "xrefDataUrl bbi/%s.rmsk.align.bb\n" "${asmId}"
 fi
+printf "maxWindowToDraw 5000000\n"
 export rmskClassProfile="$buildDir/trackData/repeatMasker/$asmId.rmsk.class.profile.txt"
 if [ -s "${rmskClassProfile}" ]; then
   printf "html html/%s.repeatMasker\n\n" "${asmId}"
   $scriptDir/asmHubRmskJoinAlign.pl $asmId $buildDir > $buildDir/html/$asmId.repeatMasker.html
 else
   printf "\n"
 fi
 
 else	#	else clause of if [ "${newRmsk}" -gt 0 ]
 
 printf "track repeatMasker
 compositeTrack on
 shortLabel RepeatMasker
 longLabel Repeating Elements by RepeatMasker
 group varRep
@@ -850,32 +851,83 @@
 mouseOverField _mouseOver
 scoreLabel MIT Guide Specificity Score
 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}/trackData/crisprAll/crispr.bb ]
+
+# TOGA track if exists
+# build directory can be either TOGAvGalGal6v1 or TOGAvHg38v1
+
+export tg=`ls -d ${buildDir}/trackData/TOGAv* 2> /dev/null | wc -l`
+if [ "${tg}" -gt 0 ]; then
+  rm -f $buildDir/bbi/HLTOGAannotVs*.*
+  rm -f $buildDir/ixIxx/HLTOGAannotVs*.*
+  tData=`ls -d $buildDir/trackData/TOGAv* | sed -e 's#.*/trackData#trackData#;'`
+  fBase=`ls $buildDir/trackData/TOGAv*/HLTOGAannotVs*.bb | sed -e 's#.*/##; s/.bb//;'`
+  # there is a bug in the source files that have galGal6 when they should
+  # be GalGal6
+  FBase=`echo $fBase | sed -e 's#galGal6#GalGal6#;'`
+  ln -s ../$tData/$fBase.bb $buildDir/bbi/$FBase.bb
+  ln -s ../$tData/$fBase.ix $buildDir/ixIxx/$FBase.ix
+  ln -s ../$tData/$fBase.ixx $buildDir/ixIxx/$FBase.ixx
+  if [ -d ${buildDir}/trackData/TOGAvHg38v1 ]; then
+printf "track HLTOGAannotvHg38v1
+bigDataUrl bbi/HLTOGAannotVsHg38v1.bb
+shortLabel TOGA vs. hg38
+longLabel TOGA annotations using human/hg38 as reference
+group genes
+visibility hide
+itemRgb on
+type bigBed 12
+searchIndex name
+searchTrix  ixIxx/HLTOGAannotVsHg38v1.ix
+html html/TOGAannotation
+"
+  elif [ -d ${buildDir}/trackData/TOGAvGalGal6v1 ]; then
+printf "track HLTOGAannotvGalGal6v1
+bigDataUrl bbi/HLTOGAannotVsGalGal6v1.bb
+shortLabel TOGA vs. galGal6
+longLabel TOGA annotations using chicken/galGal6 as reference
+group genes
+visibility hide
+itemRgb on
+type bigBed 12
+searchIndex name
+searchTrix  ixIxx/HLTOGAannotVsGalGal6v1.ix
+html html/TOGAannotation
+"
+  else
+    printf "# ERROR: do not recognize TOGA build directory:\n" 1>&2
+    ls -d ${buildDir}/trackData/TOGAv* 1>&2
+    exit 255
   fi
 
+$scriptDir/asmHubTOGA.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/TOGAannotation.html
+
+fi	#	if [ "${tg}" -gt 0 ]
+
 # 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