Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying side chain connections in snake-like mode #3532

Closed
olganaz opened this issue Nov 2, 2023 · 4 comments · Fixed by #4945
Closed

Displaying side chain connections in snake-like mode #3532

olganaz opened this issue Nov 2, 2023 · 4 comments · Fixed by #4945
Assignees
Labels
feature request Snake mode Bucket: Snake mode related issues Test Cases Written Test cases has been written for that issue

Comments

@olganaz
Copy link
Collaborator

olganaz commented Nov 2, 2023

Background

There are two major types of monomer sequences supported implicitly by Ketcher:

  • Backbone chains forming the core of the macromolecule. Neighbor monomers in these chains are always connected via a bond from R2 attachment points (APs) of one monomer to R1 of another.
  • Side chains -- "secondary" sequences aside the backbone chains. Side chains are connected to backbone chains via attachment points other than R2-R1 (e.g. R3-R3, R3-R4, R1-R1).

Bonds forming the backbone chain are backbone connections, bonds in side chains -- side chain connections.
Specific case of side chain connection is when the connection is established directly between two backbone monomers (e.g. connecting them via R3/R4), i.e. there are no monomers in the side chain. In scope of this task we consider this type of side chain connection only.

Requirements

Currently side-chain connection in snake (left-to-right) mode is displayed as a straight line connecting two monomers, with no respect to other monomers and bonds. This results in messy visualization and suboptimal user experience.

Instead, side chain connections should be displayed as rounded elbow connectors aligned with existing monomers and other bonds (see wireframes below). The following rules should be applied:

  1. If two monomers linked by side-chain connection are positioned in the same row of monomers, the connection should be drawn horizontally above these monomers.
  2. If two side-chain connected monomers are from different rows, the connection curve should go from topmost monomer upside down and left to right (or right to left) using free space between monomers. The shortest path should be used when possible.
  3. If R1-R1 connection is established between two monomers occupying first positions in different backbone chains, the connection should be drawn on the left from these monomers.
  4. In case of R2-R2 bond connecting the last monomers of the chains the connection should be drawn on the right from these monomers.
  5. Side chain connections may intersect backbone and other side chain connections but should not overlap. If more than one side connection is drawn horizontally between two monomer rows, they should be shifted vertically against each other.
  6. Similarly to point 5, vertically oriented connections should not overlap. If multiple connections run vertically in the space between two monomers, they should be shifted horizontally relative to each other.
  7. Specific case for RNA monomers: the bond between R1 of base and R3 of sugar should not be considered side chain connection and should be displayed as a straight line (usual way). All other bonds connected to the base are considered side chain connections.
  8. Attachment points positions:
  • R1 is always oriented left, R2 is always oriented right (excl. base monomers)
  • R3, R4, ... APs are oriented towards bond formation
  • All the base APs are oriented towards bond formation.

Alternatives
The same logic of connections is applied for CHEMs, unknown monomers and unsplit nucleotides.

UI
r1-r1
image

r3-r2
image

r2-r2
image

r1-r3
image

r3-r3
image

image

RNA
image

@olganaz olganaz self-assigned this Nov 2, 2023
@olganaz olganaz changed the title [Macro] Displaying side chain connections in snake-like mode for peptides Macro: Displaying side chain connections in snake-like mode for peptides Apr 19, 2024
@olganaz olganaz added this to the Ketcher 2.23.0-rc.1 milestone May 22, 2024
@olganaz olganaz changed the title Macro: Displaying side chain connections in snake-like mode for peptides Macro: Displaying side chain connections in snake-like mode May 23, 2024
@olganaz olganaz added Snake mode Bucket: Snake mode related issues and removed draft labels May 23, 2024
@AlexeyGirin
Copy link
Collaborator

Question to @olganaz

  1. Multiple horizontal bonds are evenly distributed throughout the space between the chains. Is there the same logic for vertical bonds?
  2. How are CHEMs displayed? Same as regular monomers?
  3. How are unknown monomers displayed? Same as regular monomers?
  4. For unknown monomers, connection with R4 are acceptable. Is the logic for them the same as for R3?

@AlexeyGirin AlexeyGirin added the Questions remain If that issue has unresolved questions label Jun 7, 2024
@olganaz
Copy link
Collaborator Author

olganaz commented Jun 10, 2024

  1. Yes, the same logic for horizontal bonds, as for vertical.
  2. CHEMs, unknown monomers and unsplit nucleotides are displayed in the same way as peptides. The same logic of connections is applied.

@rrodionov91 rrodionov91 changed the title Macro: Displaying side chain connections in snake-like mode Displaying side chain connections in snake-like mode Jun 12, 2024
@AlexeyGirin AlexeyGirin added Test Cases Written Test cases has been written for that issue and removed Questions remain If that issue has unresolved questions labels Jun 13, 2024
@rrodionov91 rrodionov91 linked a pull request Jul 1, 2024 that will close this issue
9 tasks
rrodionov91 added a commit that referenced this issue Jul 2, 2024
- created CanvasMatrix which represents all entities after snake layout as a grid
- added drawing of PolymerBond by using CanvasMatrix as a bond way reference

#4955 - Update indigo to 1.22.0-rc.1 in browser module
- updated ketcher to 2.23.0-rc.1
This was referenced Jul 9, 2024
@AlexeyGirin
Copy link
Collaborator

p.8 is not implemented and will be moved to dedicated task by @rrodionov91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Snake mode Bucket: Snake mode related issues Test Cases Written Test cases has been written for that issue
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants