pyhmmer provides high-performance Cython bindings and a Pythonic interface to the HMMER3 C library, enabling powerful sequence analysis using Hidden Markov Models. It is used for searching protein and nucleic acid sequence databases, identifying remote homologs, and building profile HMMs. The current stable version is 0.12.0, with a release cadence of several minor versions per year, indicating active development.
pip install pyhmmerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a simple HMM from a sequence, define target sequences, and perform a basic HMMER search using `pyhmmer.pipeliner.Pipeline`. It then iterates through the search results to display hits and their associated domains. Note that sequence names and data must be bytes.
Ensure you have a C compiler and build essentials installed (e.g., `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS). For more robust HMMER3 dependency management, especially on Windows or complex environments, consider installing `pyhmmer` via Bioconda (`conda install -c bioconda pyhmmer`). If HMMER3 is installed manually, set the `HMMER_DIR` environment variable to its installation prefix before building pyhmmer.
Always review the changelog and migration guides (if available) when upgrading `pyhmmer` across minor versions. Test your code thoroughly after any upgrade. Pin your `pyhmmer` version in `requirements.txt` to avoid unexpected breakage in production environments.
Monitor memory usage for your specific workloads. For very large datasets, consider processing sequences in batches rather than loading everything into memory at once. Ensure `pyhmmer.pipeliner.Pipeline` and other resource-heavy objects are properly scoped (e.g., within functions or with explicit `del` if not garbage collected quickly enough) to allow for memory cleanup.
Explicitly define and pass the correct `Alphabet` (e.g., `Alphabet.amino()`, `Alphabet.dna()`) to all relevant `pyhmmer` objects, ensuring consistency. Always encode sequence data and names to `bytes` before passing them to `pyhmmer.easel.Sequence` or similar constructors.
Access the required information directly from the `Hit` object within `TopHits` by iterating or indexing, for example, `top_hits[0].name` or `hit.name` after iterating through `top_hits`.
Install pyhmmer within a Windows Subsystem for Linux (WSL) environment, use a Linux virtual machine, or a Docker container.
Ensure the file path is correct, the file exists, and its content is in a supported HMMER3 or sequence format (e.g., FASTA for sequences, HMM for HMM profiles). Check for file corruption and specify the file format explicitly if the automatic detection fails.
Ensure that the alphabet of the HMM matches the alphabet of the sequences you are providing. You may need to specify the correct alphabet when creating or loading `pyhmmer.easel.Alphabet` objects.
Iterate over the generator to process each `TopHits` object, or convert the generator to a list if all results are needed in memory (e.g., `list(pyhmmer.hmmer.hmmsearch(hmms, seqs))`).
No dependency data recorded yet.