Skip to content

SKETCH-2375: Migrate to RDKit native attachment point handling - #360

Open
cdvonbargen wants to merge 6 commits into
schrodinger:mainfrom
cdvonbargen:pr/SKETCH-2375-native-attachment-points
Open

SKETCH-2375: Migrate to RDKit native attachment point handling#360
cdvonbargen wants to merge 6 commits into
schrodinger:mainfrom
cdvonbargen:pr/SKETCH-2375-native-attachment-points

Conversation

@cdvonbargen

@cdvonbargen cdvonbargen commented May 23, 2026

Copy link
Copy Markdown
Collaborator

RDKit APIs used

  • MolOps::expandAttachmentPoints() replaces molattachpt_property_to_attachment_point_dummies().
  • MolOps::collapseAttachmentPoints() replaces attachment_point_dummies_to_molattachpt_property().
  • MolOps::details::addExplicitAttachmentPoint() replaces make_new_attachment_point().

Functions kept for Sketcher behavior

  • is_attachment_point_dummy() cannot use RDKit's isAttachmentPoint() because RDKit tests whether an AP can be collapsed and therefore rejects wedged APs. Sketcher must still recognize those as attachment points and support legacy _AP<n> labels.
  • compute2DCoords() additionally handles HELM structures, frozen atoms, ring templates, and removal of stale molfile wedging.
  • wedgeMolBonds() prevents RDKit from choosing attachment-point bonds for wedging by temporarily making those bonds ineligible.
  • The Sketcher R-group helpers for AP numbering, renumbering, bond/atom lookup, and counting implement Sketcher's global _AP<n> UI numbering. RDKit's _fromAttachPoint values only describe the first or second attachment on an individual parent atom.

@cdvonbargen
cdvonbargen force-pushed the pr/SKETCH-2375-native-attachment-points branch from a869a44 to 321fd89 Compare August 4, 2026 13:29
@cdvonbargen
cdvonbargen marked this pull request as ready for review August 4, 2026 13:40
cdvonbargen and others added 6 commits August 4, 2026 06:41
Replace custom attachment point expand/collapse functions with RDKit's
native MolOps::expandAttachmentPoints() and collapseAttachmentPoints().
Set _fromAttachPoint property on AP dummies for compatibility with the
native API, while keeping atomLabel for molecule-level numbering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mentPoint

Delegate is_attachment_point_dummy() to RDKit's MolOps::details::isAttachmentPoint()
and replace make_new_attachment_point() with MolOps::details::addExplicitAttachmentPoint().
This requires all AP dummies to have _fromAttachPoint set, so label_expanded_attachment_points()
now also marks CXSMILES-sourced APs that only have atomLabel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hmentPoint

Remove the is_attachment_point_dummy wrapper from rdkit_extensions and replace
all call sites with RDKit::MolOps::details::isAttachmentPoint(). Also simplify
collapse_attachment_point_dummies to just call collapseAttachmentPoints without
the redundant marking loop, since all AP creation and read paths now set
_fromAttachPoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inline the single collapseAttachmentPoints call at the write site and drop
the unnecessary updatePropertyCache calls that bookended it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cdvonbargen
cdvonbargen force-pushed the pr/SKETCH-2375-native-attachment-points branch from 321fd89 to a426dd5 Compare August 4, 2026 13:46
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.

1 participant