ssRMSD 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ssrmsd-0.1.0/.github/workflows/ci.yaml +37 -0
- ssrmsd-0.1.0/.github/workflows/python-publish.yaml +31 -0
- ssrmsd-0.1.0/.gitignore +207 -0
- ssrmsd-0.1.0/LICENSE +21 -0
- ssrmsd-0.1.0/PKG-INFO +144 -0
- ssrmsd-0.1.0/README.md +118 -0
- ssrmsd-0.1.0/docs/superpowers/plans/2026-11-24-ssrmsd-rewrite.md +424 -0
- ssrmsd-0.1.0/docs/superpowers/specs/2026-11-24-ssrmsd-rewrite-design.md +212 -0
- ssrmsd-0.1.0/pyproject.toml +59 -0
- ssrmsd-0.1.0/src/ssrmsd/__init__.py +26 -0
- ssrmsd-0.1.0/src/ssrmsd/align.py +350 -0
- ssrmsd-0.1.0/src/ssrmsd/cli.py +338 -0
- ssrmsd-0.1.0/src/ssrmsd/format.py +128 -0
- ssrmsd-0.1.0/src/ssrmsd/io.py +422 -0
- ssrmsd-0.1.0/src/ssrmsd/kabsch.py +149 -0
- ssrmsd-0.1.0/src/ssrmsd/score.py +154 -0
- ssrmsd-0.1.0/src/ssrmsd/types.py +126 -0
- ssrmsd-0.1.0/tests/conftest.py +265 -0
- ssrmsd-0.1.0/tests/test_align.py +211 -0
- ssrmsd-0.1.0/tests/test_cli.py +225 -0
- ssrmsd-0.1.0/tests/test_io.py +272 -0
- ssrmsd-0.1.0/tests/test_kabsch.py +207 -0
- ssrmsd-0.1.0/tests/test_score.py +157 -0
- ssrmsd-0.1.0/tests/test_types.py +63 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v5
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: ruff check src/ tests/
|
|
29
|
+
|
|
30
|
+
- name: Format check
|
|
31
|
+
run: ruff format --check src/ tests/
|
|
32
|
+
|
|
33
|
+
- name: Type check
|
|
34
|
+
run: ty check src/
|
|
35
|
+
|
|
36
|
+
- name: Test
|
|
37
|
+
run: python -m pytest -v
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v5
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
|
|
24
|
+
- name: Install build tools
|
|
25
|
+
run: pip install build
|
|
26
|
+
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: python -m build
|
|
29
|
+
|
|
30
|
+
- name: Publish to PyPI
|
|
31
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
ssrmsd-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
ssrmsd-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 brineylab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ssrmsd-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ssRMSD
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Self-consistency RMSD (ssRMSD) scoring for predicted antibody-antigen structure ensembles.
|
|
5
|
+
Project-URL: Homepage, https://github.com/brineylab/ssrmsd
|
|
6
|
+
Project-URL: Repository, https://github.com/brineylab/ssrmsd
|
|
7
|
+
Project-URL: Issues, https://github.com/brineylab/ssrmsd/issues
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: gemmi>=0.6.5
|
|
19
|
+
Requires-Dist: numpy>=1.26
|
|
20
|
+
Requires-Dist: typer>=0.12
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
24
|
+
Requires-Dist: ty==0.0.40; extra == 'dev'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# ssrmsd
|
|
28
|
+
|
|
29
|
+
Self-consistency RMSD (`ssRMSD`) scoring for predicted antibody–antigen structure ensembles.
|
|
30
|
+
|
|
31
|
+
`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.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **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.
|
|
36
|
+
- **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`).
|
|
37
|
+
- **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.
|
|
38
|
+
- **Flexible superposition:** full-complex global Cα Kabsch by default, plus optional `--align-chains` / `--score-chains` (e.g., superpose on antigen, measure RMSD on antibody).
|
|
39
|
+
- **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.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
Python 3.11+ (CPU-only; `gemmi`, `numpy`, and `typer`):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install ssRMSD
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For local development:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install -e ".[dev]"
|
|
53
|
+
pytest
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## CLI Usage
|
|
57
|
+
|
|
58
|
+
### Score a single ensemble
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Local AF3 job directory or archived .tar.gz / AlphaFold Server .zip
|
|
62
|
+
ssrmsd score /path/to/mab1_af3/
|
|
63
|
+
ssrmsd score /path/to/mab1.tar.gz
|
|
64
|
+
|
|
65
|
+
# Combine AF3 + ESMFold2 predictions into one ensemble, aligning on antigen (A) and scoring Fv (B,C)
|
|
66
|
+
ssrmsd score af3=af3_mab1.tar.gz esmfold=esm_mab1/ \
|
|
67
|
+
--align-chains A --score-chains B,C \
|
|
68
|
+
--pairwise-out pairs.csv -o score.csv
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Score a batch of ensembles
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Join multiple predictor roots by matching subfolder/archive name (or flat <mab>_model_<k> files)
|
|
75
|
+
ssrmsd batch \
|
|
76
|
+
--dir af3=/data/af3_runs \
|
|
77
|
+
--dir esmfold=/data/esm_runs \
|
|
78
|
+
--join intersection \
|
|
79
|
+
--workers 16 \
|
|
80
|
+
-o scores.csv
|
|
81
|
+
|
|
82
|
+
# Arbitrary paths/sources via CSV or TSV manifest (columns: ensemble_id,path[,source])
|
|
83
|
+
ssrmsd batch --manifest ensembles.csv --workers 16 --format jsonl -o scores.jsonl
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Output Columns
|
|
87
|
+
|
|
88
|
+
| Column | Description |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `ensemble_id` | Ensemble identifier |
|
|
91
|
+
| `n_structures` | Number of structures $n$ in the ensemble |
|
|
92
|
+
| `n_ca_align` | Common Cα atoms used for Kabsch superposition |
|
|
93
|
+
| `n_ca_score` | Common Cα atoms measured in RMSD |
|
|
94
|
+
| `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$) |
|
|
95
|
+
| `rms_rmsd` | Root-mean-square pairwise RMSD: $\sqrt{\text{mean\_sq\_rmsd}}$ (Å) |
|
|
96
|
+
| `mean_rmsd` | Mean upper-triangle pairwise RMSD (Å) |
|
|
97
|
+
| `median_rmsd` | Median upper-triangle pairwise RMSD (Å) |
|
|
98
|
+
| `rmsd_sd` | Population SD (`ddof=0`) of upper-triangle pairwise RMSDs (Å) |
|
|
99
|
+
| `ssRMSD` | Legacy parity: $\sum_{i,j} M_{ij}^2 = 2\sum_{i<j} d_{ij}^2$ |
|
|
100
|
+
| `SD` | Legacy parity: `np.std(M, ddof=0)` over all $n^2$ entries including diagonal |
|
|
101
|
+
| `within_source_mean_rmsd` | Mean pairwise RMSD for pairs from the same source (multi-source only) |
|
|
102
|
+
| `cross_source_mean_rmsd` | Mean pairwise RMSD for pairs from different sources (multi-source only) |
|
|
103
|
+
| `sources` | Per-source counts, e.g. `af3:5,esmfold:3` |
|
|
104
|
+
| `status` | `ok` or `error` |
|
|
105
|
+
| `error` | Diagnostic message when `status=error` |
|
|
106
|
+
|
|
107
|
+
## Python API
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from pathlib import Path
|
|
111
|
+
from ssrmsd import ScoringOptions, StructureInput, score_ensemble
|
|
112
|
+
|
|
113
|
+
result = score_ensemble(
|
|
114
|
+
[
|
|
115
|
+
StructureInput(Path("af3_mab1.tar.gz"), source="af3"),
|
|
116
|
+
StructureInput(Path("esm_mab1/"), source="esmfold"),
|
|
117
|
+
],
|
|
118
|
+
ensemble_id="mab1",
|
|
119
|
+
options=ScoringOptions(align_chains=("A",), score_chains=("B", "C")),
|
|
120
|
+
include_pairwise=True,
|
|
121
|
+
)
|
|
122
|
+
print(result.rms_rmsd, result.ssRMSD, result.cross_source_mean_rmsd)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## `brineylab/toolshed` Integration
|
|
126
|
+
|
|
127
|
+
To package `ssrmsd` as a CPU-only tool in `brineylab/toolshed` (`tools/ssrmsd/`):
|
|
128
|
+
|
|
129
|
+
**`Containerfile`** (no `ENTRYPOINT`; `ssrmsd` on `PATH`):
|
|
130
|
+
```dockerfile
|
|
131
|
+
FROM python:3.12-slim
|
|
132
|
+
RUN pip install --no-cache-dir "git+https://github.com/brineylab/ssrmsd.git@v0.1.0"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Run locally with Podman or on Slurm with Pyxis:
|
|
136
|
+
```bash
|
|
137
|
+
podman run --rm -v "$PWD":/work -w /work \
|
|
138
|
+
ghcr.io/brineylab/toolshed/ssrmsd:0.1.0 \
|
|
139
|
+
ssrmsd batch --dir af3=af3_runs --dir esmfold=esm_runs -o scores.csv
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT.
|
ssrmsd-0.1.0/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# ssrmsd
|
|
2
|
+
|
|
3
|
+
Self-consistency RMSD (`ssRMSD`) scoring for predicted antibody–antigen structure ensembles.
|
|
4
|
+
|
|
5
|
+
`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.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **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.
|
|
10
|
+
- **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`).
|
|
11
|
+
- **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.
|
|
12
|
+
- **Flexible superposition:** full-complex global Cα Kabsch by default, plus optional `--align-chains` / `--score-chains` (e.g., superpose on antigen, measure RMSD on antibody).
|
|
13
|
+
- **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.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Python 3.11+ (CPU-only; `gemmi`, `numpy`, and `typer`):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install ssRMSD
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For local development:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
pytest
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## CLI Usage
|
|
31
|
+
|
|
32
|
+
### Score a single ensemble
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Local AF3 job directory or archived .tar.gz / AlphaFold Server .zip
|
|
36
|
+
ssrmsd score /path/to/mab1_af3/
|
|
37
|
+
ssrmsd score /path/to/mab1.tar.gz
|
|
38
|
+
|
|
39
|
+
# Combine AF3 + ESMFold2 predictions into one ensemble, aligning on antigen (A) and scoring Fv (B,C)
|
|
40
|
+
ssrmsd score af3=af3_mab1.tar.gz esmfold=esm_mab1/ \
|
|
41
|
+
--align-chains A --score-chains B,C \
|
|
42
|
+
--pairwise-out pairs.csv -o score.csv
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Score a batch of ensembles
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Join multiple predictor roots by matching subfolder/archive name (or flat <mab>_model_<k> files)
|
|
49
|
+
ssrmsd batch \
|
|
50
|
+
--dir af3=/data/af3_runs \
|
|
51
|
+
--dir esmfold=/data/esm_runs \
|
|
52
|
+
--join intersection \
|
|
53
|
+
--workers 16 \
|
|
54
|
+
-o scores.csv
|
|
55
|
+
|
|
56
|
+
# Arbitrary paths/sources via CSV or TSV manifest (columns: ensemble_id,path[,source])
|
|
57
|
+
ssrmsd batch --manifest ensembles.csv --workers 16 --format jsonl -o scores.jsonl
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Output Columns
|
|
61
|
+
|
|
62
|
+
| Column | Description |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `ensemble_id` | Ensemble identifier |
|
|
65
|
+
| `n_structures` | Number of structures $n$ in the ensemble |
|
|
66
|
+
| `n_ca_align` | Common Cα atoms used for Kabsch superposition |
|
|
67
|
+
| `n_ca_score` | Common Cα atoms measured in RMSD |
|
|
68
|
+
| `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$) |
|
|
69
|
+
| `rms_rmsd` | Root-mean-square pairwise RMSD: $\sqrt{\text{mean\_sq\_rmsd}}$ (Å) |
|
|
70
|
+
| `mean_rmsd` | Mean upper-triangle pairwise RMSD (Å) |
|
|
71
|
+
| `median_rmsd` | Median upper-triangle pairwise RMSD (Å) |
|
|
72
|
+
| `rmsd_sd` | Population SD (`ddof=0`) of upper-triangle pairwise RMSDs (Å) |
|
|
73
|
+
| `ssRMSD` | Legacy parity: $\sum_{i,j} M_{ij}^2 = 2\sum_{i<j} d_{ij}^2$ |
|
|
74
|
+
| `SD` | Legacy parity: `np.std(M, ddof=0)` over all $n^2$ entries including diagonal |
|
|
75
|
+
| `within_source_mean_rmsd` | Mean pairwise RMSD for pairs from the same source (multi-source only) |
|
|
76
|
+
| `cross_source_mean_rmsd` | Mean pairwise RMSD for pairs from different sources (multi-source only) |
|
|
77
|
+
| `sources` | Per-source counts, e.g. `af3:5,esmfold:3` |
|
|
78
|
+
| `status` | `ok` or `error` |
|
|
79
|
+
| `error` | Diagnostic message when `status=error` |
|
|
80
|
+
|
|
81
|
+
## Python API
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from pathlib import Path
|
|
85
|
+
from ssrmsd import ScoringOptions, StructureInput, score_ensemble
|
|
86
|
+
|
|
87
|
+
result = score_ensemble(
|
|
88
|
+
[
|
|
89
|
+
StructureInput(Path("af3_mab1.tar.gz"), source="af3"),
|
|
90
|
+
StructureInput(Path("esm_mab1/"), source="esmfold"),
|
|
91
|
+
],
|
|
92
|
+
ensemble_id="mab1",
|
|
93
|
+
options=ScoringOptions(align_chains=("A",), score_chains=("B", "C")),
|
|
94
|
+
include_pairwise=True,
|
|
95
|
+
)
|
|
96
|
+
print(result.rms_rmsd, result.ssRMSD, result.cross_source_mean_rmsd)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## `brineylab/toolshed` Integration
|
|
100
|
+
|
|
101
|
+
To package `ssrmsd` as a CPU-only tool in `brineylab/toolshed` (`tools/ssrmsd/`):
|
|
102
|
+
|
|
103
|
+
**`Containerfile`** (no `ENTRYPOINT`; `ssrmsd` on `PATH`):
|
|
104
|
+
```dockerfile
|
|
105
|
+
FROM python:3.12-slim
|
|
106
|
+
RUN pip install --no-cache-dir "git+https://github.com/brineylab/ssrmsd.git@v0.1.0"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Run locally with Podman or on Slurm with Pyxis:
|
|
110
|
+
```bash
|
|
111
|
+
podman run --rm -v "$PWD":/work -w /work \
|
|
112
|
+
ghcr.io/brineylab/toolshed/ssrmsd:0.1.0 \
|
|
113
|
+
ssrmsd batch --dir af3=af3_runs --dir esmfold=esm_runs -o scores.csv
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT.
|