Skip to main content

Predicting the effect of an antibiotic from gene mutations

Project description

Tests codecov Docs PyPI version

piezo

Predict the effect of a genetic mutation on the effect of an antibiotic using a supplied AMR catalogue.

This code was developed as part of the CRyPTIC international tuberculosis consortium. If you would like to use the software commercially, please consult the LICENCE file.

Installation

Using pip

This will install the most recent release on PyPI.

pip install piezo

From GitHub

This will install the current version from GitHub and therefore may be ahead of the PyPI version.

git clone https://github.com/oxfordmmm/piezo
cd piezo
pip install .

The pre-requisites are all fairly standard and are listed in setup.cfg so will be automatically installed.

Documentation

API documentation for developers can be found here: https://oxfordmmm.github.io/piezo/

Included files

$ ls tests/test-catalogue/
NC_004148.2.gbk                    NC_004148.2_TEST_GM1_RFUS_v1.0.csv

NC_004148 is the reference genome of the human metapneumovirus and is used primarily for unit testing since it is small and fast to parse.

Design of AMR catalogue

piezo is written so as to be extendable in the future to other ways of describing genetic variation with respect to a reference. It includes the concept of a grammar which specifies how the genetic variation is described.

At present only a single grammar, GARC1 is supported. GARC is short for Grammar for Antimicrobial Resistance Catalogues. This grammar is described in more detail elsewhere, however in brief, it is a gene-centric view (and therefore has no way of describing genetic variation that lies outside a coding region, other than as a 'promoter' mutation). All mutations start with the gene (or locus) name which must match the name of a gene (or locus) in the relevant GenBank file. It is the user's responsibility to ensure this, although e.g. the gumpy package can be used to perform such sanity checks. The mutation is delineated from the gene using a @ symbol and within the mutation _ is used as a field separator to separate the different components. All variation is described as either a SNP or an INDEL. If they occur within a coding region SNPs are specified by their effect on the amino acids which are always in UPPERCASE e.g. rpoB@S450L. If in the assumed promoter region, then the nucleotide change and position is specified e.g. fabG1@c-15t. Nucleotides are always in lowercase. INDELs can be specified at different levels of granularity e.g. rpoB@1250_indel means 'any insertion of deletion at this position', but we could equally be highly specific and say rpoB@1250_ins_cta which means 'an insertion of cta at this position'. There is also the special case of frameshifting mutations which are described by fs.

Wildcards are also supported. Hence rpoB@*? means 'any non-synoymous mutation in the coding region of the protein'. To avoid confusion the stop codon is represented by ! which is non-standard. Het calls are, at present, represented by a Z or z depending on whether they occur in the coding or promoter regions. This may be extended in the future. Likewise null calls are represented by an X or x.

The general principle is each mutation can 'hit' multiple rules in the catalogue, but it is the most specific rule that will be followed. Hence consider a toy example, again from TB

rpoB@*?     RIF   U   any non-synoymous mutation in the coding region has an unknown effect of RIF
rpoB@S450?  RIF   R   any non-synoymous mutation at Ser450 confers resistance
rpoB@S450Z  RIF   F   a het call at Ser450 should be reported as an F (fail).

Example

A demonstration script called piezo-predict.py can be found in the bin/ folder of the repository which following installation should be in your $PATH. A made-up catalogue for testing purposes can be found in tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv which is based on the Human metapneumovirus, however the entries are fictious. It contains two drugs and a series of mutations in the M2 gene.

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@L73L
{'DRUG_B': 'S', 'DRUG_A': 'S'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@L73R
{'DRUG_A': 'R', 'DRUG_B': 'U'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@L73Z
{'DRUG_B': 'S', 'DRUG_A': 'F'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_indel
{'DRUG_B': 'U', 'DRUG_A': 'U'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_ins
{'DRUG_B': 'U', 'DRUG_A': 'U'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_ins_2
{'DRUG_B': 'U', 'DRUG_A': 'U'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_ins_3
{'DRUG_A': 'U', 'DRUG_B': 'R'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_ins_4
{'DRUG_B': 'U', 'DRUG_A': 'U'}

$ piezo-predict.py --catalogue tests/test-catalogue/NC_004148.2_TEST_v1.0_GARC1_RFUS.csv --mutation M2@300_ins_cta
{'DRUG_B': 'R', 'DRUG_A': 'U'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piezo-0.8.1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

piezo-0.8.1-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file piezo-0.8.1.tar.gz.

File metadata

  • Download URL: piezo-0.8.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for piezo-0.8.1.tar.gz
Algorithm Hash digest
SHA256 2d12a8605b0021bfe1bbfcb7ae9071827e1da11bc2ad7025874de049a1d44e9f
MD5 64d31587e5f2cb93004aa1cf5489e748
BLAKE2b-256 fa09ea9e2e22364f9e9c95fc1d715f3c7f853ea317509fd5a8477412f2921634

See more details on using hashes here.

File details

Details for the file piezo-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: piezo-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for piezo-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 451fcfad98d3e192044e66b031146b7b26f45e2b2d0ef38ec437cd8578eebeb1
MD5 f366a4d95a50030481693eb183f179a3
BLAKE2b-256 9d6b96e6986ff5bf89ecf38a70d314fd7a10804a1cefc5790dfd601edf3132c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page