Skip to content

Feature custom roi maps#522

Merged
lohedges merged 6 commits into
OpenBioSim:develfrom
akalpokas:feature_custom_ROI_maps
Jun 29, 2026
Merged

Feature custom roi maps#522
lohedges merged 6 commits into
OpenBioSim:develfrom
akalpokas:feature_custom_ROI_maps

Conversation

@akalpokas

Copy link
Copy Markdown
Contributor

This PR adds custom_roi_map functionality to matchAtoms() function as well as the underlying _roiMatch() function in order to enable user defined mappings for ROI regions. This allows for creation of protein perturbations involving advanced use-cases, such as ring-breaks for example. The argument only works when roi is passed to matchAtoms(), so the underlying behaviour of the function outside of protein FEP remains unchanged.

For example as detailed in the tutorial, custom_roi_map={} can be used to return an empty mapping for ROI region:

mapping = BSS.Align.matchAtoms(molecule0=wt, molecule1=mut, roi=[15], custom_roi_map={})
BSS.Align.viewMapping(wt, mut, mapping, roi=15, pixels=500)
image

Or pass a custom mapping where the RDKit MCS algorithm would fail otherwise:

mapping = BSS.Align.matchAtoms(molecule0=wt, molecule1=mut, roi=[15], custom_roi_map={204:204,205:205,203:203,202:202,211:208,206:206,213:210,207:207,214:211,210:213})

BSS.Align.viewMapping(wt, mut, mapping, roi=15, pixels=500)
image

Specifically this PR:

  1. Adds the custom_roi_map functionality as described above.
  2. Introduces test_empty_custom_roi_mapping and test_custom_roi_ring_break_merge test cases in test_align.py that test the following:
  • test_empty_custom_roi_mapping: that a user can pass an empty custom_roi_map dictionary to return two unmapped ROI residues, while the rest of the protein is mapped correctly. This allows for setting up transformations using a "dual-topology" approach.
  • test_custom_roi_ring_break_merge: that a user can pass a custom mapping to create an alchemical ring transformation in a test system. The tests checks for this by asserting the number of alchemically created bonds as part of the mapping is equal to 1 (Leucine to Proline transformation is reverse of a ring-break).
  1. Updates the protein FEP tutorial to demonstrate the new functionality
  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): y
  • I confirm that I have added a test for any new functionality in this pull request: y
  • I confirm that I have added documentation (e.g. a new tutorial page or detailed guide) for any new functionality in this pull request: y
  • I confirm that I have permission to release this code under the GPL3 license: y

Suggested reviewers:

@lohedges

Any additional context of information?

This PR is non release blocking and can be merged after the release if needed.

@lohedges

Copy link
Copy Markdown
Contributor

Thanks for this. Looks like there are some weird failures due to some OpenFF packages. Will investigate tomorrow.

@akalpokas akalpokas force-pushed the feature_custom_ROI_maps branch from 31f37be to 7751179 Compare June 26, 2026 14:26
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:26 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:26 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:26 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:52 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:52 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:52 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:52 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 26, 2026 14:52 — with GitHub Actions Inactive
@akalpokas akalpokas force-pushed the feature_custom_ROI_maps branch from 7b61f4b to c56600d Compare June 26, 2026 15:37

@lohedges lohedges left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this, the tutorial is nice and clear. Just a few minor changes.

Comment thread src/BioSimSpace/Align/_align.py
Comment thread src/BioSimSpace/Align/_align.py Outdated
Comment thread tests/Align/test_align.py Outdated
@akalpokas akalpokas temporarily deployed to biosimspace-build June 29, 2026 09:44 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 29, 2026 09:44 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 29, 2026 09:44 — with GitHub Actions Inactive
@akalpokas akalpokas temporarily deployed to biosimspace-build June 29, 2026 09:44 — with GitHub Actions Inactive

@lohedges lohedges left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Many thanks!

@lohedges lohedges merged commit 86174cb into OpenBioSim:devel Jun 29, 2026
4 of 5 checks passed
@akalpokas akalpokas deleted the feature_custom_ROI_maps branch June 29, 2026 10:23
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.

2 participants