a4e263425c04b3bd42229088d27b3fb5936d8ae8
rhead
  Mon May 7 19:46:03 2012 -0700
Changed and reordered help comment wording a little and added option to use the name of a single table at the command line rather than supply a list of tables.
diff --git src/utils/qa/qaGbTracks src/utils/qa/qaGbTracks
index 0215ca8..571eed2 100755
--- src/utils/qa/qaGbTracks
+++ src/utils/qa/qaGbTracks
@@ -3,49 +3,54 @@
 import argparse
 import time
 
 from ucscgenomics.qa import qaUtils
 from ucscgenomics.qa.tables import factory
 from ucscgenomics.qa.tables import reporter
 from ucscgenomics.qa.tables import summary
 from ucscgenomics.qa.encode import tableCheck
 
 def parseCommandLine():
     parser = argparse.ArgumentParser(
         formatter_class=argparse.RawDescriptionHelpFormatter,
         description='Validates tables and records table statistics',
         epilog="""
 The following tests are run:
+  checks for underscores in table names
+  checks for the existence of table descriptions
+  checks shortLabel and longLabel length
   positionalTblCheck
   checkTblCoords
   genePredCheck
   pslCheck
-  checks for the existence of table descriptions
-  (checks for shortLabels and longLabels that are too long)
-  checks for underscores in table names
   featureBits
-  (joinerCheck) - not yet implemented
-  countPerChrom
+  (a version of) countPerChrom
 
   creates 3 files:  outFile.summary, outFile.log, outFile.chrom
         """)
     parser.add_argument('db', help='the database to check')
-    parser.add_argument('tableList', help='a file listing the tables to check')
-    parser.add_argument('outFile', help='base name for results files')
+    parser.add_argument('-s, --single', help ='tableList is the name of a single table',
+                        action="store_true", dest="single")
+    parser.add_argument('tableList', help=
+                        'a file listing the tables to check, or the name of a single table')
+    parser.add_argument('outFile', help='base name to give results files')
     return parser.parse_args()
 
-def getTableListFromFile():
+def getTableList():
+    if args.single:
+        return [args.tableList]
+    else:
     with open(args.tableList, "r") as f:
         raw = f.readlines()
     return [name.strip() for name in raw]
 
 delimiterLine = "==============================================="
 def runTests():
     """Runs validate() and statistics() methods on each table. Writes log output."""
     reporter.writeTimestamp()
     reporter.writeBlankLine()
     for table in tableList:
         reporter.writeLine(delimiterLine)
         reporter.writeLine(args.db + "." + table +":\n")
         table = factory.tableQaFactory(args.db, table, reporter, sumTable)
         table.validate()
         table.statistics()
@@ -53,31 +58,31 @@
     reporter.writeLine("Tests complete:")
     reporter.writeTimestamp()
 
 def writeSummaryFile():
     sumFile.write(sumTable.tabSeparated())
 
 def runChromCounts():
     chromFile.write(time.asctime() + "\n")
     chromFile.write("Database: " + args.db + "\n\n")
     tableSet = set(tableList)
     output, tablecounts = tableCheck.countPerChrom(args.db, tableSet)
     for line in output:
         chromFile.write(line + "\n")
 
 args = parseCommandLine()
-tableList = getTableListFromFile()
+tableList = getTableList()
 qaUtils.checkTablesExist(args.db, tableList)
 
 logFile = open(args.outFile + ".log", "w")
 chromFile = open(args.outFile + ".chroms", "w")
 sumFile = open(args.outFile + ".summary", "w")
 reporter = reporter.Reporter(logFile)
 sumTable = summary.SumTable()
 
 runTests()
 runChromCounts()
 writeSummaryFile()
 
 logFile.close()
 sumFile.close()
 chromFile.close()