varona.cli

Module for argument parsing and CLI functionality.

class VaronaArgumentParser[source]

Bases: ArgumentParser

Varona argument parser.

Subclass of argparse.ArgumentParser that essentially allows the required positional arguments to be optional in the presence of the --version flag.

Warning

Due to the way this behavior is implemented, the parse_args() method can only be called once, and calling twice will raise a RuntimeError.

The CLI --help message is shown below:

usage: varona [-h]
    [--log-level {debug,info,warning,error}]
    [--assembly {GRCH37,GRCH38}]
    [--maf {FR,SAMPLES,BCFTOOLS}]
    [--no-vep]
    [--vep-data VEP_DATA]
    input_vcf output_csv

Annotate a VCF file.

positional arguments:
  input_vcf             Path to the input VCF file
  output_csv            Path to the output CSV file

options:
  -h, --help            show this help message and exit
  --log-level {debug,info,warning,error}
                        Set the logging level (default: WARNING)
  --assembly {GRCH37,GRCH38}
                        genome assembly used in Ensembl VEP API (default: GRCh37)
  --maf {FR,SAMPLES,BCFTOOLS}
                        MAF calculation method (default: SAMPLES)
  --no-vep              Skip VEP API querying (no effect if --vep-data is provided)
  --vep-data VEP_DATA   Path to VEP output file (currently unused)
  --version             Show program's version number and exit
parse_args(args=None, namespace=None)[source]

Parse command-line arguments.

If the --version flag is not used, then the positional arguments are added to the parser.

Parameters:
  • args – List of strings to parse. Default is taken from sys.argv.

  • namespace – An object to take the attributes. Default is a new empty namespace.

Returns:

The parsed arguments.