210af3aaa6d9d894afa8ee28875526cc3428e41e hiram Wed Oct 27 10:30:16 2021 -0700 now sending email upon completion refs #28409 diff --git src/hg/utils/automation/pairLastz.sh src/hg/utils/automation/pairLastz.sh index 028e6ca..578f530 100755 --- src/hg/utils/automation/pairLastz.sh +++ src/hg/utils/automation/pairLastz.sh @@ -1,39 +1,43 @@ #!/bin/bash set -beEu -o pipefail +export userName="`whoami`" + if [ $# != 4 ]; then printf "usage: pairLastz.sh <target> <query> <tClade> <qClade> Where target/query is either a UCSC db name, or is an assembly hub identifier, e.g.: GCA_002844635.1_USMARCv1.0.1 And [tq]Clade is one of: primate|mammal|other Will create directory to work in, for example if, UCSC db: /hive/data/target/bed/lastzQuery.yyyy-mm-dd/ Or, in the assembly hub build directory: /hive/data/genomes/asmHubs/allBuild/GCA/002/844/635/GCA_002844635.1_USMARCv1.0/trackData/lastzQuery.yyyy-mm-dd Will set up a DEF file there, and a run.sh script to run all steps and output makeDoc text to document what happened. AND MORE, it will run the swap operation into the corresponding blastz.target.swap directory in the query genome work space. +Email will be sent to: '$userName' upon completion. + e.g.: pairLastz.sh rn7 papAnu4 mammal primate\n" 1>&2 exit 255 fi # asmId - if assembly hub, determine GCx_012345678.9 name # if not, return the asmName (== UCSC database name) function asmId() { export asmName=$1 export id="${asmName}" case $asmName in GC[AF]_*) id=`echo $asmName | cut -d'_' -f1-2` ;; *) ;; @@ -411,34 +415,34 @@ grep -w real rbest.log | sed -e 's/^/ # /;' sed -e 's/^/ #/;' fb.\${targetDb}.chainRBest.\${QueryDb}.txt " > ${buildDir}/run.sh chmod +x ${buildDir}/run.sh ### run the primary alignment printf "running: time (${buildDir}/run.sh) >> ${buildDir}/do.log 2>&1\n" 1>&2 time (${buildDir}/run.sh) >> ${buildDir}/do.log 2>&1 fi ### if [ $primaryDone -eq 0 ]; then #### print out the makeDoc.txt to this point into buildDir/makeDoc.txt -export userName="`whoami`" - printf "############################################################################## -# LASTZ ${tOrgName} ${Target} vs. $qOrgName ${Query} (DONE - $DS - $userName) +# LASTZ ${tOrgName} ${Target} vs. $qOrgName ${Query} +# (DONE - $DS - $userName) + mkdir $buildDir cd $buildDir printf '${defString} ' > DEF time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl ${trackHub} -verbose=2 \`pwd\`/DEF -syntenicNet \\ ${tFullName} ${qFullName} -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \\ -chainMinScore=${minScore} -chainLinearGap=${linearGap}) > do.log 2>&1 grep -w real do.log | sed -e 's/^/ # /;' " > ${buildDir}/makeDoc.txt (grep -w real $buildDir/do.log || true) | sed -e 's/^/ # /;' | head -1 >> ${buildDir}/makeDoc.txt printf "\n sed -e 's/^/ # /;' fb.${tAsmId}.chain${Query}Link.txt\n" >> ${buildDir}/makeDoc.txt @@ -527,15 +531,32 @@ printf "\ time (~/kent/src/hg/utils/automation/doRecipBest.pl ${rBestTrackHub} -load -workhorse=hgwdev -buildDir=\`pwd\` \\ ${tSwapRbestArgs} \\ ${qSwapRbestArgs} \\ ${qAsmId} ${tAsmId}) > rbest.log 2>&1 grep -w real rbest.log | sed -e 's/^/ # /;'\n" >> ${buildDir}/makeDoc.txt (grep -w real ${swapDir}/rbest.log || true) | sed -e 's/^/ # /;' >> ${buildDir}/makeDoc.txt printf "\n sed -e 's/^/ # /;' fb.${qAsmId}.chainRBest.${Target}.txt\n" >> ${buildDir}/makeDoc.txt (sed -e 's/^/ # /;' ${swapDir}/fb.${qAsmId}.chainRBest.${Target}.txt || true) >> ${buildDir}/makeDoc.txt printf "\n##############################################################################\n" >> ${buildDir}/makeDoc.txt ### show completed makeDoc.txt #### cat ${buildDir}/makeDoc.txt + +export toAddress="$userName" +export fromAddress="$userName" +export subject="pair lastz DONE $target $query" +printf "To: $toAddress +From: $fromAddress +Subject: $subject + +################################################################## +" > /tmp/send.txt.$$ +date >> /tmp/send.txt.$$ +printf "##################################################################\n" >> /tmp/send.txt.$$ +cat ${buildDir}/makeDoc.txt >> /tmp/send.txt.$$ + +cat /tmp/send.txt.$$ | /usr/sbin/sendmail -t -oi + +rm -f /tmp/send.txt.$$