db09ffb4f2f00a9391334ce3e8b3cbe5fcc98cb5 max Tue Nov 22 03:50:26 2022 -0800 shorten arg for bigGuessDb tool, refs #30316 diff --git src/utils/bigGuessDb/bigGuessDb src/utils/bigGuessDb/bigGuessDb index 731cd83..0edd832 100755 --- src/utils/bigGuessDb/bigGuessDb +++ src/utils/bigGuessDb/bigGuessDb @@ -7,31 +7,31 @@ from collections import defaultdict from os.path import join, isfile, expanduser import os, gzip, subprocess # ==== functions ===== def parseArgs(): " setup logging, parse command line arguments and options. -h shows auto-generated help page " parser = optparse.OptionParser("usage: %prog [options] filename - given a bigBed or "\ "bigWig file, " \ "guess the assembly based on the chrom sizes") parser.add_option("-d", "--debug", dest="debug", action="store_true", \ help="show debug messages") parser.add_option("", "--index", dest="index", action="store_true", \ help="go /hive/data/genomes and build a file ~/.guessAssembly.txt with all chromSizes") - parser.add_option("-b", "--onlyBest", dest="onlyBest", action="store_true", \ + parser.add_option("-b", "--best", dest="best", action="store_true", \ help="only print a single string, the best matching assembly") (options, args) = parser.parse_args() if args==[] and not options.index: parser.print_help() exit(1) if options.debug: logging.basicConfig(level=logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG) else: logging.basicConfig(level=logging.INFO) logging.getLogger().setLevel(logging.INFO) return args, options @@ -144,21 +144,21 @@ # ----------- main -------------- def main(): " entry point to script " args, options = parseArgs() indexFname = expanduser("~/.guessAssembly.txt.gz") if options.index: buildIndex("/hive/data/genomes", indexFname) else: inFname = args[0] fileSizes = bigWigSizes(inFname) sizeIndex = readSizeIndex(indexFname) hits = findBestDb(sizeIndex, fileSizes) - if options.onlyBest: + if options.best: print(hits[0][0]) else: printAllMatches(hits) main()