PyMMseqs is a powerful Python wrapper for MMseqs2. It seamlessly integrates MMseqs2’s advanced functionality into your Python workflows, allowing you to effortlessly execute MMseqs2 commands and parse their outputs into convenient Python objects for further analysis. Whether you're clustering sequences, searching databases, or analyzing large-scale biological data, PyMMseqs simplifies the process while maintaining the performance and flexibility of MMseqs2.
Want to see the power of PyMMseqs in action?
Try our quick tour on Google Colab and experience the full power of PyMMseqs, all in just 5 minutes!
Ready to dive in?
- Seamless Integration: Execute MMseqs2 commands directly within your Python code, eliminating the need for shell scripting or external command-line tools.
- Output Parsing: Convert MMseqs2 outputs into Python objects (e.g., Pandas DataFrame, generators, dictionaries) for easy manipulation and analysis.
- High Performance: Leverage the speed and efficiency of MMseqs2 while enjoying the flexibility of Python.
- Cross-Platform: Use PyMMseqs via pip or Docker, ensuring compatibility across different environments. PyMMseqs works seamlessly on Linux and macOS.
Note: Windows users should either use Windows Subsystem for Linux (WSL) or Docker to run PyMMseqs.
PyMMseqs can be installed in two ways: via pip (recommended for most users) or using a Docker image (ideal for reproducible environments).
The pymmseqs package is currently available on PyPI. To install it, use the following command:
pip install pymmseqsFor users who prefer not to install PyMMseqs locally or want a pre-configured environment, a Docker image is available on GitHub Container Registry (GHCR).
To pull the Debian-based Docker image, run:
docker pull ghcr.io/heispv/pymmseqs:latest-debianNote: If you want to use a specific version of PyMMseqs, you can replace
latestwith the desired version.
Tip: Using Docker ensures that all dependencies, including MMseqs2, are pre-installed and configured, making it ideal for reproducible workflows.
Here's a simple example to get you started with PyMMseqs. This example demonstrates how to perform sequence clustering and parse the results.
If you were using MMseqs2 directly in the terminal, you would run the following command to cluster sequences:
mmseqs easy-cluster human.fasta human_clust tmp --min-seq-id 0.9With PyMMseqs, you can achieve the same result directly in Python, and parse the output to Python objects for further analysis.
from pymmseqs.commands import easy_cluster
# Perform clustering on a FASTA file (equivalent to the terminal command above)
human_cluster = easy_cluster("human.fasta", "human_clust", "tmp", min_seq_id=0.9)
# Get results as a Python generator for easy processing
cluster_gen = human_cluster.to_gen()
# Let's get the representative sequence of a cluster with more than 100 members
for cluster in cluster_gen:
if len(cluster["members"]) > 100:
print(f"Representative sequence of a large cluster: {cluster['rep']}")
breakFor detailed usage instructions, advanced examples, and API references, please visit the PyMMseqs Wiki.
To use PyMMseqs, you only need:
- Python: Version 3.10 or higher.
Note: All other dependencies, including MMseqs2, are automatically installed when you install
pymmseqsvia pip or use the Docker image.
We'd love your contributions to PyMMseqs! Simply fork, branch, commit, push, and open a PR.
For bug reports, feature requests, or questions, please open an issue on the GitHub Issues page.
PyMMseqs is licensed under the MIT License.
If you find PyMMseqs useful, please consider giving the repository a star on GitHub! ⭐
It helps others discover the project and motivates further development.
For questions, feedback, or support, feel free to open an issue or contact the maintainers.