def main(): parser = argparse.ArgumentParser( formatter_class=sysutils.ArgumentDefaultsHelpFormatterSkipNone, ) sub = parser.add_subparsers( help='''Annotate consensus sequence(s). An assembled consensus sequence can be amino acid aligned to a reference (i.e. HXB2) so the same coordinate system can be used. Sequences can then be extracted based on the shared coordinate systems. ''') pairwise_align.stageparser(sub.add_parser('pairwise_align')) extract_pairwise.stageparser(sub.add_parser('extract_pairwise')) post_assembly.stageparser(sub.add_parser('post_assembly')) annotate_from_ref.stageparser(sub.add_parser('annotate_from_ref')) args = parser.parse_args() args.func(**sysutils.args_params(args))
def console(): parser = argparse.ArgumentParser(formatter_class=HF, add_help=False) parser.add_argument('-h', '--help', action=_BaseHelpAction) # Exit with help if no args were given if len(sys.argv) == 1: parser.parse_args(['-h']) # Subparsers sub = parser.add_subparsers() # Reads stages sample_reads.stageparser(sub.add_parser('sample_reads', formatter_class=HF)) trim_reads.stageparser(sub.add_parser('trim_reads', formatter_class=HF)) join_reads.stageparser(sub.add_parser('join_reads', formatter_class=HF)) ec_reads.stageparser(sub.add_parser('ec_reads', formatter_class=HF)) # Assemble stages assemble_denovo.stageparser( sub.add_parser('assemble_denovo', formatter_class=HF)) assemble_amplicons.stageparser( sub.add_parser('assemble_amplicons', formatter_class=HF)) assemble_scaffold.stageparser( sub.add_parser('assemble_scaffold', formatter_class=HF)) align_reads.stageparser(sub.add_parser('align_reads', formatter_class=HF)) call_variants.stageparser( sub.add_parser('call_variants', formatter_class=HF)) vcf_to_consensus.stageparser( sub.add_parser('vcf_to_consensus', formatter_class=HF)) refine_assembly.stageparser( sub.add_parser('refine_assembly', formatter_class=HF)) finalize_assembly.stageparser( sub.add_parser('finalize_assembly', formatter_class=HF)) # Haplotype predict_haplo.stageparser( sub.add_parser('predict_haplo', formatter_class=HF)) ph_parser.stageparser(sub.add_parser('ph_parser', formatter_class=HF)) cliquesnv.stageparser(sub.add_parser('cliquesnv', formatter_class=HF)) # Annotate/Description stages pairwise_align.stageparser( sub.add_parser('pairwise_align', formatter_class=HF)) extract_pairwise.stageparser( sub.add_parser('extract_pairwise', formatter_class=HF)) annotate_from_ref.stageparser( sub.add_parser('annotate_from_ref', formatter_class=HF)) summary_stats.stageparser( sub.add_parser('summary_stats', formatter_class=HF)) # post_assembly.stageparser( # sub.add_parser('post_assembly', formatter_class=HF) # ) # Phylo multiple_align.stageparser( sub.add_parser('multiple_align', formatter_class=HF)) model_test.stageparser(sub.add_parser('model_test', formatter_class=HF)) build_tree_NG.stageparser( sub.add_parser('build_tree_NG', formatter_class=HF)) # Miscellaneous demo.stageparser(sub.add_parser('demo', formatter_class=HF)) args = parser.parse_args() try: args.func(**sysutils.args_params(args)) except MissingRequiredArgument as e: sub._name_parser_map[sys.argv[1]].print_usage() print('error: %s' % e, file=sys.stderr)