69809a6ecef72bb253a4191e80c40e426af5d14a
hiram
  Tue May 26 11:15:20 2020 -0700
fixup rmsk correct composite track definitions and fixup ncbiGene organization refs #23734

diff --git src/hg/utils/automation/asmHubTrackDb.sh src/hg/utils/automation/asmHubTrackDb.sh
index 073a62c..16af62c 100755
--- src/hg/utils/automation/asmHubTrackDb.sh
+++ src/hg/utils/automation/asmHubTrackDb.sh
@@ -161,222 +161,164 @@
 fi
 
 export rmskCount=`(ls $buildDir/trackData/repeatMasker/bbi/${asmId}.rmsk.*.bb | wc -l) || true`
 
 
 # see if there are repeatMasker bb files
 export rmskCount=`(ls $buildDir/trackData/repeatMasker/bbi/${asmId}.rmsk.*.bb | wc -l) || true`
 
 if [ "${rmskCount}" -gt 0 ]; then
 printf "track repeatMasker
 compositeTrack on
 shortLabel RepeatMasker
 longLabel Repeating Elements by RepeatMasker
 group varRep
 visibility dense
-type bed 3 .
-noInherit on
+type bigBed 6 +
+colorByStrand 50,50,150 150,50,50
+maxWindowToDraw 10000000
+spectrum on
 html html/%s.repeatMasker\n\n" "${asmId}"
 $scriptDir/asmHubRmsk.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData/repeatMasker/$asmId.rmsk.class.profile.txt > $buildDir/html/$asmId.repeatMasker.html
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.SINE.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.SINE.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.SINE.bb $buildDir/bbi/${asmId}.rmsk.SINE.bb
 printf "    track repeatMaskerSINE
     parent repeatMasker
     shortLabel SINE
     longLabel SINE Repeating Elements by RepeatMasker
-    priority 1
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 1
     bigDataUrl bbi/%s.rmsk.SINE.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.LINE.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.LINE.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.LINE.bb $buildDir/bbi/${asmId}.rmsk.LINE.bb
 printf "    track repeatMaskerLINE
     parent repeatMasker
     shortLabel LINE
     longLabel LINE Repeating Elements by RepeatMasker
-    priority 2
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 2
     bigDataUrl bbi/%s.rmsk.LINE.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.LTR.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.LTR.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.LTR.bb $buildDir/bbi/${asmId}.rmsk.LTR.bb
 printf "    track repeatMaskerLTR
     parent repeatMasker
     shortLabel LTR
     longLabel LTR Repeating Elements by RepeatMasker
-    priority 3
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 3
     bigDataUrl bbi/%s.rmsk.LTR.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.DNA.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.DNA.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.DNA.bb $buildDir/bbi/${asmId}.rmsk.DNA.bb
 printf "    track repeatMaskerDNA
     parent repeatMasker
     shortLabel DNA
     longLabel DNA Repeating Elements by RepeatMasker
-    priority 4
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 4
     bigDataUrl bbi/%s.rmsk.DNA.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.Simple.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.Simple.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.Simple.bb $buildDir/bbi/${asmId}.rmsk.Simple.bb
 printf "    track repeatMaskerSimple
     parent repeatMasker
     shortLabel Simple
     longLabel Simple Repeating Elements by RepeatMasker
-    priority 5
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 5
     bigDataUrl bbi/%s.rmsk.Simple.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.Low_complexity.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.Low_complexity.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.Low_complexity.bb $buildDir/bbi/${asmId}.rmsk.Low_complexity.bb
 printf "    track repeatMaskerLowComplexity
     parent repeatMasker
     shortLabel Low Complexity
     longLabel Low Complexity Repeating Elements by RepeatMasker
-    priority 6
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 6
     bigDataUrl bbi/%s.rmsk.Low_complexity.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.Satellite.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.Satellite.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.Satellite.bb $buildDir/bbi/${asmId}.rmsk.Satellite.bb
 printf "    track repeatMaskerSatellite
     parent repeatMasker
     shortLabel Satellite
     longLabel Satellite Repeating Elements by RepeatMasker
-    priority 7
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 7
     bigDataUrl bbi/%s.rmsk.Satellite.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.RNA.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.RNA.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.RNA.bb $buildDir/bbi/${asmId}.rmsk.RNA.bb
 printf "    track repeatMaskerRNA
     parent repeatMasker
     shortLabel RNA
     longLabel RNA Repeating Elements by RepeatMasker
-    priority 8
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 8
     bigDataUrl bbi/%s.rmsk.RNA.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/repeatMasker/bbi/${asmId}.rmsk.Other.bb ]; then
 rm -f $buildDir/bbi/${asmId}.rmsk.Other.bb
 ln -s ../trackData/repeatMasker/bbi/${asmId}.rmsk.Other.bb $buildDir/bbi/${asmId}.rmsk.Other.bb
 printf "    track repeatMaskerOther
     parent repeatMasker
     shortLabel Other
     longLabel Other Repeating Elements by RepeatMasker
-    priority 9
-    spectrum on
-    maxWindowToDraw 10000000
-    colorByStrand 50,50,150 150,50,50
     type bigBed 6 +
+    priority 9
     bigDataUrl bbi/%s.rmsk.Other.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/simpleRepeat/simpleRepeat.bb ]; then
 rm -f $buildDir/bbi/${asmId}.simpleRepeat.bb
 ln -s ../trackData/simpleRepeat/simpleRepeat.bb $buildDir/bbi/${asmId}.simpleRepeat.bb
 printf "track simpleRepeat
 shortLabel Simple Repeats
 longLabel Simple Tandem Repeats by TRF
 group varRep
 visibility dense
 type bigBed 4 +
 bigDataUrl bbi/%s.simpleRepeat.bb
 html html/%s.simpleRepeat\n\n" "${asmId}" "${asmId}"
 $scriptDir/asmHubSimpleRepeat.pl $asmId $buildDir/html/$asmId.names.tab $buildDir > $buildDir/html/$asmId.simpleRepeat.html
 fi
 
-# may or may not have a searchTrix for ncbiGene, assume none
-searchTrix=""
-# check to see if there is a index for ncbiGene
-if [ -s ${buildDir}/trackData/ncbiGene/$asmId.ncbiGene.ix ]; then
-  searchTrix="
-searchTrix ixIxx/$asmId.ncbiGene.ix"
-fi
-
-export haveNcbiGene="no"
-
-if [ -s ${buildDir}/trackData/ncbiGene/$asmId.ncbiGene.bb ]; then
-rm -f $buildDir/bbi/${asmId}.ncbiGene.bb
-rm -f $buildDir/ixIxx/${asmId}.ncbiGene.ix
-rm -f $buildDir/ixIxx/${asmId}.ncbiGene.ixx
-ln -s ../trackData/ncbiGene/$asmId.ncbiGene.bb $buildDir/bbi/${asmId}.ncbiGene.bb
-ln -s ../trackData/ncbiGene/$asmId.ncbiGene.ix $buildDir/ixIxx/${asmId}.ncbiGene.ix
-ln -s ../trackData/ncbiGene/$asmId.ncbiGene.ixx $buildDir/ixIxx/${asmId}.ncbiGene.ixx
-  printf "track ncbiGene
-longLabel NCBI gene predictions
-shortLabel NCBI Genes
-visibility pack
-color 0,80,150
-altColor 150,80,0
-colorByStrand 0,80,150 150,80,0
-bigDataUrl bbi/%s.ncbiGene.bb
-type bigGenePred
-html html/%s.ncbiGene
-searchIndex name%s
-url https://www.ncbi.nlm.nih.gov/gene/?term=\$\$
-urlLabel Entrez gene
-labelFields geneName,geneName2
-group genes\n\n" "${asmId}" "${asmId}" "${searchTrix}"
-
-  $scriptDir/asmHubNcbiGene.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/$asmId.ncbiGene.html
-
-haveNcbiGene="yes"
-fi
+### assume there is no ncbiRefSeq track
+### when there is, this will eliminate the ncbiGene track
+### and it figures into setting the visibility of the augustus gene track
+export haveNcbiRefSeq="no"
 
 ###################################################################
 # ncbiRefSeq composite track
 if [ -s ${buildDir}/trackData/ncbiRefSeq/$asmId.ncbiRefSeq.bb ]; then
 rm -f $buildDir/bbi/${asmId}.ncbiRefSeq.bb
 rm -f $buildDir/ixIxx/${asmId}.ncbiRefSeq.ix
 rm -f $buildDir/ixIxx/${asmId}.ncbiRefSeq.ixx
 ln -s ../trackData/ncbiRefSeq/$asmId.ncbiRefSeq.bb $buildDir/bbi/${asmId}.ncbiRefSeq.bb
 ln -s ../trackData/ncbiRefSeq/$asmId.ncbiRefSeq.ix $buildDir/ixIxx/${asmId}.ncbiRefSeq.ix
 ln -s ../trackData/ncbiRefSeq/$asmId.ncbiRefSeq.ixx $buildDir/ixIxx/${asmId}.ncbiRefSeq.ixx
 
   export dataVersion="html/ncbiRefSeqVersion.txt"
   if [ -s ${buildDir}/trackData/ncbiRefSeq/$asmId.ncbiRefSeqVersion.txt ]; then
    dataVersion=`cat ${buildDir}/trackData/ncbiRefSeq/$asmId.ncbiRefSeqVersion.txt`
   fi
@@ -528,72 +470,119 @@
         labelFields name,geneName,geneName2
         searchIndex name
         searchTrix ixIxx/%s.ncbiRefSeqSelectCurated.ix
         bigDataUrl bbi/%s.ncbiRefSeqSelectCurated.bb
         baseColorUseCds given
         baseColorDefault genomicCodons\n\n" "${asmId}" "${asmId}"
   fi
 
   if [ -s ${buildDir}/trackData/ncbiRefSeq/$asmId.ncbiRefSeqVersion.txt ]; then
     rm -f $buildDir/html/$asmId.ncbiRefSeqVersion.txt
     ln -s ../trackData/ncbiRefSeq/$asmId.ncbiRefSeqVersion.txt $buildDir/html/
   fi
 
   $scriptDir/asmHubNcbiRefSeq.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/$asmId.refSeqComposite.html
 
+haveNcbiRefSeq="yes"
 fi	# ncbiRefSeq composite track
 
+### assume there is no ncbiGene track
+### it figures into setting the visibility of the augustus gene track
+export haveNcbiGene="no"
+
+###################################################################
+## setup ncbiGene only if ncbiRefSeq is not present
+if [ "${haveNcbiRefSeq}" = "no" ]; then
+
+# may or may not have a searchTrix for ncbiGene, assume none
+searchTrix=""
+# check to see if there is a index for ncbiGene
+if [ -s ${buildDir}/trackData/ncbiGene/$asmId.ncbiGene.ix ]; then
+  searchTrix="
+searchTrix ixIxx/$asmId.ncbiGene.ix"
+fi
+
+
+if [ -s ${buildDir}/trackData/ncbiGene/$asmId.ncbiGene.bb ]; then
+rm -f $buildDir/bbi/${asmId}.ncbiGene.bb
+rm -f $buildDir/ixIxx/${asmId}.ncbiGene.ix
+rm -f $buildDir/ixIxx/${asmId}.ncbiGene.ixx
+ln -s ../trackData/ncbiGene/$asmId.ncbiGene.bb $buildDir/bbi/${asmId}.ncbiGene.bb
+ln -s ../trackData/ncbiGene/$asmId.ncbiGene.ix $buildDir/ixIxx/${asmId}.ncbiGene.ix
+ln -s ../trackData/ncbiGene/$asmId.ncbiGene.ixx $buildDir/ixIxx/${asmId}.ncbiGene.ixx
+  printf "track ncbiGene
+longLabel NCBI gene predictions
+shortLabel NCBI Genes
+visibility pack
+color 0,80,150
+altColor 150,80,0
+colorByStrand 0,80,150 150,80,0
+bigDataUrl bbi/%s.ncbiGene.bb
+type bigGenePred
+html html/%s.ncbiGene
+searchIndex name%s
+url https://www.ncbi.nlm.nih.gov/gene/?term=\$\$
+urlLabel Entrez gene
+labelFields geneName,geneName2
+group genes\n\n" "${asmId}" "${asmId}" "${searchTrix}"
+
+  $scriptDir/asmHubNcbiGene.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/trackData > $buildDir/html/$asmId.ncbiGene.html
+
+haveNcbiGene="yes"
+fi	#	if [ -s ${buildDir}/trackData/ncbiGene/$asmId.ncbiGene.bb ]
+fi	#	if [ "${haveNcbiRefSeq}" = "no" ]
+###################################################################
+
 ###################################################################
 # CpG Islands composite
 export cpgVis="off"
 # if there is no unmasked track, then set cpgVis to pack
 if [ ! -s ${buildDir}/trackData/cpgIslands/unmasked/${asmId}.cpgIslandExtUnmasked.bb ]; then
   cpgVis="on"
 fi
 if [ -s ${buildDir}/trackData/cpgIslands/unmasked/${asmId}.cpgIslandExtUnmasked.bb -o -s ${buildDir}/trackData/cpgIslands/masked/${asmId}.cpgIslandExt.bb ]; then
 rm -f ${buildDir}/bbi/${asmId}.cpgIslandExtUnmasked.bb ${buildDir}/bbi/${asmId}.cpgIslandExt.bb
 
 printf "track cpgIslands
 compositeTrack on
 shortLabel CpG Islands
 longLabel CpG Islands (Islands < 300 Bases are Light Green)
 group regulation
 visibility pack
-type bed 3 .
-noInherit on
+type bigBed 4 +
 html html/%s.cpgIslands\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/cpgIslands/masked/${asmId}.cpgIslandExt.bb ]; then
 ln -s ../trackData/cpgIslands/masked/${asmId}.cpgIslandExt.bb ${buildDir}/bbi/${asmId}.cpgIslandExt.bb
 printf "    track cpgIslandExt
     parent cpgIslands %s
     shortLabel CpG Islands
     longLabel CpG Islands (Islands < 300 Bases are Light Green)
-    priority 1
     type bigBed 4 +
+    priority 1
     bigDataUrl bbi/%s.cpgIslandExt.bb\n\n" "${cpgVis}" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/cpgIslands/unmasked/${asmId}.cpgIslandExtUnmasked.bb ]; then
 ln -s ../trackData/cpgIslands/unmasked/${asmId}.cpgIslandExtUnmasked.bb ${buildDir}/bbi/${asmId}.cpgIslandExtUnmasked.bb
 printf "    track cpgIslandExtUnmasked
     parent cpgIslands on
     shortLabel Unmasked CpG
     longLabel CpG Islands on All Sequence (Islands < 300 Bases are Light Green)
-    priority 2
     type bigBed 4 +
+    priority 2
     bigDataUrl bbi/%s.cpgIslandExtUnmasked.bb\n\n" "${asmId}"
 fi
 
 if [ -s ${buildDir}/trackData/cpgIslands/unmasked/${asmId}.cpgIslandExtUnmasked.bb -o -s ${buildDir}/trackData/cpgIslands/masked/${asmId}.cpgIslandExt.bb ]; then
   $scriptDir/asmHubCpG.pl $asmId $buildDir/html/$asmId.names.tab $buildDir/bbi/$asmId > $buildDir/html/$asmId.cpgIslands.html
 fi
 
 ###################################################################
 # windowMasker
 if [ -s ${buildDir}/trackData/windowMasker/${asmId}.windowMasker.bb ]; then
 rm -f ${buildDir}/bbi/${asmId}.windowMasker.bb
 ln -s ../trackData/windowMasker/${asmId}.windowMasker.bb ${buildDir}/bbi/${asmId}.windowMasker.bb
 
 printf "track windowMasker
 shortLabel WM + SDust
@@ -619,31 +608,31 @@
 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
 ln -s ../trackData/augustus/${asmId}.augustus.bb ${buildDir}/bbi/${asmId}.augustus.bb
 
 export augustusVis="dense"
 
-if [ "${haveNcbiGene}" = "no" ]; then
+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
 
 ###################################################################