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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specclust-0.1.1.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specclust-0.1.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file specclust-0.1.1.tar.gz.

File metadata

  • Download URL: specclust-0.1.1.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for specclust-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f9e8cab54177223846f1136a65670a53f8dbc21487bf926cc3ff8c89cf9274fe
MD5 8e37d8111ce91732572f85c075e4b4b3
BLAKE2b-256 6935492af02563b41cc507a43fc36635336f522d661b032e596b436821428e51

See more details on using hashes here.

Provenance

The following attestation bundles were made for specclust-0.1.1.tar.gz:

Publisher: publish.yml on VilenneFrederique/specclust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file specclust-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: specclust-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for specclust-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e89ca49f040111b7b839f07c37726eaf568de16fa642cc2b3dae834495a76948
MD5 69df9f4706e40d198e860e4524282800
BLAKE2b-256 fad78f300bc4f06c8642586e568ad5baca0cf9e750599ab812c4f8c7dfec4702

See more details on using hashes here.

Provenance

The following attestation bundles were made for specclust-0.1.1-py3-none-any.whl:

Publisher: publish.yml on VilenneFrederique/specclust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page