Skip to content

#8142 System allow to load monomers with invalid HELM aliases#9074

Open
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-invalid-helm-aliases-again
Open

#8142 System allow to load monomers with invalid HELM aliases#9074
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-invalid-helm-aliases-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Invalid HELM aliases in monomer definitions were accepted during library load, causing invalid monomers (e.g., _Peptide1) to appear instead of being rejected with the required console error. This change enforces the HELM alias character set during load and skips invalid monomers.

  • Validation on load
    • Skip monomers whose aliasHELM contains characters outside [A-Za-z0-9-_ *] and log the required error message.
  • Coverage
    • Unit test ensures invalid aliases (spaces, special chars) are rejected and include the monomer name in the error.
if (newMonomer.props?.aliasHELM && !HELM_ALIAS_REGEX.test(newMonomer.props.aliasHELM)) {
  KetcherLogger.error(
    `Load of "${monomerName}" monomer has failed, monomer definition contains invalid HELM alias value...`,
  );
  return;
}

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

(Screenshots, videos, or GIFs, if applicable)

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>System allow to load monomers with invalid HELM aliases</issue_title>
<issue_description>Steps to Reproduce

  1. Open Macromolecules - Flex mode (clean canvas)
  2. Go to console and execute following commands:
_Peptide1 with HELM alias with invalid symbols

await ketcher.updateMonomersLibrary('\n  -INDIGO-10092516592D\n\n  0  0  0  0  0  0  0  0  0  0  0 V3000\nM  V30 BEGIN CTAB\nM  V30 COUNTS 1 0 0 0 0\nM  V30 BEGIN ATOM\nM  V30 1 _Peptide1 10.0194 -9.20822 0.0 0 CLASS=AA SEQID=1\nM  V30 END ATOM\nM  V30 BEGIN BOND\nM  V30 END BOND\nM  V30 END CTAB\nM  V30 BEGIN TEMPLATE\nM  V30 TEMPLATE 1 AA/_Peptide1/_Peptide1/ NATREPLACE=AA/A\nM  V30 BEGIN CTAB\nM  V30 COUNTS 9 8 3 0 0\nM  V30 BEGIN ATOM\nM  V30 1 H -2.394 0.508 0.0 0\nM  V30 2 C -1.528 0.008 0.0 0\nM  V30 3 C -0.662 0.508 0.0 0\nM  V30 4 C 0.204 0.008 0.0 0\nM  V30 5 C -1.528 -0.992 0.0 0\nM  V30 6 C -0.662 -1.492 0.0 0\nM  V30 7 C 1.17 0.267 0.0 0\nM  V30 8 C 1.428 1.233 0.0 0\nM  V30 9 H 2.394 1.492 0.0 0\nM  V30 END ATOM\nM  V30 BEGIN BOND\nM  V30 1 1 1 2\nM  V30 2 1 2 3\nM  V30 3 1 3 4\nM  V30 4 1 2 5\nM  V30 5 1 5 6\nM  V30 6 1 4 7\nM  V30 7 1 7 8\nM  V30 8 1 8 9\nM  V30 END BOND\nM  V30 BEGIN SGROUP\nM  V30 1 SUP 1 ATOMS=(1 1) XBONDS=(1 1) BRKXYZ=(9 0.433000 -0.250000 0.000000-\nM  V30  0.000000 0.000000 0.000000 0.000000 0.000000 0.000000) LABEL=H CLASS=-\nM  V30 LGRP\nM  V30 2 SUP 2 ATOMS=(1 9) XBONDS=(1 8) BRKXYZ=(9 -0.483000 -0.129500 0.00000-\nM  V30 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000) LABEL=H CLASS-\nM  V30 =LGRP\nM  V30 3 SUP 3 ATOMS=(7 2 3 4 5 6 7 8) XBONDS=(2 1 8) BRKXYZ=(9 -0.433000 0.2-\nM  V30 50000 0.000000 0.483000 0.129500 0.000000 0.000000 0.000000 0.000000) -\nM  V30 LABEL=_Peptide1 CLASS=AA SAP=(3 2 1 Al) SAP=(3 8 9 Br) NATREPLACE=AA/A\nM  V30 END SGROUP\nM  V30 END CTAB\nM  V30 END TEMPLATE\nM  END\n>  <type>\nmonomerTemplate\n\n>  <modificationType>\nNatural amino acid2222222;ssssss;\n\n>  <aliasHELM>\n_Peptide1_HELM(%\\x3C!--&?@ЭТОПРОВАЛ\n\n>  <idtAliases>\nbase=_Peptide1\n\n$$$$\n', { format: 'sdf' })

Actual behavior
_Peptide1 unsplit nucleotide appears in the library
Image

Expected behavior
Monomer doesn't appear at the Library
System throws an error in console: Load of "_Nucleotide1" monomer has failed, monomer definition contains invalid HELM alias value. The HELM alias must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*), spaces prohibited.

As per requirement:

The HELM symbol must be a string of uppercase and lowercase letters, numbers, hyphens (-), underscores (), and asterisks (*) (spaces prohibited). If that is not true, an error message appears in the console: "The HELM alias must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (), and asterisks (*), spaces prohibited."

If a monomer/preset property is incorrect for whatever reason: skip that monomers, load the rest and throw an error with monomer name and details

Environment details:

  • Ketcher Version 3.9.0-rc.1 Build at 2025-10-02; 16:35:40
  • Indigo Version 1.37.0-rc.1.0-gca09660df-wasm32-wasm-clang-19.0.0
  • Chrome Version 141.0.7390.55 (Official Build) (64-bit)
  • Win10

Related issue: epam/Indigo#3161</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 1, 2026 18:11
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix system allowing loading of invalid HELM aliases Reject invalid HELM aliases during monomer library load Feb 1, 2026
Copilot AI requested a review from AlexeyGirin February 1, 2026 18:14
@AlexeyGirin AlexeyGirin changed the title Reject invalid HELM aliases during monomer library load #8142 System allow to load monomers with invalid HELM aliases Feb 1, 2026
@AlexeyGirin AlexeyGirin marked this pull request as ready for review February 1, 2026 23:01
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.

System allow to load monomers with invalid HELM aliases

2 participants