Python interface to Prodigal, an ORF finder for genomes, progenomes and metagenomes.
Project description
🔥 Pyrodigal
Python interface to Prodigal, an ORF finder for genomes, progenomes and metagenomes.
🗺️ Overview
Pyrodigal is a Python module that provides bindings to Prodigal using Cython. It directly interacts with the Prodigal internals, which has the following advantages:
- single dependency: Pyrodigal is distributed as a Python package, so you can add it as a dependency to your project, and stop worrying about the Prodigal binary being present on the end-user machine.
- no intermediate files: everything happens in memory, in a Python object you fully control, so you don't have to manually import and export sequences to pass to the Prodigal CLI.
- no input formatting: sequences are manipulated directly as strings, which leverages the issue of formatting your input to FASTA for Prodigal.
- lower memory usage: Pyrodigal is slightly more conservative when it comes to using memory, which can help process very large sequences.
📋 Features
The library now features everything needed to run Prodigal in metagenomic mode. It does not yet support single mode, which requires more configuration from the user but offers more flexibility.
Roadmap:
- Metagenomic mode
- Single mode
- External training file support (
-t
flag) - Region masking (
-m
flag)
🐏 Memory
Contrary to the Prodigal command line, Pyrodigal attempts to be more conservative about memory usage. This means that most of the allocations will be lazy, and that some functions will reallocate their results to exact-sized arrays when it's possible. This leads to Pyrodigal using about 30% less memory, but with some more overhead
🧶 Thread-safety
pyrodigal.Pyrodigal
instances are not thread-safe: concurrent find_genes
calls will overwrite the internal memory used for dynamic programming and
could lead to unexpected crashes. A solution to process sequences in parallel
is to use a consumer/worker pattern, and have on Pyrodigal
instance in each
worker. Using a pool spawning Pyrodigal
instances on the fly is also fine,
but prevents recycling internal buffers:
with multiprocessing.pool.ThreadPool() as pool:
pool.map(lambda s: Pyrodigal(meta=True).find_genes(s), sequences)
🔧 Installing
Pyrodigal can be installed directly from PyPI, which hosts some pre-built CPython wheels for x86-64 Unix and Windows platforms, as well as the code required to compile from source with Cython:
$ pip install --user pyrodigal
Otherwise, Pyrodigal is also available as a Bioconda package:
$ conda install -c bioconda pyrodigal
💡 Example
Using Biopython, load a sequence from a GenBank file, use Prodigal to find all genes it contains, and print the proteins in FASTA format:
record = Bio.SeqIO.read("sequence.gbk", "genbank")
p = pyrodigal.Pyrodigal(meta=True)
for i, gene in enumerate(p.find_genes(str(record.seq))):
print(f"> {record.id}_{i+1}")
print(textwrap.fill(record.translate()))
To use Pyrodigal
in single mode, you must explicitly call Pyrodigal.train
with the sequence you want to use for training before trying to find genes:
p = pyrodigal.Pyrodigal()
p.train(str(record.seq))
genes = p.find_genes(str(record.seq))
📜 License
This library, like the original Prodigal software, is provided under the GNU General Public License v3.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pyrodigal-0.2.4-pp36-pypy3_72-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59c7c122cea8e88f1136b544480fe8434dce41de70b0e029098c3240bcff22c8 |
|
MD5 | 0e8c1878c5835dbf6d551268b10b3880 |
|
BLAKE2b-256 | 21e8480511be8a7038a81524f716bcba62624bf32ef64a024c1670a169fa78fb |
Hashes for pyrodigal-0.2.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02f59cfa426b469b17b3dabfaca1d951c62e39180b9d4f52d58dac33a4994d8 |
|
MD5 | 3effa405dba2a4849a1dc79109fb9f65 |
|
BLAKE2b-256 | 11ff50ef68daa7a63904f64b11e9e15037d1e4c9f829fd144d48cafc70d5d103 |
Hashes for pyrodigal-0.2.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5437047c86208e3c917585a1b928583b757a9f31efcfe8da055cbe3446f4e4d |
|
MD5 | 50c835f9675740b45cf7198e736542d8 |
|
BLAKE2b-256 | 9af02c4208e452b4d5b5b4b6ecb5a7083eb20bb27946b1a017b3e8312247f8f9 |
Hashes for pyrodigal-0.2.4-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee9111302b37b92ae6a56bece7e60ed73baf8172cf37e7d9163b6ccb2bd08fb |
|
MD5 | e9e66ad4ac07fabe6dd827a86a4c9685 |
|
BLAKE2b-256 | 359262e66c7a0eec50a1673bf266ffd8f56b5adc06ae2a579c188975ebfe3c63 |
Hashes for pyrodigal-0.2.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5775035d7b5065618bf6609f948b45826cf2fbc8180bef60c993928592ef6fa1 |
|
MD5 | e916576d690eb04cfa48292167077cc5 |
|
BLAKE2b-256 | 3cb7a81a172062229af672d39fb91a62c525aed71c65577f3d5add11e6fc532c |
Hashes for pyrodigal-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 082bf1f3c2b371cdbd8ce489529a42d745f18305eafa519a6f725ae2f95a48d7 |
|
MD5 | 189456ec0097781798aab00a4e8f5ad5 |
|
BLAKE2b-256 | 00c364da69f5a7bae10a4f67e604ee0f9db0e6aa8f2593511bca2e33ac4dbfb4 |
Hashes for pyrodigal-0.2.4-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 821f32e9dfa6acb7a1618b25141a743e961982052ec1af3e6999130bbb3a9ccf |
|
MD5 | 531db59674b8b540863f6220653ace4d |
|
BLAKE2b-256 | c1c2076ddb69a7b4f792229bddd669524d05307808a142f98eb73841b6af68d2 |
Hashes for pyrodigal-0.2.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 728446d517a9f3c8ef429d49a9aa7e070f111bc84b2bed17101077a795092362 |
|
MD5 | bb4ead91af973444e11be7918e1ad9c4 |
|
BLAKE2b-256 | 9f8d6970b7eca03a7773150e04060b1c93c530a2e2f654bdca82c8097518f19d |
Hashes for pyrodigal-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c29ea6e01e066ff38bf8106465bfc913f95f4e25e897b5806acace858ca19713 |
|
MD5 | b1812f69cdb241903af2de924a4ca9c5 |
|
BLAKE2b-256 | 351a4d8c7165b0d87201ad19873d144d78a9e0687a003a843313e62a6bad2f16 |
Hashes for pyrodigal-0.2.4-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a1c8a899b5eb9091aafae7bc89916fff0d92cd08ee6e8398e86f9fde5ba35f1 |
|
MD5 | 90e99e6625f1dba7abd6538362830adb |
|
BLAKE2b-256 | 8abffc93086f6825148cae3c96d24a307745975d084a21219aa23c509fc893fb |
Hashes for pyrodigal-0.2.4-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1708d7d5535e1e3374f8d7c730b8c2b5be39ea4bc40eb1d4b78610f32f59ddf |
|
MD5 | 48cc5634cc85accd0049acec130d924e |
|
BLAKE2b-256 | 4a7ff3d63250b6e0b6b5917a3af61134e9eb689acf423818e78727eabd90b417 |
Hashes for pyrodigal-0.2.4-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf9eaa9ce9d9e203e0d6b3b729829ee2894ef7e3b741ca4c1396dcd1b90ee8f |
|
MD5 | fd629f92c1142df8e58e38e70b961fdc |
|
BLAKE2b-256 | cc8a5324dc88ab3ec6280feafdc1a5660ba9954186d73f79c07feeff73449673 |