Package: gnomonicus
gnomonicusPython code to integrate results of tb-pipeline and provide an antibiogram, mutations and variationsProvides a library of functions for use within scripts, as well as a CLI tool for linking the functions together to produce outputDocumentationAPI reference for developers, and CLI instructions can be found here:https://oxfordmmm.github.io/gnomonicus/Usageusage: gnomonicus [-h] --vcf_file VCF_FILE --genome_object GENOME_OBJECT [--catalogue_file CATALOGUE_FILE] [--ignore_vcf_filter] [--progress] [--output_dir OUTPUT_DIR] [--json] [--fasta FASTA] [--minor_populations MINOR_POPULATIONS]

options:
  -h, --help            show this help message and exit
  --vcf_file VCF_FILE   the path to a single VCF file
  --genome_object GENOME_OBJECT
                        the path to a compressed gumpy Genome object or a genbank file
  --catalogue_file CATALOGUE_FILE
                        the path to the resistance catalogue
  --ignore_vcf_filter   whether to ignore the FILTER field in the vcf (e.g. necessary for some versions of Clockwork VCFs)
  --progress            whether to show progress using tqdm
  --output_dir OUTPUT_DIR
                        Directory to save output files to. Defaults to wherever the script is run from.
  --json                Flag to create a single JSON output as well as the CSVs
  --fasta FASTA         Use to output a FASTA file of the resultant genome. Specify either 'fixed' or 'variable' for fixed length and variable length FASTA respectively.
  --minor_populations MINOR_POPULATIONS
                        Path to a line separated file containing genome indices of minor populations.Helper usageAs the main script can utilise pickledgumpy.Genomeobjects, there is a supplied helper script. This converts a Genbank file into a pickled gumpy.Genome for significant time saving.
Due to the security implications of the pickle module,DO NOT SEND/RECEIVE PICKLES. This script should be used on a host VM before running nextflow to avoid reinstanciation.
Supports gzip compression to reduce file size significantly (using the--compressflag).usage: gbkToPkl FILENAME [--compress]InstallSimple install using pip for the latest releasepip install gnomonicusInstall from sourcegit clone https://github.com/oxfordmmm/gnomonicus.git
cd gnomonicus
pip install -e .DockerA Docker image should be built on releases. To open a shell with gnomonicus installed:docker run -it oxfordmmm/gnomonicus:latestUpdatingIf agnomonicusupdate changes the version ofgumpyused, anOutdatedGumpyExceptionwill be thrown if using a pickledGenomeobject which was instantiated with the old version. This can be fixed by simply re-instantiating theGenomeobject by passing a genbank file once.NotesWhen generating mutations, in cases of synonymous amino acid mutation, the nucelotides changed are also included. This can lead to a mix of nucleotides and amino acids for coding genes, but these are excluded from generating effects unless specified in the catalogue. This means that the default rule ofgene@*= --> Sis still in place regardless of the introducedgene@*?which would otherwise take precedence. For example:'MUTATIONS': [
      {
          'MUTATION': 'F2F',
          'GENE': 'S',
          'GENE_POSITION': 2
      },
      {
          'MUTATION': 't6c',
          'GENE': 'S',
          'GENE_POSITION': 6
      },
  ],
  'EFFECTS': {
      'AAA': [
          {
              'GENE': 'S',
              'MUTATION': 'F2F',
              'PREDICTION': 'S'
          },
          {
              'PHENOTYPE': 'S'
          }
      ],The nucelotide variation is included in the theMUTATIONS, but explictly removed from theEFFECTSunless it is specified within the catalogue.
In order for this variation to be included, a line in the catalogue ofS@F2F&S@t6cwould have to be present.User storiesAs a bioinformatician, I want to be able to rungnomonicuson the command line, passing it (i) a GenBank file (or pickledgumpy.Genomeobject), (ii) a resistance catalogue and (iii) a VCF file, and get backpandas.DataFramesof the genetic variants, mutations, effects and predictions/antibiogram. The latter is for all the drugs described in the passed resistance catalogue.As a GPAS developer, I want to be able to embedgnomonicusin a Docker image/NextFlow pipeline that consumes the outputs oftb-pipelineand emits a structured, well-designedJSONobject describing the genetic variants, mutations, effects and predictions/antibiogram.In general, I would also like the option to output fixed- and variable-length FASTA files (the latter takes into account insertions and deletions described in any input VCF file).Unit testingFor speed, rather than use NC_000962.3 (i.e. H37RvM. tuberculosis), we shall use SARS-CoV-2 and have created a fictious drug resistance catalogue, along with somevcffiles and the expected outputs intests/.These can be run withpytest -vv