36a49772a10673662471b7b1edc2e1744006a466 mspeir Wed Feb 15 09:48:59 2017 -0800 Tweaking usage message to mention runBits.csh. Adding main function to qaGbTracks. no redmine diff --git src/utils/qa/qaGbTracks src/utils/qa/qaGbTracks index e55b2bf..83869c1 100755 --- src/utils/qa/qaGbTracks +++ src/utils/qa/qaGbTracks @@ -12,31 +12,32 @@ 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 The following statistics are recorded: - featureBits + featureBits (via runBits.csh) + Overlap with gaps (including unbridged via runBits.csh) item count per chromosome stats creates 2 files: outFile.summary, outFile.log """) parser.add_argument('db', help='the database to check') parser.add_argument('-f', dest='tableFile', nargs=1, type=argparse.FileType('r'), help='a file listing tables to check (separated by spaces or newlines)') parser.add_argument('table', help ='the name of a table to check', nargs='*') parser.add_argument('outFile', help='base name to give results files') args = parser.parse_args() if args.tableFile: # add any additional tables in the table file to the table list args.table.extend((args.tableFile[0].read()).split()) args.tableFile[0].close() return args @@ -64,32 +65,37 @@ reporter.writeTimestamp() reporter.writeBlankLine() for table in tableList: reporter.writeLine(delimiterLine) reporter.writeLine(db + "." + table +":\n") table = factory.tableQaFactory(db, table, reporter, sumTable) table.validate() reporter.writeBlankLine() table.statistics() reporter.writeLine("Tests complete:") reporter.writeTimestamp() def writeSummaryFile(sumTable, sumFile): sumFile.write(sumTable.tabSeparated()) +def main(): + """Main function of qaGbTracks. Runs all of the other functions of the program.""" args = parseCommandLine() tableList = args.table db = args.db outFile = args.outFile checkTablesReceived(tableList, outFile) checkTablesExist(db, tableList) logFile = open(outFile + ".log", "w") sumFile = open(outFile + ".summary", "w") -reporter = reporter.Reporter(logFile) + myReporter = reporter.Reporter(logFile) sumTable = summary.SumTable() -runTests(db, tableList, reporter, sumTable) + runTests(db, tableList, myReporter, sumTable) writeSummaryFile(sumTable, sumFile) logFile.close() sumFile.close() + +if __name__ == "__main__": + main()