clustrX: Highly Robust and Sensitive Protein Clustering
clustrX is a high-performance framework designed to transform sequence similarity search results into biologically coherent protein families. By modeling homology as a weighted mathematical network and applying the Leiden community detection algorithm, clustrX provides a sensitive and robust solution for clustering sequences, especially in complex scenarios involving remote homology and short peptides.
🚀 Key Features
- Leiden Community Detection: Beyond simple links,
clustrXidentifies densely connected communities, ensuring high internal cohesion and preventing artificial family merging (e.g., due to domain bridges). - Agnostic Input: Works with results from BLAST, Diamond, MMseqs2, and HMMER. Or others using the custom input option.
- Dynamic Coverage Filter: Our recommended approach to handle sequences of varying lengths to obtain the most reliable and biologically sound results.
- Ultra-Fast Performance: Powered by
Polars(Rust-based) for data processing andigraph(C-based) for network analysis. - Integrated Workflow: From similarity hits to Multiple Sequence Alignments (MSAs) in a single command.
📦 Installation
You can install clustrX using two main methods. Note the difference in dependency management:
Option A: Via Conda (Recommended)
This is the easiest way as it automatically installs all external dependencies, including MAFFT for alignments.
conda install -c bioconda clustrx
Option B: Via Pip (Using a Virtual Environment)
To avoid conflicts with other packages and ensure the clustrx command is correctly recognized by your system (avoiding PATH issues), we highly recommend using a virtual environment:
- Create a new environment:
python -m venv clustrx_env
- Activate it:
- Windows:
clustrx_env\Scripts\activate - Linux/macOS:
source clustrx_env/bin/activate
- Windows:
- Install:
pip install clustrX
Note: If you use Pip, remember that you must install MAFFT manually on your system if you plan to use the --mafft option.
⚙️ Input Formats & Requirements
clustrX is designed to be a post-processing layer. It requires two main inputs:
- Similarity Hits: A tabular file (BLAST-like or HMMER).
- Sequences: A FASTA file containing the sequences referenced in the hits.
Using BLAST
clustrX works natively with the default tabular output of BLAST (-outfmt 6).
blastp -query sequences.fasta -db database -out hits.tsv -outfmt 6
Using Diamond or MMseqs2
If you use these tools, you must ensure the output is in BLAST tabular format (outfmt 6):
- Diamond:
diamond blastp -q query.fasta -d db.dmnd -o hits.tsv --outfmt 6
- MMseqs2:
mmseqs easy-search query.fasta target.fasta hits.tsv tmp --format-mode 0
Using HMMER
HMMER outputs require specific flags depending on the filtering level you need:
domtblout(Recommended): Use the--domtbloutflag inhmmsearchorphmmer. This format provides alignment coordinates, which are required for using the Dynamic Coverage filter.hmmsearch --domtblout hits.domtblout profile.hmm database.fasta
tblout: Use the--tbloutflag. Note that this format lacks coordinate information; therefore, Dynamic Coverage cannot be applied (only E-value and Bitscore filters will be used).hmmsearch --tblout hits.tblout profile.hmm database.fasta
🧬 The Power of Dynamic Coverage
We strongly recommend using the Dynamic Coverage mode (--coverage dynamic) for most scientific applications. For more information about this, please, read the paper.
Standard clustering methods often use fixed thresholds that fail to resolve relationships between sequences of very different sizes. Our dynamic filter uses a hyperbolic decay function (calibrated with a 50-residue scale factor) that:
- Increases stringency for short peptides (up to 0.8 coverage) to filter out statistical noise.
- Gradually relaxes for larger proteins (down to 0.4 coverage) to maximize sensitivity in detecting remote homology.
🛠️ Workflow & Usage
The clustrX pipeline follows a clear 3-step logic:
- Filter: Hits are filtered based on E-value, Bitscore, and (recommended) Dynamic Coverage.
- Cluster: A similarity network is built where edges are weighted by Bitscore, then partitioned using Leiden algorithm.
- Output: Results are exported. Note: Fasta generation and alignments are optional.
Example: Recommended Scientific Run
clustrx -i hits.tsv -f sequences.fasta --coverage dynamic --write-fasta --mafft --outdir results_full
--write-fasta: (Optional) Creates a FASTA file for each generated cluster.--mafft: (Optional) Automatically performs Multiple Sequence Alignment for each cluster.
💡 Use Cases
- Protein Family Discovery: Organizing large proteomes into evolutionarily related groups.
- Short Peptide Classification: Specifically tuned for the discovery of Antimicrobial Peptides (AMPs), toxins, signaling peptides or others.
- Remote Homology Exploration: Identifying relationships in the "twilight zone" (identity < 30%) where traditional greedy methods fragment families.
- Domain-Aware Clustering: Using HMMER
domtbloutinputs to cluster sequences based on specific functional domains.
📝 Citation
If you use clustrX in your research, please cite:
Benítez-Prián, M. & San Mauro, D. (2026). clustrX: Highly Robust and Sensitive Protein Clustering Using Similarity Networks and Leiden Community Detection.
👤 Authors
Mario Benítez-Prián & Diego San Mauro
Contact: mario.benitezprian@gmail.com | GitHub
Metadata
Release files for clustrX 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clustrx-1.0.1.tar.gz | 16.8 kB | With provenance | Details for clustrx-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clustrx-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for clustrx-1.0.1-py3-none-any.whl |
Total release size: 30.0 kB
Release files / clustrx-1.0.1.tar.gz
| Download URL | clustrx-1.0.1.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd7e882fe6dbe4b79bd0d183d4b2c58d72e86c689b6fae5476a7d8862be05400
|
|
BLAKE2b-256 checksum How to use checksums |
5ed723aa25d7128927da6142265d7dc258b590f9d6f94a226942a54d2c7ea749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logRelease files / clustrx-1.0.1-py3-none-any.whl
| Download URL | clustrx-1.0.1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
647eb10c0d911132d49c3c8e27092488629d45ac4b87b598515b93ca2520d928
|
|
BLAKE2b-256 checksum How to use checksums |
f4b27a50b267744a783f36323128b8818effd880ae0fbf9e97263bd9e9c2a17c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logSecurity for clustrX 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for clustrx-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.