src/utils/qa/findLevel 1.2
1.2 2010/03/05 19:05:27 rhead
Changed dependency on symlink in home directory to dependency on the kent source tree in home directory. Also moved this check closer to the top, as tdbQuery run by default also depends on the tree being in the home dir.
Index: src/utils/qa/findLevel
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/findLevel,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/utils/qa/findLevel 2 Mar 2010 02:08:44 -0000 1.1
+++ src/utils/qa/findLevel 5 Mar 2010 19:05:27 -0000 1.2
@@ -1,111 +1,112 @@
#!/bin/bash
# quit if something within the script fails
set -beEu -o pipefail
source `which qaConfig.bash`
################################
#
# 09-26-2007
# Ann Zweig
#
# findLevel
# find out which level in the trackDb directory
# a track is on, and which level the corresponding
# .html file is on.
#
# 02-25-2010
# Brooke Rhead
# Changed to a bash script to simplify dealing with stderr
# and stdout.
#
################################
db=""
tableName=""
currDir=""
# get arguments or print usage
if [ $# -ne 2 ]
then
echo -e "
searches trackDb hierarchy for your table and corresponding .html file
also returns the value of the priority and visibility entries
and the .ra file location for each\n
usage: database tableName\n" >&2
exit 1
else
db="$1"
tableName="$2"
fi
-# make sure this is a valid database name
-if ! tdbQuery "select db from $db limit 1" | grep -q $db
+# check for kent source dir at $USER root
+if ! [ -d ~/kent/src/hg/makeDb/trackDb/ ]
then
- echo -e "\n ERROR: Invalid database name. Try again.\n" >&2
+ echo -e "\n ERROR: `basename $0` presumes you have the kent source
+ source tree in your home dir, in a dir called \"kent\"\n" >&2
exit 1
fi
-# check for trackDb dir at $USER root
-if ! file ~/trackDb | grep -q 'symbolic link'
+# make sure this is a valid database name
+if ! tdbQuery "select db from $db limit 1" | grep -q $db
then
- echo -e "\n ERROR: `basename $0` presumes you have a symlink
- to trackDb in your home dir\n" >&2
+ echo -e "\n ERROR: Invalid database name. Try again.\n" >&2
exit 1
fi
+
echo
###########################################
# find the level of the associated .html file
# start at the assembly level
-cd ~/trackDb/*/$db
+cd ~/kent/src/hg/makeDb/trackDb/
currDir=""
if [ -e $tableName.html ]
then # the .html file is found at the assembly level
currDir=`pwd -P`
else
cd ..
if [ -e $tableName.html ]
then # the .html file is found at the organism level
currDir=`pwd -P`
else
cd ..
if [ -e $tableName.html ]
then # the .html file is found at the top level
currDir=`pwd -P`
fi
fi
fi
if [ "$currDir" == "" ]
then
echo -e " * the $tableName.html file does not exist at any level\n"
else
echo -e " * html file: $currDir/$tableName.html\n"
fi
###########################################
# find the trackDb.ra entry (using tdbQuery)
echo " * trackDb:"
all=`tdbQuery "select track,priority,visibility,release,filePos from \
$db where track='$tableName'" 2> /dev/null`
strict=`tdbQuery -strict "select track,priority,visibility,release,filePos from \
$db where track='$tableName'" 2> /dev/null`
alpha=`tdbQuery -alpha "select track,priority,visibility,release,filePos from \
$db where track='$tableName'" 2> /dev/null`
# always print "all"; only print strict or alpha if they differ from all
echo -e "$all\n"
if [ "$all" != "$strict" ]
then
echo -e "$strict\n"
fi
if [ "$alpha" != "$all" ] && [ "$alpha" != "$strict" ]
then
echo -e "$alpha\n"
fi
exit 0