def parse_args(args):
"""
Takes in the command-line arguments list (args), and returns a nice argparse
result with fields for all the options.
Borrows heavily from the argparse documentation examples:
<http://docs.python.org/library/argparse.html>
"""
# Construct the parser (which is stored in parser)
# Module docstring lives in __doc__
# See http://python-forum.com/pythonforum/viewtopic.php?f=3&t=36847
# And a formatter class so our examples in the docstring look good. Isn't it
# convenient how we already wrapped it to 80 characters?
# See http://docs.python.org/library/argparse.html#formatter-class
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("ref_name",
help="name of BWA-indexed reference FASTA")
parser.add_argument("query_name",
help="name of query FASTA")
parser.add_argument("--chunk_size", type=int, default=10000,
help="size of chunks to align")
parser.add_argument("--chunk_stride", type=int, default=100000,
help="distabnce between chunks to align")
parser.add_argument("--max_children", type=int, default=10,
help="number of bwa children to run")
parser.add_argument("--batch_size", type=int, default=1000,
help="number of chunks to align at once")
parser.add_argument("--match_threshold", type=float, default=0.95,
help="min score for a hit as a fraction of possible score")
parser.add_argument("--out_file", type=argparse.FileType("w"),
default=sys.stdout,
help="TSV file of contig pairings to write")
parser.add_argument("--debug", action="store_true",
help="add extra debugging comments to output TSV")
# The command line arguments start with the program name, which we don't
# want to treat as an argument for argparse. So we remove it.
args = args[1:]
return parser.parse_args(args)
评论列表
文章目录