changeo.Commandline

Commandline interface

class changeo.Commandline.CommonHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)

Bases: argparse.RawDescriptionHelpFormatter, argparse.ArgumentDefaultsHelpFormatter

Custom argparse.HelpFormatter

changeo.Commandline.checkArgs(parser)

Checks that arguments have been provided and prints help if they have not.

Parameters:parser – An argparse.ArgumentParser defining the commandline arguments.
Returns:True if arguments are present. Prints help and exits if not.
Return type:boolean
changeo.Commandline.getCommonArgParser(db_in=True, db_out=True, out_file=True, failed=True, log=True, format=True, multiproc=False, add_help=True)

Defines an ArgumentParser object with common pRESTO arguments

Parameters:
  • db_in (bool) – if True include tab delimited database input arguments.
  • db_out (bool) – if True include explicit output file name argument.
  • out_file (bool) – if True add explicit output file name arguments.
  • failed (bool) – if True include arguments for output of failed results.
  • log (bool) – if True include log arguments.
  • format (bool) – input and output type arguments.
  • multiproc (bool) – if True include multiprocessing arguments.
Returns:

an argument parser.

Return type:

argparse.ArgumentParser

changeo.Commandline.parseCommonArgs(args, in_arg=None, in_types=None, in_list=False)

Checks common arguments from getCommonArgParser and transforms output options to a dictionary

Parameters:
  • args – Argument Namespace defined by ArgumentParser.parse_args.
  • in_arg – String defining a non-standard input file argument to verify; by default ‘db_files’ and ‘seq_files’ are supported in that order.
  • in_types – List of types (file extensions as strings) to allow for files in file_arg; if None do not check type.
  • in_list – if True allow multiple input files with the out_name and log arguments.
Returns:

Dictionary copy of args with output arguments embedded in the dictionary out_args

Return type:

dict