presto.Commandline

Commandline interface functions

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

Bases: RawDescriptionHelpFormatter, ArgumentDefaultsHelpFormatter

Custom argparse.HelpFormatter

presto.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

presto.Commandline.getCommonArgParser(seq_in=True, seq_out=True, seq_paired=False, db_in=False, db_out=False, out_file=True, failed=True, log=True, annotation=True, multiproc=False, add_help=True)

Defines an ArgumentParser object with common pRESTO arguments

Parameters:
  • seq_in (bool) – if True include sequence input arguments.

  • seq_out (bool) – if True include sequence output arguments.

  • seq_paired (bool) – if True defined paired-end sequence input and output arguments.

  • db_in (bool) – if True include tab-delimited database input arguments.

  • db_out (bool) – if True include tab-delimited database output arguments.

  • 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.

  • annotation (bool) – If True include annotation arguments.

  • multiproc (bool) – If True include multiprocessing arguments.

  • add_help (bool) – If True add help and version arguments.

Returns:

ArgumentParser object.

Return type:

argparse.ArgumentParser

presto.Commandline.parseCommonArgs(args, in_arg=None, in_types=None)

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’, ‘seq_files’, ‘seq_files_1’, ‘seq_files_2’, ‘primer_file’] 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

Returns:

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

Return type:

dict