Skip to content

Add structural analysis to the SepTop protocol#1982

Open
hannahbaumann wants to merge 47 commits into
mainfrom
structural_analysis_septop
Open

Add structural analysis to the SepTop protocol#1982
hannahbaumann wants to merge 47 commits into
mainfrom
structural_analysis_septop

Conversation

@hannahbaumann

@hannahbaumann hannahbaumann commented May 28, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • All new code is appropriately documented (user-facing code must have complete docstrings).
  • Added a news entry, or the changes are not user-facing.
  • Ran pre-commit: you can run pre-commit locally or comment on this PR with pre-commit.ci autofix.

Manual Tests: these are slow so don't need to be run every commit, only before merging and when relevant changes are made (generally at reviewer-discretion).

Developers certificate of origin

@hannahbaumann hannahbaumann marked this pull request as draft May 28, 2026 10:05
@hannahbaumann hannahbaumann changed the title Add structural analysis to the SepTop protocol [WIP] Add structural analysis to the SepTop protocol May 28, 2026
@hannahbaumann

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@hannahbaumann hannahbaumann self-assigned this May 28, 2026
@hannahbaumann

Copy link
Copy Markdown
Contributor Author

This is what it would look like for the complex right now.

protein_2D_RMSD ligand_B_RMSD ligand_B_COM_drift ligand_A_RMSD ligand_A_COM_drift

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.98276% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.62%. Comparing base (5347082) to head (a992d84).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/openfe/protocols/openmm_septop/base_units.py 93.06% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1982      +/-   ##
==========================================
- Coverage   94.94%   90.62%   -4.32%     
==========================================
  Files         216      217       +1     
  Lines       20481    20744     +263     
==========================================
- Hits        19445    18799     -646     
- Misses       1036     1945     +909     
Flag Coverage Δ
fast-tests 90.62% <96.98%> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hannahbaumann

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@hannahbaumann hannahbaumann marked this pull request as ready for review June 2, 2026 09:12
@hannahbaumann

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

Comment thread src/openfe/protocols/openmm_septop/base_units.py Outdated
Comment thread src/openfe/protocols/openmm_septop/base_units.py Outdated
Comment thread src/openfe/protocols/openmm_septop/base_units.py Outdated
@hannahbaumann

Copy link
Copy Markdown
Contributor Author

As discussed offline, CI is currently breaking since the prev. openfe 1.11 results files for gather do not have the new analysis_settings. Should we turn them on by default to keep backward compatibility or remove the old test files and break backward compatibility? @IAlibay

rdmol_A=d["rdmol_A"],
rdmol_B=d["rdmol_B"],
protein_selection="protein and name CA",
skip=None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a test which checks the length of the output analysis changes in response to the skip value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test here: 396b353

Comment thread docs/guide/protocols/septop.rst Outdated
Comment thread docs/guide/protocols/septop.rst Outdated
Comment thread src/openfe/protocols/openmm_septop/equil_septop_settings.py Outdated
hannahbaumann and others added 3 commits June 11, 2026 11:02
Co-authored-by: Josh Horton <joshua.horton@openforcefield.org>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
@hannahbaumann

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@IAlibay IAlibay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good - just the one blocker for me re: settings

Comment thread docs/guide/protocols/septop.rst Outdated
(complex leg only).
* **Protein 2D RMSD** — pairwise RMSD matrix between all analyzed frames (complex leg only).

Results are saved as an NPZ file (``structural_analysis.npz``) and plots are generated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] can you link to https://numpy.org/doc/stable/reference/generated/numpy.savez.html in case someone doessn't know what NPZ is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this!

ThermoSettings,
)
from openfe.protocols.openmm_md.plain_md_methods import PlainMDSimulationUnit
from openfe.protocols.openmm_septop.equil_septop_settings import MultiStateAnalysisSettings

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you import directly from omm_settings or does it cause a circular import?

rdmol_B,
)

except Exception as e:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair - I'd open an issue and put a todo here for now then.

ligand_B_indices: list[int],
smc_A: SmallMoleculeComponent,
smc_B: SmallMoleculeComponent,
analysis_settings: MultiStateAnalysisSettings,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than passing it directly, can you just access it via _get_settings? That way you won't have two sets of settings around.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changed this!

trajectory = simulation.outputs["trajectory"]
checkpoint = simulation.outputs["checkpoint"]

alchem_comps = self._inputs["alchemical_components"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's odd - something we can work out in a separate issue / PR - could you raise an issue about setup.inputs being empty? That seems unintuitive.

Comment on lines +1910 to +1912
# Get the analysis settings
settings = self._get_settings()
analysis_settings = settings["analysis_settings"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this in run to match the other units / general pattern across the protocols?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this into run!

skip: int | None = None
"""
Frame stride for structural analysis. If ``None``, a stride is
chosen such that approximately (max.) 500 frames are analyzed per state.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to open an issue to work out if this is something we want to keep around in the future - at least it seems rather unintuitive to not just use all the data we have on hand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised an issue here: #1993

@hannahbaumann

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@github-actions

Copy link
Copy Markdown

No API break detected ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants