From 601b6c5f202300d1a31711b2add385a90ad937e1 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 29 Jul 2026 20:10:56 +0100 Subject: [PATCH] Backport fix from PR #542. [ci skip] --- src/BioSimSpace/Align/_merge.py | 8 ++++---- src/BioSimSpace/Sandpit/Exscientia/Align/_merge.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/BioSimSpace/Align/_merge.py b/src/BioSimSpace/Align/_merge.py index 24b50649e..cac08e0e2 100644 --- a/src/BioSimSpace/Align/_merge.py +++ b/src/BioSimSpace/Align/_merge.py @@ -1589,10 +1589,10 @@ def _check_ring(conn0, conn1, idx0, idy0, idx1, idy1, max_path=50, max_ring_size # Supplementary check for rings larger than max_path: find_paths may only # find the direct-bond path and miss the long way around the ring, giving # n=1 instead of n≥2. Sire's in_ring has no path-length limit and - # correctly identifies ring membership in macrocycles. - if (conn0.in_ring(idx0) and conn0.in_ring(idy0)) != ( - conn1.in_ring(idx1) and conn1.in_ring(idy1) - ): + # correctly identifies ring membership in macrocycles. The two-atom + # overload asks whether the atoms share a ring, so a ring built entirely + # from dummy atoms, which breaks no bond between mapped atoms, is ignored. + if conn0.in_ring(idx0, idy0) != conn1.in_ring(idx1, idy1): return True, False # A direct bond was replaced by a ring path (or vice versa), leaving the diff --git a/src/BioSimSpace/Sandpit/Exscientia/Align/_merge.py b/src/BioSimSpace/Sandpit/Exscientia/Align/_merge.py index c4102611f..f14002dca 100644 --- a/src/BioSimSpace/Sandpit/Exscientia/Align/_merge.py +++ b/src/BioSimSpace/Sandpit/Exscientia/Align/_merge.py @@ -1455,10 +1455,10 @@ def _check_ring(conn0, conn1, idx0, idy0, idx1, idy1, max_path=50, max_ring_size # Supplementary check for rings larger than max_path: find_paths may only # find the direct-bond path and miss the long way around the ring, giving # n=1 instead of n≥2. Sire's in_ring has no path-length limit and - # correctly identifies ring membership in macrocycles. - if (conn0.in_ring(idx0) and conn0.in_ring(idy0)) != ( - conn1.in_ring(idx1) and conn1.in_ring(idy1) - ): + # correctly identifies ring membership in macrocycles. The two-atom + # overload asks whether the atoms share a ring, so a ring built entirely + # from dummy atoms, which breaks no bond between mapped atoms, is ignored. + if conn0.in_ring(idx0, idy0) != conn1.in_ring(idx1, idy1): return True, False # A direct bond was replaced by a ring path (or vice versa), leaving the