Skip to main content

NCBI DNA/RNA to protein translation tabled and genetic codes

Project description

Edwards Lab DOI License: MIT GitHub language count PyPi

Genetic Codes

A pure Python library with no imports for working with the NCBI Genetic Codes

The NCBI Genetic Codes are central to working with alternate genetic codes. This Python tool kit includes a library that exposes the genetic codes so you can query a codon and get its variants or query a code and get its table.

Installation

You can install pygenetic_code with pip.

pip install pygenetic_code
pygenetic_code --version

Conda installation is coming.

Usage

Standalone

You can just print translation tables using the pygenetic_code command. There are currently a couple of options:

  • json prints the table in machine readable json format.
  • difference prints a .tsv file with the the difference from the standard (translation table 1) code
  • maxdifference prints a .tsv file with the difference from the most common amino acid. The main difference is that TGA is more frequently tryptophan than a stop.

Library

In your python application you want to access the translate() function, that has this signature:

amino_acid = translate(codon, translation_table=1, one_letter=False)

The codon is the codon that you want to translate as either an RNA (e.g. AUG) or DNA (e.g. ATG) sequence. The translation_table is your required translation table (see the NCBI website for valid tables), and one_letter is whether to return a three letter amino acid code (e.g. Met or Ter) or a one letter amino acid code (e.g. M or *).

The library provides other ways to access the genetic codes, and those are exemplified in the pytest files in tests/

Citing

Please cite this repository as:

Edwards, Robert A. 2023. pygenetic_code. https://github.com/linsalrob/genetic_codes

A full DOI citation is coming soon.

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

pygenetic_code-0.13.tar.gz (13.4 kB view hashes)

Uploaded Source

Built Distribution

pygenetic_code-0.13-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

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