Docs · Report Bug · Request Feature
ClustKIT is a bioinformatics tool for protein sequence clustering. It combines MinHash sketching, locality-sensitive hashing (LSH), banded Smith-Waterman alignment with BLOSUM62 scoring, and Leiden community detection to achieve high clustering accuracy at all identity thresholds, including the challenging low-identity regime (30-50%) where greedy heuristic methods lose sensitivity.
Features
- Accurate at low identity: Smith-Waterman alignment with BLOSUM62 scoring and Leiden graph partitioning produce well-connected clusters, especially at thresholds below 50%
- Fast: Multi-stage filtering (LSH + Jaccard pre-filter + length-ratio filter) eliminates >98% of candidate pairs before alignment
- Scalable: C/OpenMP alignment kernel with configurable thread count; optional GPU acceleration via CuPy
- Flexible clustering: Leiden community detection (default), connected components, or greedy
Installation
pip install clustkit
With GPU acceleration (requires CUDA 12.x):
pip install clustkit[gpu]
From source:
git clone https://github.com/JLSteenwyk/ClustKIT.git
cd ClustKIT
pip install -e ".[dev]"
Quick start
# Cluster proteins at 50% identity using 8 threads
clustkit -i proteins.fasta -o output/ -t 0.5 --threads 8
# Use connected components instead of Leiden
clustkit -i proteins.fasta -o output/ -t 0.7 --cluster-method connected --threads 4
# GPU-accelerated alignment
clustkit -i proteins.fasta -o output/ -t 0.3 --device 0 --threads 8
Output files:
output/clusters.tsv— Cluster assignments (sequence_id, cluster_id, is_representative)output/representatives.fasta— Representative sequencesoutput/run_info.json— Run parameters and statisticsoutput/cluster_size_distribution.png— Size distribution plot (with--plot)
Pipeline overview
ClustKIT clusters sequences through six phases:
- Read — Parse FASTA/FASTQ, integer-encode sequences
- Sketch — MinHash bottom-s sketches with adaptive k-mer size
- LSH — Locality-sensitive hashing to find candidate pairs
- Align — Banded Smith-Waterman with BLOSUM62 scoring, affine gap penalties, length-ratio and Jaccard pre-filters
- Graph — Sparse similarity graph construction
- Cluster — Leiden community detection (default), connected components, or greedy
CLI reference
clustkit Cluster sequences by identity threshold
Options
| Option | Description | Default |
|---|---|---|
-i, --input |
Input FASTA/FASTQ file | required |
-o, --output |
Output directory | required |
-t, --threshold |
Identity threshold (0.0-1.0) | 0.9 |
--threads |
Number of CPU threads | 1 |
--device |
cpu, auto, or GPU device ID (e.g., 0) |
cpu |
--cluster-method |
leiden (default), connected, or greedy |
leiden |
--alignment |
align (SW, accurate) or kmer (fast) |
align |
--clustering-mode |
Presets: balanced, accurate, or fast |
balanced |
--sensitivity |
LSH sensitivity: low, medium, high |
per mode |
--sketch-size |
MinHash sketch size | 128 |
-k, --kmer-size |
K-mer size for sketching | 5 |
--representative |
longest, centroid, or most_connected |
longest |
--format |
Output format: tsv or cdhit |
tsv |
--plot |
Generate cluster size distribution plot | off |
Dependencies
Core (installed automatically):
| Package | Purpose |
|---|---|
| numpy | Array operations |
| numba | JIT-compiled fallback kernels |
| biopython | FASTA/FASTQ parsing |
| scipy | Sparse graph, connected components |
| leidenalg | Leiden community detection |
| python-igraph | Graph representation for Leiden |
| typer + rich | CLI framework |
| matplotlib + pypubfigs | Cluster size distribution plot (--plot) |
Optional:
| Package | Install | Purpose |
|---|---|---|
| cupy-cuda12x | pip install clustkit[gpu] |
GPU-accelerated Smith-Waterman alignment |
License
MIT License. See LICENSE for details.
Metadata
Release files for clustkit 0.1.2
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 |
|---|---|---|---|---|
| clustkit-0.1.2.tar.gz | 77.0 kB | Without provenance | Details for clustkit-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clustkit-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for clustkit-0.1.2-py2.py3-none-any.whl |
Total release size: 151.9 kB
Release files / clustkit-0.1.2.tar.gz
| Download URL | clustkit-0.1.2.tar.gz |
|---|---|
| Size | 77.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33c8afe6471b3fa2b3195bfc80878365edfb59f104e903c6b6df3e87ae656d72
|
|
BLAKE2b-256 checksum How to use checksums |
cd3e45ca940a3ed672d6344d9164e8a22359f41b5cc8d51cd1d948cf417d7ac5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.13
|
Release files / clustkit-0.1.2-py2.py3-none-any.whl
| Download URL | clustkit-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 74.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c68b8b3978f3fdbb2287e30f92d35dbcb4b9ea07224fddbcda50a0ea06ce12ef
|
|
BLAKE2b-256 checksum How to use checksums |
0c588ea549bc676d29f0e86f1a8f1556ca97b03844eb62ea713e71b97fc9c648
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.13
|
Security for clustkit 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.