Cython bindings and Python interface to Prodigal, an ORF finder for genomes and metagenomes.
Project description
🔥 Pyrodigal
Cython bindings and Python interface to Prodigal, an ORF finder for genomes and metagenomes. Now with SIMD!
🗺️ 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. Sequences can be passed directly as strings or bytes, which avoids the overhead 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
- better performance: Pyrodigal uses SIMD instructions to compute which dynamic programming nodes can be ignored when scoring connections. This can save from a third to half the runtime depending on the sequence.
📋 Features
The library now features everything from the original Prodigal CLI:
- run mode selection: Choose between single mode, using a training
sequence to count nucleotide hexamers, or metagenomic mode, using
pre-trained data from different organisms (
prodigal -p
). - region masking: Prevent genes from being predicted across regions
containing unknown nucleotides (
prodigal -m
). - closed ends: Genes will be identified as running over edges if they
are larger than a certain size, but this can be disabled (
prodigal -c
). - training configuration: During the training process, a custom
translation table can be given (
prodigal -g
), and the Shine-Dalgarno motif search can be forcefully bypassed (prodigal -n
) - output files: Output files can be written in a format mostly
compatible with the Prodigal binary, including the protein translations
in FASTA format (
prodigal -a
), the gene sequences in FASTA format (prodigal -d
), or the potential gene scores in tabular format (prodigal -s
). - training data persistence: Getting training data from a sequence and
using it for other sequences is supported; in addition, a training data
file can be saved and loaded transparently (
prodigal -t
).
In addition, the new features are available:
- custom gene size threshold: While Prodigal uses a minimum gene size of 90 nucleotides (60 if on edge), Pyrodigal allows to customize this threshold, allowing for smaller ORFs to be identified if needed.
🐏 Memory
Pyrodigal makes two changes compared to the original Prodigal command line:
- Sequences are stored as raw bytes instead of compressed bitmaps. This means that the sequence itself takes 3/8th more space, but since the memory used for storing the sequence is often negligible compared to the memory used to store dynamic programming nodes, this is an acceptable trade-off for better performance when finding the start and stop nodes.
- Node arrays are dynamically allocated and grow exponentially instead of being pre-allocated with a large size. On small sequences, this leads to Pyrodigal using about 30% less memory.
- Genes are stored in a more compact data structure than in Prodigal (which reserves a buffer to store string data), saving around 1KiB per gene.
🧶 Thread-safety
pyrodigal.OrfFinder
instances are thread-safe. In addition, the
find_genes
method is re-entrant. This means you can train an
OrfFinder
instance once, and then use a pool to process sequences in parallel:
import pyrodigal
orf_finder = pyrodigal.OrfFinder()
orf_finder.train(training_sequence)
with multiprocessing.pool.ThreadPool() as pool:
predictions = pool.map(orf_finder.find_genes, sequences)
🔧 Installing
Pyrodigal can be installed directly from PyPI, which hosts some pre-built wheels for the x86-64 architecture (Linux/OSX/Windows) and the Aarch64 architecture (Linux only), 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
Let's load a sequence from a
GenBank file, use an OrfFinder
to find all the genes it contains, and print the proteins in two-line FASTA
format.
🔬 Biopython
To use the OrfFinder
in single mode, you must explicitly call the
train
method
with the sequence you want to use for training before trying to find genes,
or you will get a RuntimeError
:
orf_finder = pyrodigal.OrfFinder()
orf_finder.train(bytes(record.seq))
genes = orf_finder.find_genes(bytes(record.seq))
However, in meta
mode, you can find genes directly:
record = Bio.SeqIO.read("sequence.gbk", "genbank")
orf_finder = pyrodigal.OrfFinder(meta=True)
for i, pred in enumerate(orf_finder.find_genes(bytes(record.seq))):
print(f">{record.id}_{i+1}")
print(pred.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"))
orf_finder = pyrodigal.OrfFinder(meta=True)
for i, pred in enumerate(orf_finder.find_genes(seq.values.view('B'))):
print(f">{record.id}_{i+1}")
print(pred.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.
📋 Changelog
This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.
⚖️ 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 vendor/Prodigal/LICENSE
for more information. The cpu_features
library was written by Guillaume Chatelet and is
licensed under the terms of the Apache License 2.0. See vendor/cpu_features/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.7.0-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f90eb614eca5b2021200e77a55e14a19d4f4fdb0c73ddd1a5fef2c3d4fc16d |
|
MD5 | 8597780696dcce640a32e07d47c7c796 |
|
BLAKE2b-256 | e492de2147ad93214a94dfea7159bfc535b5b2bf2f9713b1364c3376218ee189 |
Hashes for pyrodigal-0.7.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 077ec26fe788455b01e3293ca5418d9e41d67c244333868efc55690e7358ee67 |
|
MD5 | 93c028d10d07b495aab640ec33414504 |
|
BLAKE2b-256 | 8c1d82dc5e87fb8edb197449a98cf62485d444396787d42b8f36fbeb2c22ed85 |
Hashes for pyrodigal-0.7.0-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1965e290d31b711196a6edcce3b85581e73e0e8cd7b1c9d6e335b472fd30816f |
|
MD5 | c8da538ea09a1782282a8bc3702bf738 |
|
BLAKE2b-256 | 0fe35a1bfb2955e15353a73525e35c9f2b6d54b175ba8745dc814b9e13a5c897 |
Hashes for pyrodigal-0.7.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e8ed17e2ed7698926e932d1345d8d9f55b36a7c97c3ff265adf8b923f484ee5 |
|
MD5 | f3531e9474aaa2ff41d73d2874508d7d |
|
BLAKE2b-256 | 719b457974328966c2ef479bbb1d279e81aaf025048dc107d6f722a5bc9283b9 |
Hashes for pyrodigal-0.7.0-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 620601e35553e170ddd3b6ba76a80b638468cf1df8a17e66cafe1363b131abc4 |
|
MD5 | d806257fdbf31c61d817d08746cf041e |
|
BLAKE2b-256 | 90b3f4e2ecdc15ac528c1a1d8f21d2298cad374e563f314be70671525860572c |
Hashes for pyrodigal-0.7.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523b376cae7f5735c9b2883deeabb40cc6b98d776352453ee76f45a191cb83a2 |
|
MD5 | 2049442c8ef951fca1938d4920ab15be |
|
BLAKE2b-256 | ffd40e0a3109c34907f7675ee5a241b23ce5456e68ea9829b6451d6bdca9e48b |
Hashes for pyrodigal-0.7.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0a706d1ba44575c97c6c12a6e28ea05587fa4047d8f4894187002b338f8f0c |
|
MD5 | 3219518e59065a7267f9594eb45f6fa1 |
|
BLAKE2b-256 | 503793b0463ab735368aeee6c5711a5c71cee784ea25516a5e9eedebd4b99ee3 |
Hashes for pyrodigal-0.7.0-pp36-pypy36_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43073fb801ab4f89a9514f3e4f0d7921da18c8499f05a9c69f307540fa35ad7d |
|
MD5 | 949b66f15dcf8c0a99a8294dbf7f8039 |
|
BLAKE2b-256 | ed3973653e75df8bd0520e2c0b1b2e782a15eb96a73972063773b850548e74de |
Hashes for pyrodigal-0.7.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bd4644ac58dfe6dfd370c5db99047e9038f4baaee56329909f95bebd23f07e6 |
|
MD5 | 748295e7068d9bf5780e0e81f41f136f |
|
BLAKE2b-256 | da1da740461a424d6e6af41dec4fbf3d7805e2fefa394817a572cf225a89feb1 |
Hashes for pyrodigal-0.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f8d251cc6e2494dc5b692d448c9be9747b59853f68f5e1c9cd9ae1a7a3980d4 |
|
MD5 | 93f4628b92206b348f13fc1378bb2375 |
|
BLAKE2b-256 | 7f41077749a45921c9cc6169e5757bfbfcd08bda93a98f7cd1791a8ea6d15533 |
Hashes for pyrodigal-0.7.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd1f2ca47dc4b43b295190de841b8abadf22fc75aea537b391d199f92740cd0 |
|
MD5 | 3d534ee8842a6513b8c1f63123d3d28f |
|
BLAKE2b-256 | 25776aa75ad44720da62641c450562b0c88089b45487c0b10209da1f8f2d006d |
Hashes for pyrodigal-0.7.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 997b3d2a0a7594d13bfd0ed8d787df202bde126791435fc0d97a100dde3a9f35 |
|
MD5 | 363dee044b19d036beaf8fa3dbb3cc77 |
|
BLAKE2b-256 | 814e39ea05aa63a824da6dab95e5b2b645e645d5bf7663df3aa19310112dafd6 |
Hashes for pyrodigal-0.7.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b5326b4190e91ae2c00208f795a78c2ca3274c00dec57f72f4f293ef327078c |
|
MD5 | dc039ae3c80695a06df4bd04640172b2 |
|
BLAKE2b-256 | a57c31249eeddb423bfbbfb17fdd56ecaa643138e08ebfe80e0f40f3b95284a3 |
Hashes for pyrodigal-0.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff9ccf048555569ce4b4878ac7d2e12f933103c18f922fd9f6465190d257eeca |
|
MD5 | db79a84b62176a8709511f3429b0d5dc |
|
BLAKE2b-256 | 22a9d44132b44f71bd8035d0293ae49411289810bc39787e259ed84857ffe7b3 |
Hashes for pyrodigal-0.7.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa7b86af4725f235ad6069d651ce68936655483d6ac32c6eb7228262d2abaa73 |
|
MD5 | c8859b055544b516d86633bd09087f18 |
|
BLAKE2b-256 | d9d207198d5b4345926a445742df87a90543fef2032d6a4e1c0a8b9a654fd708 |
Hashes for pyrodigal-0.7.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd608c2ee72196fe41069e108b69d4af8ef9ab120f09ccc804690829263bc40b |
|
MD5 | de76c0295d9331945b57014875bfc802 |
|
BLAKE2b-256 | 68a7cd452e7ec953f93e55619bb3ff6e1984dc79299acd8531a5014f7dfb767b |
Hashes for pyrodigal-0.7.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bf836bb2d460e4f25648a65009343a8ddd49c0c16e5b80eb4bdd1163b560208 |
|
MD5 | c25073828b2823f36016841bdd1218e9 |
|
BLAKE2b-256 | c2652a12b0f5100233ed55dd67482ea7c0eba1e44ff995ee7d1b8edbf39c3c50 |
Hashes for pyrodigal-0.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5065330ded8c821dc4f6a24dce360cf6d44fad47b20f1aa5d4e124f278bcdaa |
|
MD5 | 023f01a5cdda7598bb6eaf6ad2e8ad28 |
|
BLAKE2b-256 | f0812cb871873457295d28f942dfb2b541199e1523aaa17c1941ec1c30de2217 |
Hashes for pyrodigal-0.7.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08afdeeb28c06a67b73a56724c63f521edd0d7f7aa90e7f55155dd41a08f229a |
|
MD5 | fa6edc8078ed26294295bb8a68ab74a8 |
|
BLAKE2b-256 | 6828b2a845a409fe1046e4125b471d41822aa953986a15401c3f8606e07436eb |
Hashes for pyrodigal-0.7.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 172bc7efe36514f3ea58f14f3580bc43fec577332178bd1a4d3f64d245c7f929 |
|
MD5 | 01cdb68ad93c0b3e13d333843c81032c |
|
BLAKE2b-256 | 89295f95c97f8271e8c0dcfe3eab3d78b8d0e915d35e63fd73b3dd4feba79192 |
Hashes for pyrodigal-0.7.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caec346117134ce7f4a617c0b7bff20f019cf6c84ee69a75a045ad9916c9b0af |
|
MD5 | 2bfd9991b7828020815b5c6e942307fb |
|
BLAKE2b-256 | 1ca03f8003dfa02eabac61ae8274f808fc7ad635e3cf732ba0e5e256d1eb6b0b |
Hashes for pyrodigal-0.7.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fcd3255e7f2635e0954ad787561cd7c9d2f93072326375d30a393fb1e8a62cb |
|
MD5 | 66997faa74a996edea727b2c9f87161f |
|
BLAKE2b-256 | d66b96a39409eba9590426d8b0e30213c4a213e5ad745108793b4ab7ab6c6e30 |
Hashes for pyrodigal-0.7.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a325bd01057e8836bfbe0e8f875685f25ce46d8be74fd9c44de5201f73f55ccf |
|
MD5 | c58ed899e11562813f6f918b2702c072 |
|
BLAKE2b-256 | ac2173c2a692f848c1ded1b9eefa6fc8025dfa7fac5bbc9db332bedfb6b5fdec |
Hashes for pyrodigal-0.7.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 112124ee31145f0ea2964a4e9337e13820bab40e329ec51da2d98e2e1a2c01e1 |
|
MD5 | b53ae767c1767af5980e552a063f16dd |
|
BLAKE2b-256 | b82ad57a0aff716f34969c7036e04016db7fbb81283f9fe2b837718535ec5461 |
Hashes for pyrodigal-0.7.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6bbda7f2b793c4e00771c08529353d27d8f2329c775f949ed83fb87aa0acbbc |
|
MD5 | 14e4a6955a3b6c411ae5179e8aee50b2 |
|
BLAKE2b-256 | 7a06bd2c03eee979e476afb94f426f7d0c3d6e54508652e0ba62765e400fc160 |
Hashes for pyrodigal-0.7.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adc9ad9d6e6fabc25a674c27a2c82598ae44bd1429bafb1ccffac621ff250f27 |
|
MD5 | a4491a65e4ba0abeb3a4402a20186d35 |
|
BLAKE2b-256 | c509fd36d225fd26635b724fb0939a16f5bcc5fda95b171ce26d689fd319f7fa |
Hashes for pyrodigal-0.7.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32a37dddcef70c6edeb9ab7a8134db3fdb8578e19fc8d2a94a5190933242eacc |
|
MD5 | f85dd9b411847a512569483ce5bfa5ed |
|
BLAKE2b-256 | 48ef2bd65458418d4c827a966b83b7d0e3ec0de20086fecd97610fb04709b1cf |
Hashes for pyrodigal-0.7.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fc816b74c85ce1fb407a6be1835522f4331a29e0b5e623222ab552eaa1d469f |
|
MD5 | 135559db15457a2a0c09c8e0c427d2ed |
|
BLAKE2b-256 | 032465b1f22ae23e8000346b3c1d41156f19dfc0a1119cd24f0dfcc991505757 |
Hashes for pyrodigal-0.7.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55ec4253fb1be0c0dfea484e84b58ce81695ab47c66b6806853bf18be99d78e2 |
|
MD5 | 4c766df99719ee16a81559d6fd642dd1 |
|
BLAKE2b-256 | a5afffc8936be593b312bc097a941e74689989c20cbbcf844aa403d14270a671 |
Hashes for pyrodigal-0.7.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff97aeae02b5e60b344abeb88498b3a8ff8c9517a8dfa1baf183983aa9a91084 |
|
MD5 | c097345734031e9416a9e8e7979fc4cb |
|
BLAKE2b-256 | 5fecbcde2b162fb66883261e0ccc6c8e444b4f9f92e75153212c42e3c2143cac |
Hashes for pyrodigal-0.7.0-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df552a15f2ce364610591a59faa1f36daa308025887a08097e15cbf47158ba64 |
|
MD5 | 5212b95eb7de39b2f4d125725bb96452 |
|
BLAKE2b-256 | 47d105ee16a440e18ff31f6cc257f159e95bf6413403ff8141a6016043f48032 |