aeee2a123882d51d1aa13a4fe37de3d688a9307a
mspeir
  Wed Mar 25 12:01:23 2015 -0700
Moving showHelp function to section with other functions

diff --git src/utils/qa/qaAutoTrack.sh src/utils/qa/qaAutoTrack.sh
index 44a2331..0630058 100755
--- src/utils/qa/qaAutoTrack.sh
+++ src/utils/qa/qaAutoTrack.sh
@@ -29,30 +29,55 @@
 currDate=$(date +%F)
 output="" # holds output message
 logUrl="http://genecats.cse.ucsc.edu/qa/test-results/qaAutoTrack"
 logDir="/usr/local/apache/htdocs-genecats/qa/test-results/qaAutoTrack"
 currLogFile=""
 prevLogFile=""
 prevLogDate=""
 
 # Variables for issue checking
 issueNote=""
 tooOld=""
 percentDiff=""
 
 ##### Functions #####
 
+# Usage message function
+showHelp() {
+cat << EOF
+Usage: $0 [-hbv] [-d DATABASE] [-t TABLENAME]
+
+	-h		Display this help and exit
+	-d DATABASE	UCSC database name, i.e. hg19 or hg38.
+	-t TABLENAME	Table name, i.e. gwasCatalog.
+	-b		BigBed mode. Used for tracks supported
+			bigBed files, i.e. grcIncidentDb.
+	-v		Verbose mode. Outputs test results to
+			standard out as well as file.
+
+Performs basic QA for auto-pushed tracks, which includes:
+- Checks when data for track was last updated
+- Coverage from featureBits -countGaps
+- Percentage difference in coverage between now and the last time the script was run
+
+Notes:
+	- For OMIM, ISCA, or ClinVar tracks use omim, isca, or clinvar as the table name.
+	- Can only be run once for each database/track pair per day.
+
+EOF
+}
+
 # Output function
 function outputCovDiff () {
 	# four positional arguments. $1 == prevLogFile. $2 == tblCov. $3 == tableName. $4 == tblDate.
 	if [[ $1 != "" ]] # Check for previous log file. True if file exists.
 	then
 		# get info needed for diff
 		rawCount=$(echo $2 | awk '{print $1}')
 		prevCov=$(egrep -A2 "^$3" $1 | grep "^Coverage New" | cut -d" " -f3-) # Grabs coverage from previous log file.
 		rawCountPrev=$(echo $prevCov | awk '{print $1}')
 
 		# Calculate diff between new and old coverage
 		rawCountDiff=$(echo $(expr $rawCount - $rawCountPrev)|tr -d -)
 		rawCountAvg=$(expr $rawCount / 2 + $rawCountPrev / 2)
 		percentDiff=$(awk -v rcd=$rawCountDiff -v rca=$rawCountAvg 'BEGIN{print 100 * rcd / rca}')
 
@@ -69,55 +94,30 @@
 	# Raises an error if it's been too long since last update
 	if [ $(date -d "$1" +%s) -le $(date -d "$2" +%s) ]
 	then
 		issueNote+="$3 has not been updated since $1, see $logUrl/$db.$tableName.$currDate.txt for more details\n"
 	fi
 
 	# Raises error if coverage diff between track versions is too large
 	if [[ "$4" != "" ]] && [[ $(echo $4 >= 10 | bc) -eq 1 ]]
 	then
 		issueNote+="Large coverage diff for $3, see $logUrl/$db.$tableName.$currDate.txt for more details\n"
 	fi
 }
 
 ##### Parse command-line input #####
 
-# Define function for showing usage message
-showHelp() {
-cat << EOF
-Usage: $0 [-hbv] [-d DATABASE] [-t TABLENAME]
-
-	-h		Display this help and exit
-	-d DATABASE	UCSC database name, i.e. hg19 or hg38.
-	-t TABLENAME	Table name, i.e. gwasCatalog.
-	-b		BigBed mode. Used for tracks supported
-			bigBed files, i.e. grcIncidentDb.
-	-v		Verbose mode. Outputs test results to
-			standard out as well as file.
-
-Performs basic QA for auto-pushed tracks, which includes:
-- Checks when data for track was last updated
-- Coverage from featureBits -countGaps
-- Percentage difference in coverage between now and the last time the script was run
-
-Notes:
-	- For OMIM, ISCA, or ClinVar tracks use omim, isca, or clinvar as the table name.
-	- Can only be run once for each database/track pair per day.
-
-EOF
-}
-
 OPTIND=1 # Reset is necessary if getopts was used previously in the script.  It is a good idea to make this local in a function.
 while getopts "hd:t:bv" opt
 do
 	case $opt in
 		h)
 			showHelp
 			exit 0
 			;;
 		d)
 			db=$OPTARG
 			;;
 		t)
 			tableName=$OPTARG
 			;;
 		v)