Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

SpecClust

SpecClust embeds MS/MS spectra with a conditional transformer autoencoder and clusters the latent space to discover candidate novel ("dark proteome") peptides. Spectra are conditioned on precursor m/z, charge, and ion mobility, so same-peptide spectra land close together in latent space.

The trained model is large (~650 MB), so it is not shipped on PyPI. The pip package contains the code; the weights are hosted externally and downloaded + cached on first use. Because embedding only needs the encoder, the default download is encoder-only — roughly half the full model.

Installation

pip install specclust                 # core: load model, embed, cluster
pip install "specclust[hdbscan]"      # add HDBSCAN clustering
pip install "specclust[viz]"          # add plotting (matplotlib, umap)
pip install "specclust[mzml]"         # add pyteomics for mzML
pip install "specclust[train]"        # everything needed to retrain

TensorFlow is a core dependency (the encoder needs it) but is imported lazily — import specclust does not load TensorFlow until you actually build or load a model.

Getting the weights

load_encoder() resolves the model files in this order:

  1. SPECCLUST_MODEL_DIR — set this to a folder holding the weights (handy on an HPC node where you already have them):
   export SPECCLUST_MODEL_DIR=/path/to/weights
  1. the local cache (downloaded once, then reused);
  2. download from the GitHub release (the URLs are configured in specclust.modelhub.REGISTRY).

With no setup, option 3 runs automatically on first use. You can also bypass the registry with explicit local paths:

from specclust import load_encoder
encoder = load_encoder(weights="encoder.weights.h5", config="encoder_config.json")

Quick start

import numpy as np
from specclust import load_encoder, embed_raw_spectra, cluster_latents, score_clusters

encoder = load_encoder()  # downloads/caches the encoder on first call

# raw peak lists + precursor info (lists aligned by index)
latents = embed_raw_spectra(
    encoder,
    mz_list, intensity_list,
    precursor_mz, charge, ion_mobility,
)

labels, info = cluster_latents(latents, method="hdbscan", min_cluster_size=5)
scores = score_clusters(latents, labels)
print(info["n_clusters"], "clusters")

Command line:

specclust embed   -i parquet_dir/ -o latents.npy
specclust cluster -i latents.npy  -o clusters/ --method hdbscan

Repository layout

src/specclust/      installable package (model, embed, cluster, consensus, CLI)
training/           NOT installed: HPC data-prep, training, and export scripts
  export_encoder.py   run once to create the slim encoder assets to publish
  reference/          the original monolithic scripts, kept verbatim
tests/              run without TensorFlow or weights (model tests auto-skip)

Citation

Publication Pending!

Vilenne, Frédérique & Valkenborg Dirk. Clustering the Dark Proteome: A Deep Learning Approach to Novel Peptide Discovery in Immunopeptidomics (2026)

License

MIT © 2026 Frédérique Vilenne, Dirk Valkenborg

Metadata

Release files for specclust 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for specclust 0.1.1
File Size Uploaded
specclust-0.1.1.tar.gz 51.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for specclust 0.1.1
File Interpreter ABI Platform
specclust-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 72.1 kB

Release files / specclust-0.1.1.tar.gz

Download URL specclust-0.1.1.tar.gz
Size 51.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9e8cab54177223846f1136a65670a53f8dbc21487bf926cc3ff8c89cf9274fe
BLAKE2b-256 checksum
How to use checksums
6935492af02563b41cc507a43fc36635336f522d661b032e596b436821428e51
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 Jun 2, 2026.

Transparency log

Release files / specclust-0.1.1-py3-none-any.whl

Download URL specclust-0.1.1-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e89ca49f040111b7b839f07c37726eaf568de16fa642cc2b3dae834495a76948
BLAKE2b-256 checksum
How to use checksums
fad78f300bc4f06c8642586e568ad5baca0cf9e750599ab812c4f8c7dfec4702
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 Jun 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page