codon-degeneracy
This python package provides routines for the extraction of degenerate sites from sequences and alignments. The latter is particularly useful for estimations of rates of neutral evolution.
Dependencies
This code uses biopython and scikit-bio internally. In order to installl via pip, numpy has to be installed.
Installing
Simply clone this repo:
git clone https://github.com/nickmachnik/codon-degeneracy.git [TARGET DIR]
and then install via pip
pip install [TARGET DIR]
or install directly from PyPI (this won't include unreleased changes as specified in the changelog):
pip install codon-degeneracy
Testing
Test the cloned package:
cd [TARGET DIR]
python -m unittest
Usage
There are more useful and well documented functions under the hood than shown here, which I enourage to explore by browsing the code.
Counting substitutions per four fold degenerate site
One of the main features of the package is the counting of neutral substitutions at four fold degenerate sites.
This is best done with known orthologue pairs between species.
substitution_rate_at_ffds provides that functionality and is easy to use like so:
from codon_degeneracy import substitution_rate_at_ffds as nsr
seq_a = (
"ATACCCATGGCCAACCTCCTACTCCTCATTGTACCCATTC"
"TAATCGCAATGGCATTCCTAATGCTTACCGAACGA")
seq_b = (
"ATGACCACAGTAAATCTCCTACTTATAATCATACCCACAT"
"TAGCCGCCATAGCATTTCTCACACTCGTTGAACGA")
(number_of_substitutions, number_of_sites), (orf_a, orf_b) = nsr(
# the input sequences
seq_a,
seq_b,
# NCBI codon table names as used in Bio.Data.CodonTable
"Vertebrate Mitochondrial",
"Vertebrate Mitochondrial")
The ORFs returned are there for sanity checks. The default behaviour is to select the first ATG codon as start.
NOTE: The numbers of neutral substitutions per site reported by this function are merely a lower bound, as they do not include the possibility of multiple substitutions per site.
Substitutions at four fold degenerate sites separated by CpG context
In certain situations, it may be useful to differentiate between four fold degenerate sites
that could potentially exist in a CpG context and could therefore exhibit an elevated
mutation rate and those that do not. substitutions_per_ffds_by_cpg_context provides that
functionality.
It differentiates between four CpG contexts. Sites that are:
- preceded by C and not followed by G (nonCpG)
- preceded by C but not followed by G (postC)
- followed by G but not preceded by C (preG)
- preceded by C and followed by G (postCpreG)
Note: the number of sites considered here may be substantially lower than in
substitutions_per_ffds, as this function requires the sites preceeding and following site of a four fold degenerate site to be identical in the two aligned sequences.
The function can be used in exactly the same that is shown for substitutions_per_ffds above.
License
MIT license (LICENSE or https://opensource.org/licenses/MIT)
Metadata
Release files for codon-degeneracy 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codon-degeneracy-0.1.3.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codon_degeneracy-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / codon-degeneracy-0.1.3.tar.gz
| Download URL | codon-degeneracy-0.1.3.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
603f778319d9e0c0564755f060a933f26d8ba60d723030320af99fbe975d811f
|
|
BLAKE2b-256 checksum How to use checksums |
8ed5ecbe1b7cfe2d85a421e52f889d7920bbd72d4624768e79c859be2286ea8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / codon_degeneracy-0.1.3-py3-none-any.whl
| Download URL | codon_degeneracy-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
063847c63a0762557727768f9c01b6317206d2c5a1bfaca2582937f2b0768a37
|
|
BLAKE2b-256 checksum How to use checksums |
53cb22cfbe3789e0e4ccc31dcdf0e399ce238a0cc8aafd888f2fad698cd77284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|