Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

Problem

When loading ambiguous CHEM monomers from HELM notation (e.g., CHEM1{(A:10+C:50)}$$V2.0) in Sequence mode, the symbol was incorrectly displayed as % instead of @.

Before:

Ambiguous CHEM showing as %

After:

Ambiguous CHEM showing as @

Root Cause

The AmbiguousSequenceItemRenderer was always displaying the monomer's label property, which defaults to % for all ambiguous monomers. However, when an ambiguous monomer contains different monomer types, it is classified as CHEM (via AmbiguousMonomer.getMonomerClass()), and should display the same symbol as regular CHEM monomers: @.

Solution

Modified AmbiguousSequenceItemRenderer.ts to check the monomer's classification:

get symbolToDisplay(): string {
  // Ambiguous CHEM monomers should display @ symbol
  if (
    this.node.monomer instanceof AmbiguousMonomer &&
    this.node.monomer.monomerClass === KetMonomerClass.CHEM
  ) {
    return '@';
  }
  return this.node.monomer.label;
}

This ensures symbol consistency across all monomer types in Sequence mode:

  • Regular CHEM monomers: @
  • Ambiguous CHEM monomers: @ ✓ (fixed)
  • Ambiguous peptide monomers: %
  • Other monomer types: their respective symbols

Testing

  • ✅ All existing unit tests pass (298+ tests)
  • ✅ TypeScript compilation succeeds with proper type guards
  • ✅ Build succeeds for all packages
  • ✅ No breaking changes introduced

Fixes #4556

Original prompt

This section details on the original issue you should resolve

<issue_title>Ambiguous CHEM shown wrong at Sequence mode</issue_title>
<issue_description>Steps to Reproduce

  1. Toggle to Macromolecules canvas - Sequence mode
  2. Load from HELM: CHEM1{(A:10+C:50)}$$$$V2.0

Actual behavior
Ambiguous CHEM is shown as % symbol on sequence canvas
image

Expected behavior
Ambiguous CHEM is shown as @ symbol on sequence canvas
image

As per @ljubica-milovic:
Image

Versions

  • Ketcher Version 2.25.0-rc.1 Build at 2024-09-03; 15:31:03
  • Indigo Toolkit Version 1.24.0-rc.1.0-gb8f099851-wasm32-wasm-clang-19.0.0
  • Chrome Version 128.0.6613.114 (Official Build) (64-bit)
  • Win10

Reference issues: #4556
</issue_description>

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

Fixes #5481


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix ambiguous CHEM symbol display in sequence mode Fix ambiguous CHEM symbol display in Sequence mode Oct 16, 2025
Copilot AI requested a review from AlexeyGirin October 16, 2025 17:49
Copilot finished work on behalf of AlexeyGirin October 16, 2025 17:49
@AlexeyGirin AlexeyGirin marked this pull request as ready for review October 16, 2025 20:23
@AlexeyGirin AlexeyGirin requested review from Nitvex and removed request for AlexeyGirin, NataliaLoginova and Zhirnoff October 16, 2025 20:24
@AlexeyGirin AlexeyGirin changed the title Fix ambiguous CHEM symbol display in Sequence mode #5481 - Ambiguous CHEM shown wrong at Sequence mode Oct 18, 2025
@AlexeyGirin AlexeyGirin requested review from svvald and removed request for Nitvex November 8, 2025 17:55
@AlexeyGirin AlexeyGirin merged commit b96f370 into master Nov 11, 2025
14 of 15 checks passed
@AlexeyGirin AlexeyGirin deleted the copilot/fix-ambiguous-chem-symbol branch November 11, 2025 11:05
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.

Ambiguous CHEM shown wrong at Sequence mode Support of ambiguous monomers in sequence view

3 participants