65a21f5c7cdda8de27c2054ddffdd391284c3aa1 hiram Mon Jun 1 09:03:06 2026 -0700 switching entirely to genome-centdb hgcentral refs #31811 diff --git src/hg/utils/otto/userRequests/ottoRequestAlign.sh src/hg/utils/otto/userRequests/ottoRequestAlign.sh index 7501624ad8d..89085a7f0e4 100755 --- src/hg/utils/otto/userRequests/ottoRequestAlign.sh +++ src/hg/utils/otto/userRequests/ottoRequestAlign.sh @@ -1,70 +1,72 @@ #!/bin/bash # ottoRequestAlign.sh - look up an ottoRequest row by id and construct # the kegAlignLastz.sh command line from genark metadata # # usage: ottoRequestAlign.sh <id> # -# Queries hgcentraltest.ottoRequest for fromDb/toDb, then looks up -# each accession in hgcentraltest.genark for asmName and clade. +# Queries ${centDb}.ottoRequest for fromDb/toDb, then looks up +# each accession in ${centDb}.genark for asmName and clade. # Prints and executes the resulting kegAlignLastz.sh command. set -eEu -o pipefail +export centDb="hgcentral" +export hgSql="hgsql -hgenome-centdb" ############################################################################ ### verify arguments ############################################################################ if [ $# != 1 ]; then printf "usage: ottoRequestAlign.sh <id>\n" 1>&2 - printf " where <id> is a row id from hgcentraltest.ottoRequest\n" 1>&2 + printf " where <id> is a row id from ${centDb}.ottoRequest\n" 1>&2 exit 255 fi export requestId="$1" export scriptDir=$(cd "$(dirname "$0")" && pwd) # validate id is a positive integer case "${requestId}" in ''|*[!0-9]*) printf "ERROR: id must be a positive integer, got: '%s'\n" "${requestId}" 1>&2 exit 255 ;; esac ############################################################################ ### function definitions ############################################################################ ### errors - set error status in the table function setErrorStatus() { id="${1}" - /cluster/bin/x86_64/hgsql -N -e \ - "UPDATE ottoRequest SET status=7 WHERE id=${id};" hgcentraltest + /cluster/bin/x86_64/${hgSql} -N -e \ + "UPDATE ottoRequest SET status=7 WHERE id=${id};" "${centDb}" } ############################################################################ # genarkLookup - query genark table for accession, asmName, clade # arg: gcAccession (e.g. GCF_000002285.3) # sets: _acc, _asmName, _clade ############################################################################ function genarkLookup() { local acc=$1 - local result=$(/cluster/bin/x86_64/hgsql -N -e \ + local result=$(/cluster/bin/x86_64/${hgSql} -N -e \ "SELECT gcAccession,asmName,clade from genark WHERE gcAccession='${acc}';" \ - hgcentraltest) + ${centDb}) if [ -z "${result}" ]; then - printf "ERROR: accession '%s' not found in hgcentraltest.genark\n" "${acc}" 1>&2 + printf "ERROR: accession '%s' not found in ${centDb}.genark\n" "${acc}" 1>&2 setErrorStatus ${requestId} return 1 fi _acc=$(printf "%s" "${result}" | cut -f1) _asmName=$(printf "%s" "${result}" | cut -f2) _clade=$(printf "%s" "${result}" | cut -f3) } ############################################################################ # dbDbCladeLookup - look up clade for a UCSC database name # from dbDb.name.clade.tsv (in same directory as this script) # arg: dbName (e.g. hg38, rn7) # sets: _clade ############################################################################ function dbDbCladeLookup() { @@ -123,36 +125,36 @@ /cluster/bin/x86_64/twoBitInfo "${twoBit}" stdout \ | /cluster/bin/scripts/n50.pl stdin 2>&1 \ | grep -A1 "^[0-9].*one half size" \ | tail -1 \ | awk '{print $NF}' } ############################################################################ ############################################################################ ### main() scripting begins here ############################################################################ ############################################################################ # step 1: look up fromDb and toDb from ottoRequest ############################################################################ -export ottoResult=$(/cluster/bin/x86_64/hgsql -N -e \ - "SELECT fromDb,toDb from ottoRequest WHERE id=${requestId} AND status = 1 AND requestType = 'liftOver';" hgcentraltest) +export ottoResult=$(/cluster/bin/x86_64/${hgSql} -N -e \ + "SELECT fromDb,toDb from ottoRequest WHERE id=${requestId} AND status = 1 AND requestType = 'liftOver';" ${centDb}) if [ -z "${ottoResult}" ]; then printf "ERROR: no ottoRequest row found for id=%s AND status = 1\n" "${requestId}" 1>&2 - /cluster/bin/x86_64/hgsql -e "SELECT fromDb,toDb,status from ottoRequest WHERE id=${requestId};" hgcentraltest 1>&2 + /cluster/bin/x86_64/${hgSql} -e "SELECT fromDb,toDb,status from ottoRequest WHERE id=${requestId};" "${centDb}" 1>&2 exit 255 fi export fromDb=$(printf "%s" "${ottoResult}" | cut -f1) export toDb=$(printf "%s" "${ottoResult}" | cut -f2) if [ -z "${fromDb}" -o -z "${toDb}" ]; then printf "ERROR: empty fromDb or toDb for ottoRequest id=%s\n" "${requestId}" 1>&2 printf " got: fromDb='%s' toDb='%s'\n" "${fromDb}" "${toDb}" 1>&2 setErrorStatus ${requestId} exit 255 fi # printf "# ottoRequest id=%s: fromDb='%s' toDb='%s'\n" \ # "${requestId}" "${fromDb}" "${toDb}" 1>&2 @@ -251,31 +253,31 @@ ;; esac # reuse existing build directory if one is already in progress working=$(ls -d ${targetExists}/lastz${Query}.* 2> /dev/null | wc -l || true) if [ "${working}" -gt 0 ]; then buildDir=$(ls -d ${targetExists}/lastz${Query}.* | tail -1) # printf "# existing buildDir: %s\n" "${buildDir}" 1>&2 fi mkdir -p "${buildDir}" # printf "# buildDir: %s\n" "${buildDir}" 1>&2 # store buildDir in ottoRequest table for workflowMonitor.sh -/cluster/bin/x86_64/hgsql -N -e \ +/cluster/bin/x86_64/${hgSql} -N -e \ "UPDATE ottoRequest SET buildDir='${buildDir}', status=2 WHERE id=${requestId};" \ - hgcentraltest + "${centDb}" ############################################################################ # step 5: map clades and build the kegAlignLastz.sh command ############################################################################ export fromCladeArg=$(cladeMap "${fromClade}") export toCladeArg=$(cladeMap "${toClade}") export cmd="${scriptDir}/kegAlignLastz.sh ${fromId} ${toId} ${fromCladeArg} ${toCladeArg}" # printf "# launching: %s\n" "${cmd}" 1>&2 nohup ${cmd} > "${buildDir}/kegAlign.log" 2>&1 < /dev/null & # printf "# launched pid %s, log=%s/kegAlign.log\n" "$!" "${buildDir}" 1>&2 exit 0