Skip to content

#8143 System allow to load monomers with invalid HELM aliases (spaces are not allowed)#9073

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

#8143 System allow to load monomers with invalid HELM aliases (spaces are not allowed)#9073
Copilot wants to merge 7 commits intomasterfrom
copilot/fix-invalid-helm-aliases

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

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

Monomers with HELM aliases containing spaces were being accepted into the macromolecule library instead of being rejected with a clear error. This adds alias validation during library updates so invalid entries are skipped and the required error is logged.

  • Library validation: enforce HELM alias format on load and skip invalid monomers with the prescribed error text
  • Tests: add a unit test covering invalid HELM alias rejection
const helmAliasRegex = /^[A-Za-z0-9_-*]+$/;
if (newMonomer.props?.aliasHELM && !helmAliasRegex.test(newMonomer.props.aliasHELM)) {
  KetcherLogger.error(
    `Load of "${newMonomer.props.MonomerName}" 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.`,
  );
  return;
}

Invalid HELM alias example

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 (spaces are not allowed)</issue_title>
<issue_description>Steps to Reproduce

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

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 Spaces are not allowed for HELM\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 6 commits February 1, 2026 17:52
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
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 loading of monomers with invalid HELM aliases Prevent loading monomers with invalid HELM aliases Feb 1, 2026
Copilot AI requested a review from AlexeyGirin February 1, 2026 17:59
@AlexeyGirin AlexeyGirin changed the title Prevent loading monomers with invalid HELM aliases #8143 System allow to load monomers with invalid HELM aliases (spaces are not allowed) Feb 2, 2026
@AlexeyGirin AlexeyGirin marked this pull request as ready for review February 2, 2026 10:09
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 (spaces are not allowed)

2 participants