Skip to content

Fix issue #565 - #566

Merged
lohedges merged 2 commits into
develfrom
fix_565
Nov 18, 2026
Merged

lohedges merged 2 commits into
develfrom
fix_565

Conversation

@lohedges

Copy link
Copy Markdown
Contributor

Closes #565.

When the RDKit MCS search in matchAtoms timed out, RDKit returned the best substructure found so far and matchAtoms used it without any warning. Since the search runs with CompareAny matching and hydrogens included, larger ligand pairs can need more than the default 5 s timeout, so the result could depend on machine load.

This PR:

  • Runs a second MCS search on the heavy atoms only when the full search times out. This is usually much faster. The heavy-atom mapping is then extended outwards from the matched atoms, pairing their unmapped neighbours (hydrogens and acyclic heavy atoms) by distance after aligning on the mapped atoms. It's used instead of the timed-out mapping if it's larger, with a warning. If the heavy-atom search also times out, a warning says the mapping may be incomplete.
  • Adds an mcs_strategy option to matchAtoms: "full" (the default and existing behaviour, with the fallback above), "heavy" (heavy-atom search and extension only), or "both" (the largest mapping from either search, using the score to choose between mappings of the same size). It isn't supported with roi.
  • Fixes single-atom mappings from the Sire MCS scoring path being returned with AtomIdx keys rather than integers.

"both" helps because RDKit's FindMCS returns a single substructure. When several common substructures have the same size, the one it returns can force a poor mapping, e.g. a ring mapped onto itself flipped by 180°, with some pairs 4–5 Å apart in aligned poses. The scoring can only choose between matches of that one substructure.

Tested against the 596 edges of the OpenFE industry benchmark set that we prepare with matchAtoms. With the default "full", mappings only change for the three edges whose search timed out with a truncated result:

Edge Before After
water_set/hsp90_woodhead 4~1 13 atoms 29
scaffold_hopping/chk1 17~1 15 45
miscellaneous_set/hiv1_protease 17~20 82 91

With "both", 40 of the 596 edges change: the three above, and about 30 where a ring was previously mapped flipped. For those, the largest distance between mapped atoms in the aligned poses drops from 4–5 Å to below 1 Å. The other 556 mappings are identical. With "both", a mapping can take up to twice the timeout, since each search has its own.

@lohedges lohedges added the bug Something isn't working label Nov 18, 2026
@lohedges
lohedges temporarily deployed to biosimspace-build November 18, 2026 11:41 — with GitHub Actions Inactive
@lohedges
lohedges temporarily deployed to biosimspace-build November 18, 2026 11:41 — with GitHub Actions Inactive
@lohedges
lohedges temporarily deployed to biosimspace-build November 18, 2026 11:41 — with GitHub Actions Inactive
@lohedges
lohedges temporarily deployed to biosimspace-build November 18, 2026 11:41 — with GitHub Actions Inactive
@lohedges
lohedges merged commit f678e14 into devel Nov 18, 2026
4 of 5 checks passed
@lohedges
lohedges deleted the fix_565 branch November 18, 2026 12:08

This branch was previously deployed

1 inactive deployment
biosimspace-build — b770bac8 Deployed Nov 18, 2026 by lohedges via build (3.14, macos) #418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] matchAtoms silently returns a truncated mapping when the RDKit MCS search times out

1 participant