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. 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 several changes compared to the original Prodigal binary regarding memory management:
- 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 extracting said 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 multiprocessing.pool
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 (corresponding to prodigal -p single
, the default operation mode of Prodigal),
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
:
import Bio.SeqIO
import pyrodigal
record = Bio.SeqIO.read("sequence.gbk", "genbank")
orf_finder = pyrodigal.OrfFinder()
orf_finder.train(bytes(record.seq))
genes = orf_finder.find_genes(bytes(record.seq))
However, in meta
mode (corresponding to prodigal -p meta
), you can find genes directly:
import Bio.SeqIO
import pyrodigal
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
import skbio.io
import pyrodigal
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
.
🔖 Citation
Pyrodigal is scientific software, with a published paper in the Journal of Open-Source Software. Please cite both Pyrodigal and Prodigal if you are using it in an academic work, for instance as:
Pyrodigal (Larralde, 2022), a Python library binding to Prodigal (Hyatt et al., 2010).
Detailed references are available on the Publications page of the online documentation.
💭 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-1.0.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bc0bd68fbf8f31498663e55fa11fa8cae5b6feab2abdb5e1c7299845fbb9844 |
|
MD5 | bedb0be7abc4d08c202f76cb9019f945 |
|
BLAKE2b-256 | 2e45b6a48534fbabd99271fecba509027a687d4f52d3a1ac48a585c313ec8c8d |
Hashes for pyrodigal-1.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b0d0df96ae7e07271b08ebedb037e7d85603b23f4438243c770d6c7152d67d6 |
|
MD5 | 6840a2768a79024fdd4fd9d9b3cbb9b6 |
|
BLAKE2b-256 | 00e8c047786e7d7c291857806f71318dd024985249b32f2fc9c983c6baa3d51f |
Hashes for pyrodigal-1.0.1-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97294ef75d3b1c8833142c652fec6022608d4863f57ed1324f317ada97f6971b |
|
MD5 | 6c08f71d148a1a7fcd994712159237f7 |
|
BLAKE2b-256 | f47324df0b1dca7559c6397b660840588cd6dd0aab4d7143d3dc944afb59429a |
Hashes for pyrodigal-1.0.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06c2f012d2bc5cf893f86f64e406dfd687a0eba7efe0ce2372a1b79516d65d94 |
|
MD5 | 1f35624da9278a113cb1ff42ad96fede |
|
BLAKE2b-256 | 5f0bb38fd0f94c12a2b219b058c8bade02460a27f6612b4e124c085bd12b5620 |
Hashes for pyrodigal-1.0.1-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a2bf34b1fb2b107109340919ab020dd1fa95ceab16c254fc4ba03e8100ffeb3 |
|
MD5 | 7ac87322e0ba900a471e4c78ad5373d6 |
|
BLAKE2b-256 | 6f2ea6a51b9b965d06e07c5de36e94b363478e111157f3be25b7ce71e02a2e85 |
Hashes for pyrodigal-1.0.1-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 282cd2aeb9921fcab7f0c918a6cea6d191b3cca2fafbade9d1ef370fb99e6b5a |
|
MD5 | 81e66e36b1a055e2f432936b1277812b |
|
BLAKE2b-256 | 6bf7dde329ac2cf77abe9a77b9948c25bdbc66cd1e8bb41658caeb3e22e10827 |
Hashes for pyrodigal-1.0.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2d2b1936feaaa23dff93090d0da40c0c82476f7420cabdd84b5d4345803e18f |
|
MD5 | df550a9e69ff475604a519a2d81371e4 |
|
BLAKE2b-256 | 167b55c0eaf3e4924b589ae5de86ddc34569f09b9771fe28f7b3a14bcac6225d |
Hashes for pyrodigal-1.0.1-pp36-pypy36_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40ede17ed8734dad3686e49295aeb2d37059246fd1c6f1539e3fb6498f594bec |
|
MD5 | c89da289372b8106ede0681bccbb967f |
|
BLAKE2b-256 | 6739945651d0137fbc9ff086582c125383557d54fa9d3e742054d1f8f3ab9f5c |
Hashes for pyrodigal-1.0.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 158dd6982fb9d760eaa9136e2c06cac807701b48c4eb8338bd5227c4f42baf0d |
|
MD5 | aef8f55f13f25f3f1b80afeada330461 |
|
BLAKE2b-256 | 1fd3a89a80bbdd4c5cb1cf4cffeeef7c8abf43e305986741c23c0a13ea09372c |
Hashes for pyrodigal-1.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27272776b47fc9122832f0f492dd47899546d14225aa897141b3560032e053cf |
|
MD5 | 5e6799e9179c06b7b1013ab917b98851 |
|
BLAKE2b-256 | 26139e237b8438d1570770ad6b180c40e036ca95338bb9bfa8379f72cef7ceb1 |
Hashes for pyrodigal-1.0.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ff9213552a20d35f672d91feef7e6f59c6138efddfce1bd356a05192fdb9dad |
|
MD5 | 35de62d5cb98893cf85c415c33a15221 |
|
BLAKE2b-256 | a018508df2a6a27ab823d77674b266eca33717f567f4b89e518ca054a9f07490 |
Hashes for pyrodigal-1.0.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2b8b88b4a95bffaee05d46662165789a4da8ac117414f74f81ae9812e0a26d9 |
|
MD5 | c7c64cbdfead0ad5cf447b3271ba2c2c |
|
BLAKE2b-256 | 6c6a6d6ff44266c43ec2fe46cefabe109c6514cade858e75d6492406a6ef92df |
Hashes for pyrodigal-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7398f0e89d8194a1a1c41e4a8a6b36fa279d3907612fcd73d6b76d7f330aeaa1 |
|
MD5 | 0cdeb5b36e31471eb54a2b43a7f64c6e |
|
BLAKE2b-256 | 0104aec6e8ce4a5a69068fa961c19df03727a2fca70612bc8ea6d32cba68278f |
Hashes for pyrodigal-1.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d3bc7d3d0b2aab06a4993a3ec3e44e9968cb0212db95b5947182a0d419b882 |
|
MD5 | 122cfad6558b039d687177722bb8f652 |
|
BLAKE2b-256 | 414ae3596a49012f3a7b8d013b707b0c44fd59f8b228e034c647e49a83a5dd6e |
Hashes for pyrodigal-1.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0da8a31cf4acb024fbc4bda3bb0c3c7246973a4de405bde4556635423c3582 |
|
MD5 | affc904d64605d278f9881a604d74f24 |
|
BLAKE2b-256 | bb59b0da87713ced058a9a2f8ba2299310990edfbd31082e9250e3e1e986ddea |
Hashes for pyrodigal-1.0.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44c7087b76ef96644853a794f7627f419c8afaea36c29fd4d4db3f92c220fde8 |
|
MD5 | ef3e192042fc6f0f9876f0d29dae4f4e |
|
BLAKE2b-256 | 676eff5650d97f956856e404a186def299f25120f6b16ab767e76dbfbc8e79f3 |
Hashes for pyrodigal-1.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d302e6adabaeec18d5a066cd1e8afaafa573c3286d5a67ede11dd47c3ba6d4e2 |
|
MD5 | 83d4913b4036a82af5b5adf1d6e6098d |
|
BLAKE2b-256 | 1ff6f7e446f107b616072acbcda418fd83c565e79a89c679f9cd23bbac95ff28 |
Hashes for pyrodigal-1.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a00aa68670550e207ff1775c9303229f86a487504be30efc71ced831e6f19ee4 |
|
MD5 | b97b739ee46793d508d5d0fa0feb53f1 |
|
BLAKE2b-256 | 77314512f52ab2c20733aabe6892905afc1d28b0ac7b49c72ebcf6ff32a3902a |
Hashes for pyrodigal-1.0.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 685627d57f40fe66904c398c5ee5e09640fa3d9fa27021c8f82d645007520196 |
|
MD5 | 4465a62102bfe6790b3ef4ee0520e4a4 |
|
BLAKE2b-256 | 2454779a04cef74591afe0d6c1924f43209c7e9717165748e465b0be1671221f |
Hashes for pyrodigal-1.0.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8ae64160d6edebcdbc1f254c34cfc13e469f17ec6b43e5001c16760da791c4 |
|
MD5 | 0b9218a80890fc32fe8dab3e5d73eb9b |
|
BLAKE2b-256 | efff13364fdb973f3b9fd67761f2c1986aad88ce0e1afcb0eb0ac5a9dccaa396 |
Hashes for pyrodigal-1.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 586c49e13dbe422a87c15a6cc509d53af431a8ac0eb9b283664afc1391a476a0 |
|
MD5 | 735f56156f43c07accf7b673a2b5a0ef |
|
BLAKE2b-256 | 90020e84e010e67346d3c18ab299ec95f82890c2dff5d0617a84ecd5e9e25fdf |
Hashes for pyrodigal-1.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b025372dc00c07c011b9f132a12beabd1f4a3b50854fb83d454a5c06234ef8a6 |
|
MD5 | 1d5f5552cab9b48a2de776c87cf317be |
|
BLAKE2b-256 | e0a0e96f1dcef53d32edd97f69683a85acae534d3e99aa3256d305a829886f72 |
Hashes for pyrodigal-1.0.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a9fa42eb853dba5b176c2c907af6a20e8f04a44aa51bc0ac9cfdc66248a461b |
|
MD5 | 6b56f570ea712d85fc0c5a0f9727e2b8 |
|
BLAKE2b-256 | 32b5157bb00593173d53555c73e0d625cbe4d138cadaa3b8265ff07cdf159918 |
Hashes for pyrodigal-1.0.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de0ca511f8cf2d2095ac7a26dfbdc7d4cfe81cbae77a9b26a87c4ef4b98b448d |
|
MD5 | 97425994c104955a31f2fae986c793bc |
|
BLAKE2b-256 | 7c839256b441716577e8788b37741bec52f311a25982d084cfd3f88af04f509c |
Hashes for pyrodigal-1.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db579c401e2de722affe4e20cc8e750d16892f8a60b0a1f2626e78860666ad96 |
|
MD5 | e372d077bb46412d25c82d034e5667ca |
|
BLAKE2b-256 | 3fc046019782e70d022839f09371299337c961ec4404422603eaa6250d70db25 |
Hashes for pyrodigal-1.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 255af0c63aba0592db457d6b7481934cb6d600d3a2c39decfb50bef5a6defef0 |
|
MD5 | 3d752486f85b7017b9a106cd543e3991 |
|
BLAKE2b-256 | d2dc9ad5af9166fe832aef4d05da86c6ef93c8d1fcc83578103e37173b41a696 |
Hashes for pyrodigal-1.0.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec8e589bda3f110abdb61ac9eabf6809da3f53800994916f0827d8bb4bed834 |
|
MD5 | 59bb535729a32b37b74b529506e2db73 |
|
BLAKE2b-256 | 176a98ff625d96a5d45fb744e8a9fe15611ed4eac0c049af656c2d723d756fcc |
Hashes for pyrodigal-1.0.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 113ba8a915847c23c0ecfcee97a713c066e60f0e4e50e957357d51c8e013a581 |
|
MD5 | c4ea3ba35c40729a3c19cd48bb9dbed0 |
|
BLAKE2b-256 | c2a279cef8178e136921609e807fb59327db2961d9e27abf87a3596f1ab995d3 |
Hashes for pyrodigal-1.0.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca441c24b5bdc59b0c26d6c9b9a9c55539d66e7c753441e78f23a7d941c3c33f |
|
MD5 | 281961f7278d54ce6e6b42cb1878294a |
|
BLAKE2b-256 | c99f96b2ffc3ae6ff9a3bce55963fd02efee2cbda8db544907bd8ab80c65db8f |
Hashes for pyrodigal-1.0.1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28eac1c3c54ae268df645908561f7882d33e37672a2f2721f5be7eac40d0b432 |
|
MD5 | 001d87f098687d90786346ee8bb266d1 |
|
BLAKE2b-256 | 89cf4d90754baed538669cc925a6533a7ae9ef1c28e97c80fc65ed8a5d457f87 |
Hashes for pyrodigal-1.0.1-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5b8c3904192e1e30eedef200b1b1c04dde2696b8516ef8677f34c156823abf |
|
MD5 | 9678acb15c350956c618f4bb813da487 |
|
BLAKE2b-256 | a3bf4447d5734fa2f95d917fd6a80551297076b3a8d9728dee909994df7966e7 |