a0a5a8da9739e17bbfe855a0cff62e3e8d88be52
hiram
  Mon Apr 11 10:02:05 2022 -0700
allow elimination of tracks via a dropTracks.lift file refs #29203

diff --git src/hg/utils/automation/asmHubTrackDb.sh src/hg/utils/automation/asmHubTrackDb.sh
index f2cb344..094efd7 100755
--- src/hg/utils/automation/asmHubTrackDb.sh
+++ src/hg/utils/automation/asmHubTrackDb.sh
@@ -10,30 +10,49 @@
 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
+
+if [ -z ${not_tanDups+x} ]; then
+  printf "# skipping the tanDups track\n" 1>&2
+fi
+if [ -z ${not_augustus+x} ]; then
+  printf "# skipping the augustus track\n" 1>&2
+fi
+
 mkdir -p $buildDir/bbi
 mkdir -p $buildDir/ixIxx
 
 # may or may not have a searchTrix for assembly, assume none
 export searchTrix=""
 # check to see if there is a searchTrix assembly index
 if [ -s ${buildDir}/trackData/assemblyGap/${asmId}.assembly.ix ]; then
   rm -f $buildDir/ixIxx/${asmId}.assembly.ix*
   ln -s ../trackData/assemblyGap/${asmId}.assembly.ix $buildDir/ixIxx
   ln -s ../trackData/assemblyGap/${asmId}.assembly.ixx $buildDir/ixIxx
   searchTrix="
 searchTrix ixIxx/${asmId}.assembly.ix"
 fi
 
 if [ -s ${buildDir}/trackData/assemblyGap/${asmId}.assembly.bb ]; then
@@ -124,60 +143,65 @@
 export gapOverlapCount=0
 export tanDupCount=0
 if [ -s $buildDir/trackData/gapOverlap/${asmId}.gapOverlap.bb ]; then
   gapOverlapCount=`zcat $buildDir/trackData/gapOverlap/${asmId}.gapOverlap.bed.gz | wc -l`
   rm -f $buildDir/bbi/${asmId}.gapOverlap.bb
   ln -s ../trackData/gapOverlap/${asmId}.gapOverlap.bb $buildDir/bbi/${asmId}.gapOverlap.bb
 fi
 if [ -s $buildDir/trackData/tandemDups/${asmId}.tandemDups.bb ]; then
   tanDupCount=`zcat $buildDir/trackData/tandemDups/${asmId}.tandemDups.bed.gz | wc -l`
   rm -f $buildDir/bbi/${asmId}.tandemDups.bb
   ln -s ../trackData/tandemDups/${asmId}.tandemDups.bb $buildDir/bbi/${asmId}.tandemDups.bb
 fi
 
 if [ "${gapOverlapCount}" -gt 0 -o "${tanDupCount}" -gt 0 ]; then
 
+  if [ -z ${not_tanDups+x} ]; then
+
   printf "track tanDups
 shortLabel Tandem Dups
 longLabel Paired identical sequences
 compositeTrack on
 visibility hide
 type bigBed 12
 group map
 html html/%s.tanDups\n\n" "${asmId}"
 
   if [ "${gapOverlapCount}" -gt 0 ]; then
     printf "    track gapOverlap
     parent tanDups on
     shortLabel Gap Overlaps
     longLabel Paired exactly identical sequence on each side of a gap
     bigDataUrl bbi/%s.gapOverlap.bb
     type bigBed 12\n\n" "${asmId}"
   fi
 
   if [ "${tanDupCount}" -gt 0 ]; then
     printf "    track tandemDups
     parent tanDups on
     shortLabel Tandem Dups
     longLabel Paired exactly identical sequence survey over entire genome assembly
     bigDataUrl bbi/%s.tandemDups.bb
     type bigBed 12\n\n" "${asmId}"
   fi
 
   $scriptDir/asmHubTanDups.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/$asmId.tanDups.html
 
-fi
+  else
+    printf "# skipping the tanDups track\n" 1>&2
+  fi	#	the else clause of: if [ -z ${not_tanDups+x} ]
+fi	#	if [ "${gapOverlapCount}" -gt 0 -o "${tanDupCount}" -gt 0 ]
 
 # see if there are repeatMasker bb files
 export rmskCount=`(ls $buildDir/trackData/repeatMasker/bbi/${asmId}.rmsk.*.bb 2> /dev/null | wc -l) || true`
 
 if [ "${rmskCount}" -gt 0 ]; then
 
 if [ ! -s "$buildDir/trackData/repeatMasker/$asmId.sorted.fa.out.gz" ]; then
   printf "ERROR: can not find trackData/repeatMasker/$asmId.sorted.fa.out.gz\n" 1>&2
   exit 255
 fi
 
 rm -f $buildDir/$asmId.repeatMasker.out.gz
 ln -s trackData/repeatMasker/$asmId.sorted.fa.out.gz $buildDir/$asmId.repeatMasker.out.gz
 
 printf "track repeatMasker
@@ -615,56 +639,62 @@
 ln -s ../trackData/allGaps/${asmId}.allGaps.bb ${buildDir}/bbi/${asmId}.allGaps.bb
 
 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 [ -z ${not_augustus+x} ]; then
+
 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}"
 $scriptDir/asmHubAugustusGene.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/bbi/$asmId > $buildDir/html/$asmId.augustus.html
 fi
 
+else
+  printf "# skipping the augustus track\n" 1>&2
+fi	#	the else clause of: if [ -z ${not_augustus+x} ]
+
 ###################################################################
 # xenoRefGene genes
 if [ -s ${buildDir}/trackData/xenoRefGene/${asmId}.xenoRefGene.bb ]; then
 rm -f $buildDir/ixIxx/${asmId}.xenoRefGene.ix
 rm -f $buildDir/ixIxx/${asmId}.xenoRefGene.ixx
 rm -f $buildDir/bbi/${asmId}.xenoRefGene.bb
 rm -f $buildDir/genes/${asmId}.xenoRefGene.gtf.gz
   if [ -s ${buildDir}/trackData/xenoRefGene/${asmId}.xenoRefGene.gtf.gz ]; then
     mkdir -p $buildDir/genes
     ln -s ../trackData/xenoRefGene/${asmId}.xenoRefGene.gtf.gz ${buildDir}/genes/${asmId}.xenoRefGene.gtf.gz
   fi
 ln -s ../trackData/xenoRefGene/${asmId}.xenoRefGene.bb ${buildDir}/bbi/${asmId}.xenoRefGene.bb
 ln -s ../trackData/xenoRefGene/$asmId.xenoRefGene.ix $buildDir/ixIxx/${asmId}.xenoRefGene.ix
 ln -s ../trackData/xenoRefGene/$asmId.xenoRefGene.ixx $buildDir/ixIxx/${asmId}.xenoRefGene.ixx