Skip to content

allowOptionalAttachments should also include terminal query atoms matching hydrogen#6280

Merged
greglandrum merged 1 commit into
rdkit:masterfrom
ptosco:query_is_hydrogen
Apr 12, 2023
Merged

allowOptionalAttachments should also include terminal query atoms matching hydrogen#6280
greglandrum merged 1 commit into
rdkit:masterfrom
ptosco:query_is_hydrogen

Conversation

@ptosco
Copy link
Copy Markdown
Contributor

@ptosco ptosco commented Apr 9, 2023

Currently the allowOptionalAttachments parameter in generateDepictionMatching2DStructure() and the allowRGroups parameter in generate_aligned_coords() only cover terminal dummy atoms, which are allowed not to match (or to match hydrogen). However, this should also include terminal query atoms when the query includes hydrogen.
This PR extends allowOptionalAttachments/allowRGroups accordingly, such that now a scaffold such as
image
matches a molecule such as
image

…en in additional to terminal dummy atoms

- added relevant unit tests
Copy link
Copy Markdown
Member

@greglandrum greglandrum left a comment

Choose a reason for hiding this comment

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

LGTM

return atom->getDegree() == 1 &&
(atom->getAtomicNum() == 0 ||
(atom->hasQuery() &&
describeQuery(atom).find("AtomAtomicNum 1 = val") !=
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.

using describeQuery() here is a nice solution to something that's otherwise a pain in the ass to deal with

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.

At first it seemed too easy, but I tried a few different ways to break it and couldn't ;-)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants