05eb41c63af8ccd369f76b022d3cf1faab5543c2 braney Thu May 26 16:25:07 2022 -0700 changes to support curated hubs diff --git src/hg/makeDb/trackDb/loadTracks src/hg/makeDb/trackDb/loadTracks index d6c9616..9a48ee6 100755 --- src/hg/makeDb/trackDb/loadTracks +++ src/hg/makeDb/trackDb/loadTracks @@ -1,149 +1,154 @@ #!/bin/bash -e usage='loadTracks [options] trackDb hgFindSpec db0 ... options: -release=release -strict -addVersion -- add cartVersion pseudo-table -raName=trackDb.ra - base name of ra file -grpSql=grp.sql - create a grp table using this sql file -sqlDir=../../lib - directory containg trackDb.sql and hgFindSpec.sql -gbdbList=user@machine - machine with /gbdb on it' UNAME_N=`uname -n` UNAME_N=${UNAME_N/.soe.ucsc.edu/} release='' settings='' local='' strict='' raName='' grpSql='' gbdbList='' sqlDir='../../lib' while [[ $1 == -* ]] ; do case $1 in -release=*) release=$(echo $1 | sed 's/-release=//') ;; -strict) strict=yes;; + -noHtmlCheck) + noHtmlCheck=yes;; -addVersion) addVersion=yes;; -settings) settings="yes";; -raName=*) raName=$(echo $1 | sed 's/-raName=//') ;; -grpSql=*) grpSql=$(echo $1 | sed 's/-grpSql=//') ;; -sqlDir=*) sqlDir=$(echo $1 | sed 's/-sqlDir=//') ;; -gbdbList=*) gbdbList=$(echo $1 | sed 's/-gbdbList=//') ;; *) echo "invalid option: $1" >&2 exit 1 ;; esac shift done if [ $# -lt 3 ] ; then echo "wrong # args: $usage" >&2 exit 1 fi trackDb="$1"; shift hgFindSpec="$1" ; shift dbs="$@" # check if a database exists, print note and return non-zero if it doesn't dbExists() { local db="$1" local dbChk=$(hgsql -Ne 'show databases like "'$db'"') if [ -z "$dbChk" ] ; then echo "Note: database $db does not exist, skipping" return 1 else return 0 fi } # load trackDb for a database loadDbTracks() { local db="$1" local dbpath=$(ls -1 -d */$db) local org=$(echo $dbpath | sed -e 's/\/.*//') local topts='' fopts='' qopts='-check' if [ -f $dbpath/visibility.ra ] ; then topts="$topts -visibility=$dbpath/visibility.ra" elif [ -f $org/visibility.ra ] ; then topts="$topts -visibility=$org/visibility.ra" fi if [ -f $dbpath/priority.ra ] ; then topts="$topts -priority=$dbpath/priority.ra" elif [ -f $org/priority.ra ] ; then topts="$topts -priority=$org/priority.ra" fi if [ -n "$release" ] ; then topts="$topts -release=$release" fopts="$fopts -release=$release" qopts="$qopts -release=$release" fi + if [ -n "$noHtmlCheck" ] ; then + topts="$topts -noHtmlCheck" + fi if [ -n "$addVersion" ] ; then topts="$topts -addVersion" fi if [ -n "$strict" ] ; then topts="$topts -strict" fopts="$fopts -strict" qopts="$qopts -strict" fi if [ -n "$settings" ] ; then topts="$topts -settings" fi if [ -n "$raName" ] ; then topts="$topts -raName=$raName" fopts="$fopts -raName=$raName" fi if [ -n "$gbdbList" ] ; then topts="$topts -gbdbList=$gbdbList" fi # don't use set -x, since the autoload scripts e-mail stderr. local cmd="hgTrackDb $topts $org $db $trackDb ${sqlDir}/trackDb.sql ." echo $cmd eval $cmd cmd="tdbQuery $qopts 'select count(*) from $db' -root=`pwd`" echo $cmd eval $cmd cmd="hgFindSpec $fopts $org $db $hgFindSpec ${sqlDir}/hgFindSpec.sql ." echo $cmd eval $cmd if [ -z "$strict" -a -f $dbpath/description.html ] ; then if [ "X${UNAME_N}Y" = "XhgwdevY" ]; then if [ ! -L /gbdb/$db/html -a -d /hive/data/genomes/$db/html ]; then rm -f /gbdb/$db/html/description.html rmdir /gbdb/$db/html ln -s /hive/data/genomes/$db/html /gbdb/$db/html fi if [ -f /gbdb/$db/html/description.html ]; then rm -f /gbdb/$db/html/description.html fi fi if [ $dbpath/description.html -nt /gbdb/$db/html/description.html ]; then rm -f /gbdb/$db/html/description.html cp -p $dbpath/description.html /gbdb/$db/html/description.html fi fi if [ -n "$grpSql" ] ; then cmd="hgsql $db < $grpSql" echo $cmd eval $cmd fi } # load for all specified databases for db in $dbs ; do if dbExists $db ; then loadDbTracks $db fi done