Skip to content

SKETCH-2631: Provide ability to mutate monomers from toolbar#254

Merged
JarrettSJohnson merged 1 commit intomainfrom
SKETCH-2631_monomer_mutation
Mar 20, 2026
Merged

SKETCH-2631: Provide ability to mutate monomers from toolbar#254
JarrettSJohnson merged 1 commit intomainfrom
SKETCH-2631_monomer_mutation

Conversation

@JarrettSJohnson
Copy link
Copy Markdown
Member

Description

This revision supports the mutation of monomers from the sketcher monomer toolbar. Each of the following criteria from the jira ticket was addressed:

  1. Mutation by clicking on monomer button
  2. Toolbar button background changes for compatible changes (similar to what the atomistic tools do)
  3. Mixed-selections (selecting amino-acid and peptides) will enable buttons that are compatible with any individual monomer type, but performing the selection will only mutate similar monomer types (e.g. you can't mutate a peptide to a nucleic acid even when other nucleic acids are in the mixed selection)
  4. Selections disable the "full" nucleic acid buttons.

I'm not too comfortable with HELM/SMILES, so the the changes w.r.t. bool is_smiles (which didn't seem to be monomer-friendly) might need extra scrutiny. Without this change, the monomer's display would show '***' (SMILES_PLACEHOLDER_TEXT).

Testing Done

Added some boost tests and e2e tests (which this PR is diff'd against) to validate the criteria above.

Comment thread src/schrodinger/rdkit_extensions/monomer_mol.cpp Outdated
@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from e24d72e to 9ecb6e3 Compare February 27, 2026 04:06
@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from 9ecb6e3 to 0bee87e Compare February 27, 2026 06:13
Copy link
Copy Markdown
Collaborator

@KevKeating KevKeating left a comment

Choose a reason for hiding this comment

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

Looks good to me. I just had a few very minor comments.

Comment thread src/schrodinger/sketcher/model/mol_model.h Outdated
Comment thread test/schrodinger/sketcher/model/test_mol_model.cpp Outdated
Comment thread test/schrodinger/sketcher/model/test_mol_model.cpp Outdated
Comment thread test/schrodinger/sketcher/model/test_mol_model.cpp Outdated
Comment thread test/schrodinger/sketcher/model/test_mol_model.cpp
Comment thread src/schrodinger/sketcher/sketcher_widget.cpp
Copy link
Copy Markdown
Collaborator

@ethan-schrodinger ethan-schrodinger left a comment

Choose a reason for hiding this comment

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

As long as @KevKeating's comments are addressed, this LGTM.

{
#ifdef __EMSCRIPTEN__
throw std::logic_error("Monomers are not yet supported in WASM Sketcher");
return std::nullopt;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was in response to Rachel's comment about using the MonomerDB to verify if a helm symbol is a standard monomer. For wasm-sketcher, since there's no DB, throws this exception and upstream catches the wrong exception type. Upstream call converts nullopt to using the default monomer DB (which is what the else part does..We could just drop this ifdef altogether probably...but maybe I don't have enough background knowledge as to why the monomer DB was kept out of wasm-sketcher in the first place).

I assume since we're now supporting monomers for wasm-sketcher, we probably want to support a monomer DB for it? Lemme know if that's not the case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Conferred with Rachel; change is fine for default monomers. Custom monomers for sketcher will be supported in another ticket.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You could also get rid of the catch block here here, since it shouldn't have any effect any more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This might be the relevant case for enabling custom monomers in wasm sketcher https://schrodinger.atlassian.net/browse/SKETCH-2655

@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from 0bee87e to 5713b37 Compare February 27, 2026 18:51
@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from 5713b37 to 8a054b3 Compare February 27, 2026 18:56
{
#ifdef __EMSCRIPTEN__
throw std::logic_error("Monomers are not yet supported in WASM Sketcher");
return std::nullopt;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You could also get rid of the catch block here here, since it shouldn't have any effect any more.

@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from 8a054b3 to 41e3287 Compare February 27, 2026 20:29
@@ -216,9 +216,6 @@ QColor get_color_for_monomer(
try {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You could get rid of lines 216 and 219 as well.

@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch 2 times, most recently from 13b635b to 8054386 Compare February 27, 2026 20:37
Copy link
Copy Markdown
Collaborator

@rachelnwalker rachelnwalker left a comment

Choose a reason for hiding this comment

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

rdkit_

@rachelnwalker
Copy link
Copy Markdown
Collaborator

rdkit_

oops not sure how I did that

Base automatically changed from e2e_tests to main March 19, 2026 16:11
@JarrettSJohnson JarrettSJohnson force-pushed the SKETCH-2631_monomer_mutation branch from 6d0e1cf to 0caeaa3 Compare March 19, 2026 23:13
@JarrettSJohnson JarrettSJohnson added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit 9ccee18 Mar 20, 2026
6 checks passed
@JarrettSJohnson JarrettSJohnson deleted the SKETCH-2631_monomer_mutation branch March 20, 2026 00:22
cdvonbargen pushed a commit to cdvonbargen/sketcher that referenced this pull request Mar 23, 2026
…nger#254)

* Linked Case: SKETCH-2631

### Description
This revision supports the mutation of monomers from the sketcher
monomer toolbar. Each of the following criteria from the jira ticket was
addressed:

1. Mutation by clicking on monomer button
2. Toolbar button background changes for compatible changes (similar to
what the atomistic tools do)
3. Mixed-selections (selecting amino-acid and peptides) will enable
buttons that are compatible with any individual monomer type, but
performing the selection will only mutate similar monomer types (e.g.
you can't mutate a peptide to a nucleic acid even when other nucleic
acids are in the mixed selection)
4. Selections disable the "full" nucleic acid buttons.

I'm not too comfortable with HELM/SMILES, so the the changes w.r.t.
`bool is_smiles` (which didn't seem to be monomer-friendly) might need
extra scrutiny. Without this change, the monomer's display would show
'***' (`SMILES_PLACEHOLDER_TEXT`).

### Testing Done
Added some boost tests and e2e tests (which this PR is diff'd against)
to validate the criteria above.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 2, 2026
…sing (#266)

* Linked Case: NOJIRAID

### Description
This might be more of a discussion than a proposal if this is
controversial. It's something that will affect how my tests should be
made for SKETCH-2707. If this revision is agreed on, I'll file a JIRA
ticket for it.

Currently, molecules with undefined monomers could be imported from helm
strings, but AFAICT, this doesn't serve much value and should be treated
as an error when imported into the sketcher instead?

This PR proposes to enforce validation of monomers in a helm string
against an available monomer database, and invalid monomers will prevent
importing a molecule. For tests, we can bypass validation with
`helm::helm_to_rdkit`, if we're just checking for things like attachment
points, etc.

(This is a stacked PR on top #254 since this requires the monomer
database to be available in the wasm sketcher.)

### Testing Done
Added new tests which ensures proper exception is thrown with invalid
monomers.
rachelnwalker pushed a commit to rachelnwalker/sketcher that referenced this pull request Apr 4, 2026
…nger#254)

* Linked Case: SKETCH-2631

### Description
This revision supports the mutation of monomers from the sketcher
monomer toolbar. Each of the following criteria from the jira ticket was
addressed:

1. Mutation by clicking on monomer button
2. Toolbar button background changes for compatible changes (similar to
what the atomistic tools do)
3. Mixed-selections (selecting amino-acid and peptides) will enable
buttons that are compatible with any individual monomer type, but
performing the selection will only mutate similar monomer types (e.g.
you can't mutate a peptide to a nucleic acid even when other nucleic
acids are in the mixed selection)
4. Selections disable the "full" nucleic acid buttons.

I'm not too comfortable with HELM/SMILES, so the the changes w.r.t.
`bool is_smiles` (which didn't seem to be monomer-friendly) might need
extra scrutiny. Without this change, the monomer's display would show
'***' (`SMILES_PLACEHOLDER_TEXT`).

### Testing Done
Added some boost tests and e2e tests (which this PR is diff'd against)
to validate the criteria above.
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.

5 participants