config module

class mavis.config.CustomHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: argparse.ArgumentDefaultsHelpFormatter

subclass the default help formatter to stop default printing for required arguments

add_arguments(actions)[source]
class mavis.config.LibraryConfig(library, protocol, disease_status, bam_file=None, inputs=None, read_length=None, median_fragment_size=None, stdev_fragment_size=None, strand_specific=False, strand_determining_read=2, **kwargs)[source]

Bases: mavis.constants.MavisNamespace

holds library specific configuration information

static build(library, protocol, bam_file, inputs, annotations=None, log=<mavis.util.Log object>, distribution_fraction=0.98, sample_cap=3000, sample_bin_size=1000, sample_size=500, **kwargs)[source]

Builds a library config section and gathers the bam stats

flatten()[source]
is_trans()[source]
classmethod parse_args(*args)[source]
class mavis.config.MavisConfig(**kwargs)[source]

Bases: mavis.constants.MavisNamespace

has_transcriptome()[source]
static read(filepath)[source]

reads the configuration settings from the configuration file

Parameters:filepath (str) – path to the input configuration file
Returns:list of Namespace: namespace arguments for each library
Return type:class
class mavis.config.RangeAppendAction(nmin=1, nmax=None, **kwargs)[source]

Bases: argparse.Action

allows an argument to accept a range of arguments

mavis.config.augment_parser(arguments, parser, required=None)[source]

Adds options to the argument parser. Separate function to facilitate the pipeline steps all having a similar look/feel

mavis.config.generate_config(args, parser, log=<mavis.util.Log object>)[source]
Parameters:
  • parser (argparse.ArgumentParser) – the main parser
  • required – the argparse required arguments group
  • optional – the argparse optional arguments group
mavis.config.get_metavar(arg_type)[source]

For a given argument type, returns the string to be used for the metavar argument in add_argument

Example

>>> get_metavar(bool)
'{True,False}'
mavis.config.nameable_string(input_string)[source]

A string that can be used for library and/or filenames

mavis.config.validate_section(section, namespace, use_defaults=False)[source]

given a dictionary of values, returns a new dict with the values casted to their appropriate type or set to a default if the value was not given

mavis.config.write_config(filename, include_defaults=False, libraries=[], conversions={}, log=<mavis.util.Log object>)[source]
Parameters:
  • filename (str) – path to the output file
  • include_defaults (bool) – True if default parameters should be written to the config, False otherwise
  • libraries (list of LibraryConfig) – library configuration sections
  • conversions (dict of list by str) – conversion commands by alias name
  • log (function) – function to pass output logging to