Skip to main content

Cython bindings and Python interface to HMMER3.

Project description

🐍🟡♦️🟦 pyHMMER Stars

Cython bindings and Python interface to HMMER3.

Actions Coverage PyPI Bioconda Wheel Python Versions Python Implementations License Source Mirror GitHub issues Docs Changelog Downloads DOI

🗺️ Overview

HMMER is a biological sequence analysis tool that uses profile hidden Markov models to search for sequence homologs. HMMER3 is maintained by members of the the Eddy/Rivas Laboratory at Harvard University.

pyhmmer is a Python module, implemented using the Cython language, that provides bindings to HMMER3. It directly interacts with the HMMER internals, which has the following advantages over CLI wrappers (like hmmer-py):

  • single dependency: If your software or your analysis pipeline is distributed as a Python package, you can add pyhmmer as a dependency to your project, and stop worrying about the HMMER binaries being properly setup on the end-user machine.
  • no intermediate files: Everything happens in memory, in Python objects you have control on, making it easier to pass your inputs to HMMER without needing to write them to a temporary file. Output retrieval is also done in memory, via instances of the pyhmmer.plan7.TopHits class.
  • no input formatting: The Easel object model is exposed in the pyhmmer.easel module, and you have the possibility to build a DigitalSequence object yourself to pass to the HMMER pipeline. This is useful if your sequences are already loaded in memory, for instance because you obtained them from another Python library (such as Pyrodigal or Biopython).
  • no output formatting: HMMER3 is notorious for its numerous output files and its fixed-width tabular output, which is hard to parse (even Bio.SearchIO.HmmerIO is struggling on some sequences).
  • efficient: Using pyhmmer to launch hmmsearch on sequences and HMMs in disk storage is typically faster than directly using the hmmsearch binary (see the Benchmarks section). pyhmmer.hmmer.hmmsearch uses a different parallelisation strategy compared to the hmmsearch binary from HMMER, which helps getting the most of multiple CPUs when annotating smaller sequence databases.

This library is still a work-in-progress, and in an experimental stage, but it should already pack enough features to run biological analyses or workflows involving hmmsearch, hmmscan, nhmmer, phmmer, hmmbuild and hmmalign.

🔧 Installing

pyhmmer can be installed from PyPI, which hosts some pre-built CPython wheels for x86-64 Linux, as well as the code required to compile from source with Cython:

$ pip install pyhmmer

Compilation for UNIX PowerPC is not tested in CI, but should work out of the box. Other architectures (e.g. Arm) and OSes (e.g. Windows) are not supported by HMMER.

A Bioconda package is also available:

$ conda install -c bioconda pyhmmer

📖 Documentation

A complete API reference can be found in the online documentation, or directly from the command line using pydoc:

$ pydoc pyhmmer.easel
$ pydoc pyhmmer.plan7

💡 Example

Use pyhmmer to run hmmsearch, and obtain an iterable over TopHits that can be used for further sorting/querying in Python. Processing happens in parallel using Python threads, and a TopHits object is yielded for every HMM passed in the input iterable.

import pyhmmer

with pyhmmer.easel.SequenceFile("tests/data/seqs/938293.PRJEB85.HG003687.faa") as seq_file:
    file.set_digital(file.guess_alphabet())
    sequences = list(seq_file)

with pyhmmer.plan7.HMMFile("tests/data/hmms/txt/t2pks.hmm") as hmm_file:
    all_hits = list(pyhmmer.hmmsearch(hmm_file, sequences_file, cpus=4))

Have a look at more in-depth examples such as building a HMM from an alignment, analysing the active site of a hit, or fetching marker genes from a genome in the Examples 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.

⏱️ Benchmarks

Benchmarks were run on a i7-10710U CPU running @1.10GHz with 6 physical / 12 logical cores, using a FASTA file containing 2,100 protein sequences extracted from the genome of Anaerococcus provencensis (938293.PRJEB85.HG003687.faa) and the version 33.1 of the Pfam HMM library containing 18,259 domains. Commands were run 4 times on a warm SSD. Plain lines show the times for pressed HMMs, and dashed-lines the times for HMMs in text format.

Benchmarks

Raw numbers can be found in the benches folder. They suggest that phmmer should be run with the number of logical cores, while hmmsearch should be run with the number of physical cores (or less). A possible explanation for this observation would be that HMMER platform-specific code requires too many SIMD registers per thread to benefit from simultaneous multi-threading.

To read more about how pyHMMER achieves better parallelism than HMMER for many-to-many searches, have a look at the Performance page of the documentation.

🔍 See Also

If despite of all the advantages listed earlier, you would rather use HMMER through its CLI, this package will not be of great help. You should then check the hmmer-py package developed by Danilo Horta at the EMBL-EBI.

⚖️ License

This library is provided under the MIT License. The HMMER3 and Easel code is available under the BSD 3-clause license. See vendor/hmmer/LICENSE and vendor/easel/LICENSE for more information.

This project is in no way not affiliated, sponsored, or otherwise endorsed by the original HMMER 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

pyhmmer-0.4.11.tar.gz (2.1 MB view details)

Uploaded Source

Built Distributions

pyhmmer-0.4.11-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.3 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-pp37-pypy37_pp73-macosx_10_7_x86_64.whl (1.2 MB view details)

Uploaded PyPy macOS 10.7+ x86-64

pyhmmer-0.4.11-pp36-pypy36_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.3 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.5+ x86-64

pyhmmer-0.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-cp310-cp310-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 macOS 10.14+ x86-64

pyhmmer-0.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-cp39-cp39-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pyhmmer-0.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-cp38-cp38-macosx_10_14_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

pyhmmer-0.4.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-cp37-cp37m-macosx_10_14_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

pyhmmer-0.4.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

pyhmmer-0.4.11-cp36-cp36m-macosx_10_14_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

Details for the file pyhmmer-0.4.11.tar.gz.

File metadata

  • Download URL: pyhmmer-0.4.11.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11.tar.gz
Algorithm Hash digest
SHA256 0066839b6c2b1e62662de7d4a9f5b6ed0cc1080ea55d64160b3902b52da6aa4b
MD5 a78acd1895747c4e0f4fb9cb8753fee8
BLAKE2b-256 65f31de70443d58ccf843aaaa01393d640452e26b60912c0998302a0b8fea021

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 27a468b4677de8b417cf2f20d47642bb36b80fec278d7705c20655b18fc49e01
MD5 afb7ca184d7da1954accdc2f315efe22
BLAKE2b-256 9f5f1fd5587437c9e6331fe7a1d85d11d1e7d71fd21e068d1f0800c30bd2d0ec

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-pp37-pypy37_pp73-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-pp37-pypy37_pp73-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: PyPy, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-pp37-pypy37_pp73-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b9e950de708765732f85d591ca831397ded19eebaea24a9e138817567dd72e49
MD5 5387f8f645b32d23aac116da708e41fd
BLAKE2b-256 61d7a415042ae43b7a13fbcd1a3295a8b8189029e7baeede92ab82ce597db36e

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-pp36-pypy36_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-pp36-pypy36_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8a0821522d661c7cd99fdc518a01812062439a4be05024cd20c2714ac407dc6f
MD5 8af0118635fe27ec747248d7b6c1b700
BLAKE2b-256 a087c0e6ce633d6649cae526c23260219fb911e2c3da891eb2485a5b6b8e6cb7

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b1a5eecc0cc7cf59c4335e579446e4518f7fe5a626f175dc1a9a6ae1a03e0b86
MD5 2b64db836ab52ff5f2fc2c576512c65b
BLAKE2b-256 4afc4919fc4e0f15c48c060ef04908af7e4576aff4a5aef06a7fe8876496716e

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-cp310-cp310-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 58952ebe50ba01a39696478618f0edc4dd989a4e02b155a5e2e7b2d32d17ab6d
MD5 6a3b3f3ade75ba9e9bd7e6c6e1b70dab
BLAKE2b-256 7075a01b9274d74aa22fb3d4e4df3677f9e0fd8d6d96aac7918af9e532feabb9

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2e4aff9fc80532ef350cc994062b0de01fce6bc0d4ea2a8bb2c1a0e5e83957c9
MD5 6fcc1692600e0dfb8a596356084af11e
BLAKE2b-256 a39102307afd6d26f1423cfd8f46dd4b070a7e4c84ad6d00524e5f86f22e5fab

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2c9175352bdb9135e7054935c5ec9e21f00a0cfd8fa40b4b392c5d238017713d
MD5 74dfeaeb3f3f6ca3dd0a437ef54c5505
BLAKE2b-256 f971f2d8518120e117fdb842d13e7714678c40692bf60bce01e54c883625a1f1

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 2c650f2164177f33954e43ec991b5fd58c284fa281790fa13cd0377a41b4d3c2
MD5 2d2d1a0af1f97114e8805ab194270f99
BLAKE2b-256 5c544cba0bf00660fb32bc4e76006a76b20eaa4f694f49f37994995c6b0a4e1e

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8e66941e03a053c16c424a1392e15f83bfdfb30f2e5c24278d948de28cc14594
MD5 40cd7eff8e47080431c86313dd43a71a
BLAKE2b-256 639bdc1fc0f379310382669aad49b6281cf3703f46662fc8d968b0b9ca0d7e8c

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f9a62e6511aeb65d74eb36aa914f6066031544769120c3010356596a4be3d3bb
MD5 0ea1c5a392ed4a712b4b865809af2d07
BLAKE2b-256 6230178be3d6c5dffe69cf886beff8302927e15d5ae2b92e9cef7f2f3fd0f43b

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7a24454c1bfab5578345cd36dfc814539cf5144d37132f4c544dc39307ba29f0
MD5 2b209bc1a31dcbc2369fcabea7ce444b
BLAKE2b-256 c03dc2ca1d16803049f2917027ff4b05dc7b635757829f9c7288114edd73516a

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyhmmer-0.4.11-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 abae5043e81e41c7e944b9ec063fc5c70bae7ac582f8a4436a409d4e73777cf1
MD5 52b4147f13951f43b886611bad476710
BLAKE2b-256 b4dd1f02cbf6cda0a82564cab00b63fba1904fc98be1db7c09e8eb2084b322d6

See more details on using hashes here.

Provenance

File details

Details for the file pyhmmer-0.4.11-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pyhmmer-0.4.11-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyhmmer-0.4.11-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ef2976891b46d04d99eb6f4acdcb2928b8b3c9e89777ef55fef4777526b491d2
MD5 469351db7cc57cbcc99dd02cc2713a94
BLAKE2b-256 76760ae3492a40179ac43d453b37b8a3d19bd58c3ca762013eca94aeb9592873

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page