7e8c8145c41f37a949183d56736df53d575f7936
mspeir
  Wed Feb 18 11:25:28 2015 -0800
Fixing output for multi-table tracks like isca. Fixing issues with if statement where it would fail if there was more that one prevLogFile

diff --git src/utils/qa/qaAutoTrack.sh src/utils/qa/qaAutoTrack.sh
index d3d107b..94bc284 100755
--- src/utils/qa/qaAutoTrack.sh
+++ src/utils/qa/qaAutoTrack.sh
@@ -130,34 +130,34 @@
 	bigBedMode=$3
 	verboseMode=$4
 	# error if 4th arg isn't verbose
 	if [[ $verboseMode != "verbose" ]]
 	then
 		echo -e "$usage"
 		exit 1
 	fi
 fi
 
 ##### Main Program #####
 
 # set currLogFile
 currLogFile="$logDir"/"$db.$tableName.$currDate.txt"
 
-# look for previous log file
-if [ -e $logDir/$db.$tableName.*.txt ]
-then
+# set info for prevLog
 prevLogDate+=$(ls -Llt --time-style long-iso $logDir|grep -v total|egrep -m 1 -oh "$db\.$tableName\.[0-9]{4}-[0-9]{2}-[0-9]{2}"|sed -e "s/$db\.$tableName\.//g")
+if [ -e $logDir/$db.$tableName.$prevLogDate.txt ]
+then
 	prevLogFile="$logDir"/"$db.$tableName.$prevLogDate.txt"
 fi
 
 # Can't run twice in one day as it messes up the "Coverage Old" output
 if [[ $currDate == $prevLogDate ]]
 then
 	echo -e "Previous log date is the same as today's date, $currDate"
 	exit 1
 fi
 
 # Set tooOld for different tables
 if  [[ $tableName == clinvar ]] || [[ $tableName == grcIndcidentDb ]]
 then 
 	tooOld=$(date -d "$currDate - 1 month" +%F)
 else
@@ -221,33 +221,38 @@
 
 		rm -f $TMPDIR/temp.$tableName.bed
 	fi
 # Tests for non-bigBed tracks
 else
 	# OMIM and ISCA both have a large number of tables
 	if [[ $tableName == "omim" ]] || [[ $tableName == "isca" ]]
 	then
 		for tbl in $(hgsql -h mysqlbeta -Ne "SHOW TABLES LIKE '%$tableName%'" $db) # Grabs list of all omim or isca tables from beta
         	do
 	               	tblDate=$(hgsql -h mysqlbeta -Ne "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA='$db' AND TABLE_NAME='$tbl'")
 			# Only some omim tables have coordinates
                 	if [[ $tbl == "omimGene2" ]] || [[ $tbl == "omimAvSnp" ]] || [[ $tbl == "omimLocation" ]] || [[ $tableName == "isca" ]]
                 	then
                         	tblCov=$(ssh qateam@hgwbeta "featureBits -countGaps $db $tbl 2>&1")
+				# temporary holder so we don't loose original input tableName
+				tableNameTemp=$tableName
+				# set tableName to tbl temporarily so we can use one output function for all tables
 				tableName=$tbl
 				
 				outputCovDiff
+				# reset tableName to original name
+				tableName=$tableNameTemp
 			# Output for tables that don't contain coordinates
 			else
 				output+="$tbl\nLast updated: $tblDate\n\n"
 			fi
 		done
 		# Check for different issues with table
 		# Must be outside of for loop so as to only output one error message for the entire table set	
 		raiseIssue
 	# Tests for all other table based autopushed tracks
 	else
 		tblDate=$(hgsql -h mysqlbeta -Ne "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA='$db' AND TABLE_NAME='$tableName'")
 		tblCov=$(ssh qateam@hgwbeta "featureBits -countGaps $db $tableName 2>&1")
 
 		outputCovDiff