5740a341fc29a4d30268ad488d19a88d6e5401e7
chmalee
  Thu Sep 23 11:15:20 2021 -0700
Prepare LRG otto job for switchover to ottomeister, only update when data has changed, refs #24672

diff --git src/hg/utils/otto/lrg/buildLrg.sh src/hg/utils/otto/lrg/buildLrg.sh
index c0d97d4..24addf0 100755
--- src/hg/utils/otto/lrg/buildLrg.sh
+++ src/hg/utils/otto/lrg/buildLrg.sh
@@ -61,26 +61,33 @@
     printf "Creating lrgBigPsl.bb for %s\n" $db
     bedToBigBed -as=${WORKDIR}/bigPsl+6.as -type=bed12+20 -tab -extraIndex=name \
         lrgExtraTranscripts${db}.bigPsl.bed /hive/data/genomes/${db}/chrom.sizes lrgBigPsl.bb
 
     # The lrg table already exists as a one line table pointing to /gbdb/$db/bbi/lrg.bb, which
     # is in turn a symlink into $WORKDIR/release/$db/lrg.bb. Thus validate now before overwriting:
     oldCount=`bigBedInfo ${WORKDIR}/release/$db/lrg.bb | grep itemCount | cut -d' ' -f2`
     oldPslCount=`bigBedInfo ${WORKDIR}/release/$db/lrgBigPsl.bb | grep itemCount | cut -d' ' -f2`
     newCount=`bigBedInfo lrg.bb | grep itemCount | cut -d' ' -f2`
     newPslCount=`bigBedInfo lrgBigPsl.bb | grep itemCount | cut -d' ' -f2`
     echo LRG rowcounts: old $oldCount new: $newCount
     echo $oldCount $newCount | awk '{if (($2-$1)/$1 > 0.1) {printf "validate on LRG BigBed failed: old count: %d, new count: %d\n", $1,$2; exit 1;}}'
     echo LRG PSL rowcounts: old $oldPslCount new: $newPslCount
     echo $oldPslCount $newPslCount | awk '{if (($2-$1)/$1 > 0.1) {printf "validate on DECIPHER CNV failed: old count: %d, new count: %d\n", $1,$2; exit 1;}}'
 
+    # Lastly check and see if we even changed anything for this release:
+    if [ "$oldCount" = "$newCount" ] && [ "$oldPslCount" = "$newPslCount" ]; then
+        echo "No change since last release, skipping update for assembly $db"
+        cd ${WORKDIR}/${today}
+        continue
+    fi
+
     # now archive this new release:
     archiveDir="/usr/local/apache/htdocs-hgdownload/goldenPath/archive/${db}/lrg/${today}"
     mkdir -p ${archiveDir}
     cp lrg.bb ${archiveDir}
     cp lrgBigPsl.bb ${archiveDir}
     
     cp lrg.bb ${WORKDIR}/release/${db}/
     cp lrgBigPsl.bb ${WORKDIR}/release/${db}/
 
     cd ${WORKDIR}/${today}
 done