Cython bindings and Python interface to Prodigal, an ORF finder for genomes and metagenomes.
Project description
🔥 Pyrodigal ![Stars](https://pypi-camo.freetls.fastly.net/010b6b31c61988425f670531a065d5b3cbafffc8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616c74686f6e6f732f7079726f646967616c2e7376673f7374796c653d736f6369616c266d61784167653d33363030266c6162656c3d53746172)
Cython bindings and Python interface to Prodigal, an ORF finder for genomes 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 invoke the Prodigal CLI using a sub-process and temporary files.
- 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. It also lets you save some more memory when running several meta-mode analyses
📋 Features
The library now features everything needed to run Prodigal in single or metagenomic mode. It is still missing some features of the CLI:
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 a little bit more overhead to compute the size of buffers in advance.
🧶 Thread-safety
pyrodigal.Pyrodigal
instances are thread-safe, and use an internal lock to
prevent parallel calls to their methods from overwriting the internal buffers.
However, a better solution to process sequences in parallel is to use a
consumer/worker pattern, and have one Pyrodigal
instance in each worker.
Using a pool spawning Pyrodigal
instances on the fly is also fine,
but prevents recycling memory:
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 pyrodigal
Otherwise, Pyrodigal is also available as a Bioconda package:
$ conda install -c bioconda pyrodigal
💡 Example
Lets load a sequence from a GenBank file, use Pyrodigal to find all the genes it contains, and print the proteins in two-line FASTA format.
🔬 Biopython
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,
or you will get a RuntimeError
:
p = pyrodigal.Pyrodigal()
p.train(bytes(record.seq))
genes = p.find_genes(bytes(record.seq))
However, in meta
mode, you can find genes directly:
record = Bio.SeqIO.read("sequence.gbk", "genbank")
p = pyrodigal.Pyrodigal(meta=True)
for i, gene in enumerate(p.find_genes(bytes(record.seq))):
print(f">{record.id}_{i+1}")
print(record.translate())
On older versions of Biopython (before 1.79) you will need to use
record.seq.encode()
instead of bytes(record.seq)
.
🧪 Scikit-bio
seq = next(skbio.io.read("sequence.gbk", "genbank"))
p = pyrodigal.Pyrodigal(meta=True)
for i, gene in enumerate(p.find_genes(seq.values.view('B'))):
print(f">{record.id}_{i+1}")
print(record.translate())
We need to use the view
method to get the sequence viewable by Cython as an array of unsigned char
.
💭 Feedback
⚠️ Issue Tracker
Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.
🏗️ Contributing
Contributions are more than welcome! See
CONTRIBUTING.md
for more details.
⚖️ License
This library is provided under the GNU General Public License v3.0. The Prodigal code was written by Doug Hyatt
and is distributed under the terms of the GPLv3 as well. See Prodigal/LICENSE
for more information.
This project is in no way not affiliated, sponsored, or otherwise endorsed by the original Prodigal authors. It was developed by Martin Larralde during his PhD project at the European Molecular Biology Laboratory in the Zeller team.
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.5.4-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b99040648e7eaa94425ba98e8140bbf210735ca6244aec3882bb094fcfd3edc |
|
MD5 | 24a8e2ff65c0bf3eb7c7c85cc5507e48 |
|
BLAKE2b-256 | c791d84625271c96bfb1a61103afce502f47b28216f952017a8b8a83d2ea4c47 |
Hashes for pyrodigal-0.5.4-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf17ad05a0d5c563c4b8816d48ed61d985f068bed37189501224c20b321873dd |
|
MD5 | 4ae4eb22ba7c849fe4b4bb49a3da2e75 |
|
BLAKE2b-256 | a357b782fb32103b8b01723580cb0d4acf7bd8d47797607f4c9f418ad262bef1 |
Hashes for pyrodigal-0.5.4-pp37-pypy37_pp73-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9bba57e4bf126d88032e19bc2a857aadadd1c941020fe0fae77b3dbedc4a1c6 |
|
MD5 | 5bae1ed115a56144d2951812515cbeed |
|
BLAKE2b-256 | f817ef0aab56f43c70ad796da6147cb9e80ef189f7d8f00223bf8713a6f2fcda |
Hashes for pyrodigal-0.5.4-pp36-pypy36_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca60981bd8e2b2b0889bc0a6fcc67452e74c1058db8f2c89594e7a6a2051762 |
|
MD5 | c81823e4fe78960ea65477b8ba848d10 |
|
BLAKE2b-256 | 41ba16b67df5fd0fb40b637ce19dc7b6257aee5e9ec4b0c400dea0d21a204e7a |
Hashes for pyrodigal-0.5.4-pp36-pypy36_pp73-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75f2b66c63112f1e0865d19ea4bba6d515efdd677594d35d903c0b15d055bc98 |
|
MD5 | f88a0710e2e2796fc68c0f7fe5432ae2 |
|
BLAKE2b-256 | 6215b4e95e699eb2b72ccb50868e9ea00e2052e5402a379081ef90eccaf61f52 |
Hashes for pyrodigal-0.5.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 454ae34d9f8964bfa7961ffe878acfcf2fec92753ba11f0af5c1510c0b19d672 |
|
MD5 | e1670fbeaa31aeff6d77dcfb5cb98cb8 |
|
BLAKE2b-256 | 2462db59909c8cf080fa066a6e2d3d5ea4853666f7d2002d2500c2b1efaba872 |
Hashes for pyrodigal-0.5.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eeb209bb182d2abeae90221a8222319aea92fc3d782ae7de1e8030c5690ec871 |
|
MD5 | d73b52730c7109dfd655b953845e5e9f |
|
BLAKE2b-256 | a70bf068807572682a8b570420d3caa05dd0e64c39b8f49a29c4289a3193e094 |
Hashes for pyrodigal-0.5.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | feecbe1f7ff8f9f09f1ab41dbbac68d12fd8403e03c66a3cefbf07435788539b |
|
MD5 | 2249e3988ebbbe6eb1e8721adc81c7cb |
|
BLAKE2b-256 | 5665a26815451c90c4f6d7cdb888bae5096059c2f9fcc30103b54c38c1f4ba57 |
Hashes for pyrodigal-0.5.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e1d82f658b74e920e4f88be88a32acb2b9efbb61746949ce30b9d42f83eb9b5 |
|
MD5 | e802f355ec5323fb1e249fa1d4548a22 |
|
BLAKE2b-256 | 849f07e415bfbfe839a99e9557c98f2741a9acdbdc4912583d732b297ff504d2 |
Hashes for pyrodigal-0.5.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95de4b05dc9507b076bb70f02369c9370c9580431f878451b3c985bc600731c4 |
|
MD5 | 562cd78f4e1527e7f826270be1d8cdf4 |
|
BLAKE2b-256 | 3829c49d2ab0d7be55b83a63113facf03543544da020b90ffac3b2a518fb396b |
Hashes for pyrodigal-0.5.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1490568883e8859c7ae5bf69851f19e6cae2e16e90034d76644832ee310ce07c |
|
MD5 | 43ae3256f7616b5d5664cf150071a43f |
|
BLAKE2b-256 | 18ec0cad33fe51658a3e37d849305931ff3f0c6a73b3b398b8642d54e8e2ae10 |
Hashes for pyrodigal-0.5.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1222bf37df508948707c05058090f7f06b9a4f79dcbd312dec4b329530b8326b |
|
MD5 | 7539a4a2c69e0252d1a6e539a2cbf5a2 |
|
BLAKE2b-256 | 5c1a8d52e902a4b149c7cc6a943188b43c75ea920197f57567ec61d6fafa2176 |
Hashes for pyrodigal-0.5.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f586d0c7416b3e9b5a63a2cbfbe515b6d3daa02a03e515720349f68746d903fb |
|
MD5 | 9ce7b8e314a4ad7a9a8676d3d3e99cff |
|
BLAKE2b-256 | 9c3cf08fd24f6ab4a67d49f5da9022df9118078c102bad72d3b14fe34f7395d7 |
Hashes for pyrodigal-0.5.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc391330184e2eb9e4b83fcbad7a0906be9805de247736dedad570dd799ce0b |
|
MD5 | 6ab62c1c98aa617f710bd05271c80b46 |
|
BLAKE2b-256 | 1cf9552497bf516f1a2a3b7dc7e19906d9b5cdc20c9a55723fc9e951f03dc299 |
Hashes for pyrodigal-0.5.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e29eead8146844c289dd2b9e21c71109a0f5dd117147ead094bcad47a9f48de |
|
MD5 | bde94a3a2d377948c9def6b40a0b2933 |
|
BLAKE2b-256 | 8c11301cbd92912c2e4ed5afe466eabae225acb927bfe037fe4dfeb45ad6b09c |
Hashes for pyrodigal-0.5.4-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9dcf0dfaa631274567c0be9086803e481d8764c2822f1769cc2410c6efcd387 |
|
MD5 | 9d951d6cd4b3febf8921da433304bf3f |
|
BLAKE2b-256 | 56fa10f6705833bb9162afd2395c0785e3d887f4a5a97d89fc4458bdeaabef91 |
Hashes for pyrodigal-0.5.4-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 862bcca0e32f255c933f204e33de397b7cf936d65c287fb1f52fc77efb7c72ca |
|
MD5 | 9afbfe7c263e28e5890815a1f0c165de |
|
BLAKE2b-256 | 2e973372f734bc931e703bc9f749e00ecfe6bf45ad1efb3e93b275b35c407ff4 |
Hashes for pyrodigal-0.5.4-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3405881e03d95af71ff70cd109160021678aa23eb66c086436f281a36f2dd64 |
|
MD5 | ea3da667aa57062528e3f52513bfd82a |
|
BLAKE2b-256 | dcd824c809bf37568861e90bc643d4a62fec3bb089d355d1b41e8ed60dea05f3 |
Hashes for pyrodigal-0.5.4-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59bbc6adb08a5379858bd7e60fbcb24cff7e0191c615a4c4745198c41c548842 |
|
MD5 | 978bdb3a8778ebb682698eaf16adfbbd |
|
BLAKE2b-256 | 89d4dd9e49250ff73ab3a8697b886a9c6c6d5a207c0020da3d37de3c6d012e34 |
Hashes for pyrodigal-0.5.4-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bda174d7ad25ac1621b5293afd77cc36428dc2487cefbddceb4e53bfc864ab42 |
|
MD5 | 6fcb1efcbf3c0b1aba37b9dacda3369f |
|
BLAKE2b-256 | 6a6286d9d76d1ba98ae815307b85d0bed12c9e82b59e11c3529cf39cc5c39108 |