Skip to content

#8856 – Defining other monomer properties - presets in the monomer creation wizard#8900

Merged
rrodionov91 merged 5 commits into
masterfrom
copilot/define-monomer-properties-presets
Dec 10, 2025
Merged

#8856 – Defining other monomer properties - presets in the monomer creation wizard#8900
rrodionov91 merged 5 commits into
masterfrom
copilot/define-monomer-properties-presets

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 10, 2025

How the feature works? / How did you fix the issue?

Implements auto-property assignment for RNA preset components when mandatory fields are not user-provided (requirement 2.3.2.2).

Core Logic

Property Auto-Assignment

  • Code: {presetCode}{suffix} where suffix = B (base), S (sugar), P (phosphate)
  • Name: Defaults to Code
  • Natural Analogue: Defaults to 'X' for bases
  • Only triggered when mandatory fields are empty or whitespace-only

Hidden vs Visible Monomers

  • Monomers marked hidden: true only when properties are auto-assigned
  • User-filled properties → normal visible monomer in library
  • Hidden monomers already filtered from UI (existing librarySlice.ts:482)

Attachment Point Leaving Groups

// Auto-assigns correct leaving atoms per component type
Base R1:       H
Sugar R2:      H  (phosphate connection)
Sugar R3:      O  (base connection, represents OH)
Phosphate R1:  O  (represents OH)

Implementation

Added helper functions:

  • hasAllMandatoryPropertiesFilled(): Checks Code + Natural Analogue (if required)
  • autoAssignPropertiesForHiddenMonomer(): Generates defaults
  • getLeavingAtomForAttachmentPoint(): Maps component type + AP → leaving atom

Modified:

  • validateRnaPresetWizard(): Skips validation when properties absent (allows auto-assignment)
  • assignConnectionPointAtom(): Added leavingAtomLabel parameter

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request
Original prompt

This section details on the original issue you should resolve

<issue_title>Defining other monomer properties - presets in the monomer creation wizard</issue_title>
<issue_description>## Background

This is an improvement to the previous logic contained in this ticket.

Requirements

$\color{Red}{\textbf{Entering the wizard}}$

❗ The requirements for this section contained in a separate ticket. ❗


$\color{Red}{\textbf{Defining the monomers}}$

$\color{Pink}{\textbf{Defining the monomer structure}}$

❗ The requirements for this section contained in a separate ticket. ❗

$\color{Pink}{\textbf{Highlighting}}$

❗ The requirements for this section contained in a separate ticket. ❗

$\color{Pink}{\textbf{Additions to the structure}}$

❗ The requirements for this section contained in a separate ticket. ❗

$\color{Pink}{\textbf{Defining other monomer properties}}$

2.3. The user can choose not to define some (all except the structure) properties for some (or all) components.

2.3.1. If for a monomer component all mandatory properties are filled, that monomer will also be saved to the library (in addition to the preset).

2.3.2. If all mandatory properties are not defined, that monomer gets saved to the library with user-assigned and default-assigned properties, but is "hidden" from the user.

2.3.2.1. Any properties of the "hidden" monomers should not be used for uniqueness, or any other checks, in regards to creating and editing monomers.

2.3.2.2. The following monomer properties will be assigned automatically:

  • Monomer type - based on if the user marked the monomer as base, sugar, or phosphate.

  • Code - constructed from the preset code (for example abc) as abcB (for bases), abcS (for sugars), and abcP (for phosphates).

  • Name - same as code.

  • Natural analogue (for base only) - X by default.

  • Attachment points:

    • If a base is present, the connection between sugar and base is formed between two APs: R1 with LGA H for the base, and R3 with LGA OH for the sugar.

    • If phosphate is present, the connection between sugar and phosphate is formed between two APs: R1 with LGA OH for the phosphate, and R2 with LGA H for the sugar.

  • Structure - based on the structure marked as belonging to that monomer.

Expand for the step-by-step assignment of the APs

There are three types of presets: sugar(base)phosphate (1), sugar()phosphate (2), and sugar(base) (3).

1.1. Start by defining the phosphate and then base

Select the phosphate -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA OH.
Select the base -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA H.
Select the sugar -> it has two internal APs that we know are with the phosphate and the base -> Assign that AP with the phosphate as R2 with LGA H, and the AP with the base as R3 with LGA OH.

1.2. Start by defining the base and then phosphate

First and second steps from the previous workflow flipped.

1.3. Start by defining the phosphate then sugar

Select the phosphate -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA OH.
Select the sugar -> it has two internal APs, we know which is with the phosphate so we assign it as R2 with LGA H. The other one must be with a base so it is assigned as R3 with LGA OH.
Select the base -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA H.

1.4. Start by defining the base then sugar

Same logic as the previous workflow - we know what APs the sugar will have because one of the components is known.

1.5. Start by defining the sugar then phosphate

Select the sugar -> It has two internal APs, but we don't know which is used for base and which for phosphate. Assign the first one R2 with LGA H based on the number of the AA in the KET file, and the other one R3 with LGA OH.
Select the phosphate -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA OH.
If the bond between sugar and phosphate is not R2(H)-R1(OH), the APs of the sugar must be flipped.
Select the base -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA H.

1.6. Start by defining the sugar then base

Same logic from the previous workflow - the sugar APs are assigned by default, and then flipped after the base is defined if the bond between sugar and base is not R3(OH)-R1(H).

2.1. Start by defining the phosphate

Select the phosphate -> it has one internal AP that can only be with a sugar -> Assign that AP as R1 with LGA OH.
Select the sugar -> it has one internal AP that we know is with the phosphate -> Assign that AP as R2 with LGA H.

2.2. Star...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 10, 2025 11:00
- Add hasAllMandatoryPropertiesFilled() to check if user filled in properties
- Add autoAssignPropertiesForHiddenMonomer() to generate default properties
  - Auto-generate Code: presetCode + suffix (B/S/P)
  - Auto-generate Name: same as Code
  - Auto-assign Natural analogue for bases: 'X' by default
- Modify validation logic to skip when properties are not filled
- Only mark monomers as hidden when properties were auto-assigned
- Monomers with user-filled properties are saved as normal (visible) monomers

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
- Modify assignConnectionPointAtom() to accept leavingAtomLabel parameter
- Auto-assign leaving groups based on component type and attachment point:
  - Base R1: H (hydrogen)
  - Sugar R2: H (hydrogen)
  - Sugar R3: O (oxygen, representing OH)
  - Phosphate R1: O (oxygen, representing OH)
- This ensures RNA preset components have correct leaving groups as per requirement 2.3.2.2

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
- Add JSDoc documentation to hasAllMandatoryPropertiesFilled() explaining why 'name' is not checked
- Create getLeavingAtomForAttachmentPoint() helper function to centralize leaving atom logic
- Replace hardcoded AtomLabel values with helper function calls for better maintainability
- Add inline comments to clarify whitespace handling in autoAssignPropertiesForHiddenMonomer()
- Fix naturalAnalogue handling to consistently apply trim() in all cases

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot AI changed the title [WIP] Add presets for defining monomer properties in creation wizard #8856 – Defining other monomer properties - presets in the monomer creation wizard Dec 10, 2025
Copilot AI requested a review from AlexeyGirin December 10, 2025 11:17
@rrodionov91 rrodionov91 marked this pull request as ready for review December 10, 2025 16:55
@rrodionov91 rrodionov91 merged commit 989dae1 into master Dec 10, 2025
14 of 15 checks passed
@rrodionov91 rrodionov91 deleted the copilot/define-monomer-properties-presets branch December 10, 2025 17:48
AlexeyGirin added a commit that referenced this pull request Jan 3, 2026
…eation wizard (#8900)

* Initial plan

* Implement auto-property assignment for hidden RNA preset monomers

- Add hasAllMandatoryPropertiesFilled() to check if user filled in properties
- Add autoAssignPropertiesForHiddenMonomer() to generate default properties
- Auto-generate Code: presetCode + suffix (B/S/P)
- Auto-generate Name: same as Code
- Auto-assign Natural analogue for bases: 'X' by default
- Modify validation logic to skip when properties are not filled
- Only mark monomers as hidden when properties were auto-assigned
- Monomers with user-filled properties are saved as normal (visible) monomers

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>

* Add auto-assignment of attachment point leaving groups for RNA presets

- Modify assignConnectionPointAtom() to accept leavingAtomLabel parameter
- Auto-assign leaving groups based on component type and attachment point:
  - Base R1: H (hydrogen)
  - Sugar R2: H (hydrogen)
  - Sugar R3: O (oxygen, representing OH)
  - Phosphate R1: O (oxygen, representing OH)
- This ensures RNA preset components have correct leaving groups as per requirement 2.3.2.2

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>

* Address code review feedback - improve code maintainability

- Add JSDoc documentation to hasAllMandatoryPropertiesFilled() explaining why 'name' is not checked
- Create getLeavingAtomForAttachmentPoint() helper function to centralize leaving atom logic
- Replace hardcoded AtomLabel values with helper function calls for better maintainability
- Add inline comments to clarify whitespace handling in autoAssignPropertiesForHiddenMonomer()
- Fix naturalAnalogue handling to consistently apply trim() in all cases

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>

* - fixed tests

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: Roman Rodionov <roman_rodionov@epam.com>
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.

Defining other monomer properties - presets in the monomer creation wizard

3 participants