src/utils/qa/getSplit.csh 1.10

1.10 2009/05/12 23:48:03 kuhn
simplified and dropped some variables. caught error state where table does not exist either split or unsplit
Index: src/utils/qa/getSplit.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/getSplit.csh,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -B -U 4 -r1.9 -r1.10
--- src/utils/qa/getSplit.csh	11 May 2009 23:59:13 -0000	1.9
+++ src/utils/qa/getSplit.csh	12 May 2009 23:48:03 -0000	1.10
@@ -66,32 +66,32 @@
 # get all assemblies containing $tablename
 
 set chrom=""
 set split=""
-set isChromInfo=0
 
 # check for chromInfo table
-set isChromInfo=`hgsql -N $host -e 'SHOW TABLES' $db | grep "chromInfo" \
-   | wc -l`
-  if ( $status ) then
-    echo "$0 defaults to hgwbeta.  also check spelling of database"
-    echo
-    exit 1
-  endif
-if ( $isChromInfo > 0 ) then
+hgsql -N $host -e 'SHOW TABLES' $db | grep -qw "chromInfo" 
+if ( ! $status ) then
   set chrom=`hgsql -N $host -e 'SELECT chrom FROM chromInfo LIMIT 1' $db`
-
   # check if split table
-  set split=`hgsql -N $host -e 'SHOW TABLES LIKE "'${chrom}_$tablename'"' \
-    $db | wc -l`
-  if ( $split == 1 ) then
+  hgsql -N $host -e 'SHOW TABLES' $db | grep -qw $tablename 
+  if ( ! $status ) then
+    echo "unsplit"
+  else
+    hgsql -N $host -e 'SHOW TABLES' $db | grep -qw ${chrom}_$tablename 
+    if ( ! $status ) then
     echo "$chrom"
   else 
-    echo "unsplit"
+      echo
+      echo " no such table $tablename or ${chrom}_$tablename."
+      echo
+      exit 1
+    endif
   endif
   exit 0
 else
-  echo "no chromInfo table.  split irrelevant"
+  echo
+  echo "no chromInfo table for $db on ${machine}."
+  echo
   exit 1
 endif
-echo