Skip to content

SKETCH-2763: Generate complement strand for nucleic acids - #367

Open
JarrettSJohnson wants to merge 1 commit into
mainfrom
pr/SKETCH-2763_complement_strand
Open

SKETCH-2763: Generate complement strand for nucleic acids#367
JarrettSJohnson wants to merge 1 commit into
mainfrom
pr/SKETCH-2763_complement_strand

Conversation

@JarrettSJohnson

Copy link
Copy Markdown
Member

Description

This revision offers support for the generation of a complement strand for a selected set of nucleic acids.

Adds a menu option to generate the complement whenever a set of nucleic acids are selected; mixed selections disables the option.

Ordering and pointer invalidation is a bit tricky for building up the sequences in this way, so we employ an index-based strategy to build up the nascent chain for each polymer.

Testing Done

Adds some tests for conditions where menus should show, generation of complement, and undo.

@JarrettSJohnson
JarrettSJohnson marked this pull request as ready for review June 5, 2026 01:38
Comment thread src/schrodinger/sketcher/menu/monomer_context_menu.h Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/model/mol_model.cpp

@ethan-schrodinger ethan-schrodinger left a comment

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.

LGTM!

I have some minort comments, but obviously it's up to you whether they are worth implementing.

Comment on lines +179 to +184
* @brief Per-base data needed to build one complement monomer triplet (sugar,
* base, phosphate).
*
* @c orig_idx is the index of the original base this triplet pairs with.
*/
struct ComplementPair {

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.

Nit: maybe I'm missing something, but I don't know whether ComplementPair is the best name for this, since it's not a pair of anything.

@JarrettSJohnson JarrettSJohnson Jul 14, 2026

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.

Fixed — renamed ComplementPair to ComplementNucleotide and renamed its fields to original_base_idx, sugar_symbol, and base_symbol so the type describes the single complement nucleotide it represents.

Signed Codex

Comment thread src/schrodinger/sketcher/model/mol_model.cpp Outdated
Comment thread src/schrodinger/sketcher/rdkit/monomeric.cpp
cdvonbargen pushed a commit to cdvonbargen/sketcher that referenced this pull request Jul 2, 2026
…number per monomer, even for nucleic acids (schrodinger#372)

- Linked Case: SKETCH-2782

### Description

Based on [this
discussion](schrodinger#367 (comment)),
I've modified `get_residue_number_for_new_monomer` to use one residue
number per monomer, even for nucleic acids.

### Testing Done

Added unit tests coverage for the new logic.
@JarrettSJohnson
JarrettSJohnson force-pushed the pr/SKETCH-2763_complement_strand branch from b3ad7b4 to af262d3 Compare July 14, 2026 16:58

@KevKeating KevKeating left a comment

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.

I had a few minor questions, but they can always be addressed later if need be.

// One undo entry covers the complement chains for every source polymer.
auto undo_macro = createUndoMacro("Add Complementary Sequence");
for (const auto& [polymer_id, base_idxs] : bases_by_polymer) {
addComplementChainForPolymer(base_idxs);

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.

Will this add an empty entry to the undo stack if none of the polymers have any complementable nucleotides?

if (is_first) {
addMonomer(complement.sugar_symbol,
rdkit_extensions::ChainType::RNA, sugar_coord);
} else {

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.

What happens if there's a non-complementable nucleotide in between two complementable nucleotides? Will this create an extra long connection between the two complements?

* @param bases the selected atoms
* @return a map from polymer id to the contained base atom indices
*/
static std::map<std::string, std::vector<size_t>>

@KevKeating KevKeating Jul 15, 2026

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.

These static methods and the ComplementNucleotide struct could probably go in monomeric.h/cpp since they don't seem to need access to anything MolModel-related. That would keep this file a bit cleaner, but I'm okay either way. We can always move them later if we need to access them somewhere else.

@d-b-w
d-b-w removed their request for review July 22, 2026 17:19
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.

4 participants