This release is a pre-release and may not be stable for production use.
Approximate homology-aware splitting and diagnostics for peptide FASTA files
pip install cerberos-peptide-splitter Copy PIP instructions
A local, Python-based tool for approximate homology-aware splitting and descriptive diagnostics of peptide/protein FASTA datasets.
Cerberos reads a FASTA file, generates approximate sequence-similarity clusters, and assigns complete clusters to train, validation, and test splits. It can also describe an existing set of three splits. It is designed to help identify obvious near-duplicate leakage. It is not a substitute for a validated alignment-based homology search and does not guarantee leakage-free evaluation.
The package requires NumPy. Plotting is an optional Matplotlib extra. KS and Wasserstein descriptive distances are computed with NumPy and do not require SciPy. Cerberos runs locally and does not call external services or external sequence-search binaries.
Python 3.10 or later is supported. The PyPI distribution name is cerberos-peptide-splitter, the Python import name is cerberos_peptide_splitter, and the installed command is cerberos-peptide-splitter. This project has not yet been published to PyPI; install from a source checkout until the first release.
python -m pip install cerberos-peptide-splitter Optional plotting support:
git clone https://github.com/AI-Meat-Lab/cerberos.git cd cerberos python -m venv .venv # Linux/macOS: source .venv/bin/activate # Windows: .venv\Scripts\activate python -m pip install -e '.[dev]' Quick start Split one FASTA file using defaults:
cerberos-peptide-splitter split --input peptides.fasta --output-dir splits/ For a sensitivity-oriented reduced-alphabet pass followed by exact raw-sequence edit-distance verification:
cerberos-peptide-splitter audit --dir splits/ --output-dir audit/ Use python -m cerberos_peptide_splitter instead of cerberos-peptide-splitter if running from an unpacked source tree without installing the console entry point.
Records may be unlabeled or have a binary label as the final header field:
>peptide_1|1 KWKLFKKIEKVGQNIRDGIIK >peptide_2|0 MKTIIALSYIFCLVFA Rules:
split writes train.fasta, val.fasta, test.fasta, report.txt, stats.json, and, when Matplotlib is installed, a plots/ directory. audit reads FASTAs and writes only report, statistics, and plots; it does not overwrite the input FASTAs.
The audit command recognizes train.fasta/.fa/.faa, val.fasta/.fa/.faa or valid.fasta/.fa, and test.fasta/.fa/.faa.
stats.json contains the effective configuration, candidate-generation counts and limits for split runs, split sizes and label counts, length and feature summaries, sampled pairwise k-mer Jaccard summaries, empirical KS D statistics, Wasserstein distances, and heuristic warnings. Empty samples are represented with JSON null, never non-standard NaN literals.
For large files, reduce the search ceiling explicitly, for example with --max-candidate-pairs 100000. This bounds candidate-pair verification, but a smaller value increases the chance that related sequences are not grouped. Always check candidate_generation in stats.json and the warning in report.txt to see whether sampling or the cap affected a run.
Invalid CLI values and missing input files are reported as concise command-line errors. The process exits non-zero on failure.
from cerberos_peptide_splitter import RunConfig, parse_fasta, split_records records = parse_fasta("peptides.fasta") config = RunConfig( train_pct=0.8, val_pct=0.1, test_pct=0.1, kmer_sizes=[2, 3], reduced_alphabet="groups5", verify_with="levenshtein", similarity_threshold=0.8, prefilter_threshold=0.3, seed=42, ) splits = split_records(records, config, verbose=False) print({name: len(items) for name, items in splits.items()}) Top-level exports also include write_fasta, assign_clusters, stratified_random_split, summarize, build_report, run_split, and run_audit. Lower-level modules expose the reduced-alphabet, k-mer, MinHash, and edit-distance helpers.
python -m pip install -e '.[dev]' pytest -q pytest -q -m 'not optional' # NumPy-only CI subset ruff check cerberos_peptide_splitter tests ruff format --check cerberos_peptide_splitter tests black --check cerberos_peptide_splitter tests isort --check-only cerberos_peptide_splitter tests mypy cerberos_peptide_splitter --ignore-missing-imports --no-strict-optional python -m build python -m twine check dist/* GitHub Actions checks a NumPy-only test path and a full-dependency test path across Ubuntu, macOS, and Windows. It exercises all 3 × 3 alphabet/verifier combinations, runs CLI and reproducibility smoke tests, builds distributions, and runs formatting, lint, and type checks. CI results, not this README, are the source of truth for currently passing environments.
The release workflow publishes through PyPI Trusted Publishing (OIDC). Before the first release, configure the PyPI project cerberos-peptide-splitter with a trusted publisher for the GitHub repository AI-Meat-Lab/cerberos and workflow .github/workflows/release.yml. Releases use v* tags and fail unless the tag exactly matches project.version in pyproject.toml.
MIT licensed; see LICENSE. Report issues or contribute through the GitHub repository, issue tracker, and pull requests.
peptides fasta train-test-split minhash lsh out-of-distribution ood bioinformatics antimicrobial-peptides
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




