Skip to main content

ssrmsd

Self-consistency RMSD (ssRMSD) scoring for predicted antibody–antigen structure ensembles.

ssrmsd scores single or batched ensembles across heterogeneous structure predictors (e.g., AlphaFold3 .cif/.tar.gz/.zip mixed with ESMFold2 .pdb predictions), matching chains by sequence and computing both size-normalized upper-triangle metrics and legacy 5-sample AF3 parity metrics.

Features

  • Format & archive agnostic: reads .cif, .mmcif, .pdb, .ent (plain or .gz), plus .tar.gz/.tgz/.tar and .zip archives directly in memory with zero temp-file extraction.
  • AF3-aware discovery: auto-detects seed-*_sample-* subdirectories and excludes local AF3's duplicate top-level <job>_model.cif (override with --include-top-level or --glob).
  • Cross-model chain & residue matching: matches chains by overlap sequence identity via gemmi, splits ESMFold-style poly-G linkers (G{10,}), aligns shared Cα atoms across the entire ensemble, and guards against silent truncation or ambiguous homomer matching.
  • Flexible superposition: full-complex global Cα Kabsch by default, plus optional --align-chains / --score-chains (e.g., superpose on antigen, measure RMSD on antibody).
  • Comparable + legacy metrics: emits size-normalized metrics (mean_sq_rmsd, rms_rmsd, mean_rmsd, median_rmsd, rmsd_sd), legacy AF3 parity columns (ssRMSD, SD), and optional within-source vs. cross-source breakdowns.

Installation

Python 3.11+ (CPU-only; gemmi, numpy, and typer):

pip install ssRMSD

For local development:

pip install -e ".[dev]"
pytest

CLI Usage

Score a single ensemble

# Local AF3 job directory or archived .tar.gz / AlphaFold Server .zip
ssrmsd score /path/to/mab1_af3/
ssrmsd score /path/to/mab1.tar.gz

# Combine AF3 + ESMFold2 predictions into one ensemble, aligning on antigen (A) and scoring Fv (B,C)
ssrmsd score af3=af3_mab1.tar.gz esmfold=esm_mab1/ \
  --align-chains A --score-chains B,C \
  --pairwise-out pairs.csv -o score.csv

Score a batch of ensembles

# Join multiple predictor roots by matching subfolder/archive name (or flat <mab>_model_<k> files)
ssrmsd batch \
  --dir af3=/data/af3_runs \
  --dir esmfold=/data/esm_runs \
  --join intersection \
  --workers 16 \
  -o scores.csv

# Arbitrary paths/sources via CSV or TSV manifest (columns: ensemble_id,path[,source])
ssrmsd batch --manifest ensembles.csv --workers 16 --format jsonl -o scores.jsonl

Output Columns

Column Description
ensemble_id Ensemble identifier
n_structures Number of structures $n$ in the ensemble
n_ca_align Common Cα atoms used for Kabsch superposition
n_ca_score Common Cα atoms measured in RMSD
mean_sq_rmsd Size-normalized ssRMSD: $\frac{1}{\binom{n}{2}} \sum_{i<j} d_{ij}^2 = \frac{\text{ssRMSD}}{n(n-1)}$ ($\text{Å}^2$)
rms_rmsd Root-mean-square pairwise RMSD: $\sqrt{\text{mean_sq_rmsd}}$ (Å)
mean_rmsd Mean upper-triangle pairwise RMSD (Å)
median_rmsd Median upper-triangle pairwise RMSD (Å)
rmsd_sd Population SD (ddof=0) of upper-triangle pairwise RMSDs (Å)
ssRMSD Legacy parity: $\sum_{i,j} M_{ij}^2 = 2\sum_{i<j} d_{ij}^2$
SD Legacy parity: np.std(M, ddof=0) over all $n^2$ entries including diagonal
within_source_mean_rmsd Mean pairwise RMSD for pairs from the same source (multi-source only)
cross_source_mean_rmsd Mean pairwise RMSD for pairs from different sources (multi-source only)
sources Per-source counts, e.g. af3:5,esmfold:3
status ok or error
error Diagnostic message when status=error

Python API

from pathlib import Path
from ssrmsd import ScoringOptions, StructureInput, score_ensemble

result = score_ensemble(
    [
        StructureInput(Path("af3_mab1.tar.gz"), source="af3"),
        StructureInput(Path("esm_mab1/"), source="esmfold"),
    ],
    ensemble_id="mab1",
    options=ScoringOptions(align_chains=("A",), score_chains=("B", "C")),
    include_pairwise=True,
)
print(result.rms_rmsd, result.ssRMSD, result.cross_source_mean_rmsd)

brineylab/toolshed Integration

To package ssrmsd as a CPU-only tool in brineylab/toolshed (tools/ssrmsd/):

Containerfile (no ENTRYPOINT; ssrmsd on PATH):

FROM python:3.12-slim
RUN pip install --no-cache-dir "git+https://github.com/brineylab/ssrmsd.git@v0.1.0"

Run locally with Podman or on Slurm with Pyxis:

podman run --rm -v "$PWD":/work -w /work \
  ghcr.io/brineylab/toolshed/ssrmsd:0.1.0 \
  ssrmsd batch --dir af3=af3_runs --dir esmfold=esm_runs -o scores.csv

License

MIT.

Metadata

Release files for ssRMSD 0.1.0

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

Source distribution (sdist)

Source distribution for ssRMSD 0.1.0
File Size Uploaded Provenance Actions
ssrmsd-0.1.0.tar.gz 49.6 kB With provenance Details for ssrmsd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ssRMSD 0.1.0
File Interpreter ABI Platform Actions
ssrmsd-0.1.0-py3-none-any.whl Python 3 none any Details for ssrmsd-0.1.0-py3-none-any.whl

Total release size: 70.5 kB

Release files / ssrmsd-0.1.0.tar.gz

Download URL ssrmsd-0.1.0.tar.gz
Size 49.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5bc98c16e9f8675200b167fd5538eeedac67026508cc9b318a49f2ffa5cde254
BLAKE2b-256 checksum
How to use checksums
30a25dbbd30ec022576b0fb45300fe5b21979eb3b18f4c9ef898d6ebe76f11bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / ssrmsd-0.1.0-py3-none-any.whl

Download URL ssrmsd-0.1.0-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb925b3f8bcdb27363a23a8010c3bd66f43a11b74570897fa6c4eee37e4b0194
BLAKE2b-256 checksum
How to use checksums
cf1a0a85b35d28a24801b3b6824a3e0e10e5d324c0fe705550548da131fd74fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for ssRMSD 0.1.0

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.

Select from 2 files

Attestation for ssrmsd-0.1.0.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 Nov 24, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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