dbcb8a1501cd8b059571af24475401d3dc584bfe rhead Thu Mar 8 18:55:04 2012 -0800 Starting qaGbTracks, which will take a database and a list of tables and run applicable QA tests. It is intended to be a fast starting point for Genome Browser project track QA. So far, this is just a copy of qaEncodeTracks2 with some style adjustments. (Redmine #7224) diff --git src/utils/qa/qaGbTracks src/utils/qa/qaGbTracks new file mode 100755 index 0000000..6c46afb --- /dev/null +++ src/utils/qa/qaGbTracks @@ -0,0 +1,82 @@ +#!/usr/bin/env python2.7 +import sys +import os +import re +import argparse +import subprocess + +from ucscgenomics import qa + +def main(): + + """ Run all the checks, print output""" + + parser = argparse.ArgumentParser( + prog='qaEncodeTracks2', + formatter_class=argparse.RawDescriptionHelpFormatter, + description='A series of checks for QA', + epilog= + """Examples: + +qaEncodeTracks2 hg19 tableList +qaEncodeTracks2 hg19 tableList /path/to/trackDb.ra +qaEncodeTracks2 hg19 tableList ~/kent/src/hg/makeDb/trackDb/human/hg19/wgEncodeSydhTfbs.new.ra + + """ + ) + parser.add_argument('database', help='The database, typically hg19 or mm9') + parser.add_argument('tableList', help='The file containing a list of tables') + parser.add_argument('trackDb', nargs='?', default=0, help='The trackDb file to check') + + if len(sys.argv) == 1: + parser.print_help() + return + + args = parser.parse_args(sys.argv[1:]) + + f = open(args.tableList, "r") + lines = f.readlines() + tables = set() + for i in lines: + tables.add(i.rstrip()) + + output = [] + + output.append("Checking tables for existence of description in tableDescription") + (tableDescOutput, noDescription) = qa.checkTableDescriptions(args.database, tables) + output.extend(tableDescOutput) + + output.append("Checking tables for missing indices") + (tableIndexOut, missingIndex) = qa.checkTableIndex(args.database, tables) + output.extend(tableIndexOut) + + output.append("Checking tables for underscores in the name") + (tableNameOut, badTableNames) = qa.checkTableName(tables) + output.extend(tableNameOut) + + output.append("Checking TrackDb.ra file for short and long label length") + if args.trackDb: + (labelOut, badLabels) = qa.checkLabels(args.trackDb) + output.extend(labelOut) + else: + output.append("Skipped, no trackDb file given") + output.append("") + + output.append("Checking tables for coordinate errors") + (coordsOut, badCoords) = qa.checkTableCoords(args.database, tables) + output.extend(coordsOut) + + output.append("Checking tables for positional errors (sort)") + (posOut, badPos) = qa.positionalTblCheck(args.database, tables) + output.extend(posOut) + + output.append("Counting row per chromosomes per table") + (countChromOut, tableCounts) = qa.countPerChrom(args.database, tables) + output.extend(countChromOut) + + for i in output: + print i + + +if __name__ == "__main__": + main()