epam/ketcher

Update the representation of sense and antisense chains in sequence mode

Opened this issue · 0 comments

Background

This ticket represents an evolution of a previous one (#5925) addressing the layout of sense and antisense chains in sequence mode. Much of the logic is shared between this ticket, and the ticket describing the layout in snake mode (#5712).

Summary of differences between editing both chains and editing one chain

image

Requirements

Chains that can not be represented one bellow another

  1. If hydrogen bonds connect only monomers within one chain, that chain should be represented in sequence mode just like it would be without hydrogen bonds.

image
Should in sequence mode be:
AAACCCCCCU UU

  1. If there is a circular hydrogen bond connection between three or more chains, those chains should be represented in sequence mode just like they would be without hydrogen bonds.

image
Should in sequence mode be:
AA
UU
CC

Chains placement and formatting

  1. If two or more chains are connected via H-bonds and do not satisfy requirement 2, in sequence mode they should be represented in such a way that:

3.1. The chain with more monomers is placed on top, or if there is a tie the, one with a higher center on canvas in snake/flex modes.

Same logic as requirement 2.2. from #5712.

3.2. Multiple chains can be placed on a single line if both of those chains are connected via H-bonds to one chain.

Same logic as requirement 2.8. from #5712.

3.3. The chain(s) placed on the bottom should have their numbering reversed.

image

3.4. After every tenth symbol in one of the chains should come a break, and a number indicator should be placed above/bellow appropriate monomers/symbols.

The maximum amount of monomer symbols before a break is ten for one of the chains (the other one can have ten or less).
Appropriate monomers/symbols are the symbols before the break for the sequence above, and after the break for the sequence bellow, as well as the last monomers/symbols in the sequence for both chains.
image

Monomers placement and formatting

  1. Individual monomers/symbols should be positioned in such a way that:

4.1 Placement should start from the left-most monomer on the top chain that is connected via an H-bond to a monomer on the bottom chain - they should be aligned.

Same logic as requirement 2.6. from #5712.

4.2. Monomers who are connected via H-bonds are placed one bellow the other.

image
image

4.3. If monomers represented with one symbol are connected to multiple monomers via H-bonds, they should be aligned to the left most monomer who they have an H-bond with.

image
image

4.4. Monomers who are connected via hydrogen bonds should have those bonds displayed as dashed lines.

image
image

4.5. If in one line there are monomers who are not connected via backbone connections next to each other, there should be a gap between them, and if in the same place on the other line there is a backbone connection, it should be represented with a line (minus).

image
image
The line cannot be the first or the last symbol of a sequence.
A line can only be opposite a monomer symbol (not a different line), or one gap (not multiple gaps in a row).
These representations are incorrect:
image
image
But these are correct:
image
image

Removing/adding H-bonds

5.1. Right clicking on a symbol that has no hydrogen bonds with a symbol bellow/above it, should give the option to "Establish Hydrogen Bond". If a symbol has H-bonds the option should be disabled.

A hydrogen bond should be established between the monomer that was clicked on and the monomer placed bellow/above it.
"Establish Hydrogen Bond" is disabled if any of the symbols (the one that was clicked on, or the one opposite it) is the @ symbol representing multiple monomers.
If the symbol represents a nucleotide/nucleoside, a hydrogen bond should be established from the base (no need for a "sense base" check).

5.2. Right licking on a symbol that has any H-bonds should give the option to "Delete Hydrogen Bond". If there are no H-bonds, the option should be disabled.

All hydrogen bonds from monomers that symbol represents should be deleted.

5.3. If multiple monomers/symbols are selected and at least one of them does not have hydrogen bonds established with the monomer/symbol above/bellow it the option "Establish Hydrogen Bond" should be available from the r-click menu. If all symbols have H-bonds, the option should be disabled.

"Establish Hydrogen Bond" is disabled if any of the symbols that do not have H-bonds already with the symbols opposite them are the @ symbol representing multiple monomers.
For all monomers/symbols that do not have H-bonds with their pairs, a H-bond should be established (if the symbols represent nucleotides/nucleotides, an H-bond comes from the base).
image
image
If all symbols are selected the option "Establish Hydrogen Bond" should be enabled, because no H-bond will be established with the CHEMs (the @ symbol already have a H-bond with the symbol bellow), but just between nucleotides/nucleosides:
image
image

5.4. If multiple monomers are selected, and any of them have hydrogen bonds, the option "Delete Hydrogen Bond" should be available in the r-click menu. If no selected symbols have H-bonds, the option should be disabled.

All hydrogen bonds that the selected monomers have should be deleted.

5.5. If all hydrogen bonds between two chains are deleted, the user should get a warning message with the title "Deletion of all Hydrogen Bonds", and the text: "Deleting all hydrogen bonds will cause the separation of two chains. Do you wish to proceed?", and options "Cancel" (default) and "Continue".

When all H-bonds are deleted, the chain(s) that used to be placed bellow should be placed bellow the chain that was on top, one bellow the other starting from the chain on the left:
image
Remove all H-bonds for the first pair of sense and antisense:
image
This can happen by individually deleting H-bonds (req 5.2.), deleting all H-bonds at once (req 5.5), or by deleting all monomers that have H-bonds (reqs 6.4. and 7.6.)

Editing both chains

  1. The default editing mode is "Edit Both Strands".

6.1. It should be obvious to the user they they are editing both chains (see mockups).

The caret used for editing will be longer, and will clearly indicate to what chain the typed symbol will be added.
image
Up and down arrows on the keyboard should allow the user to switch between adding the typed symbol to one or the other chain - caret for the first or caret for the second example above.

6.2. If a monomer/symbol is added to one side of the chain, an appropriate monomer should be added to the other and connected via hydrogen bonds if applicable.

image
If a nucleotide/nucleoside with "sense base" is added to one chain, an appropriate nucleotide/nucleoside should be added to the other and connected via H-bonds, if anything else than a nucleotide/nucleoside with a "sense base" is added to one chain, it the same thing should be added to the other chain, and no hydrogen bonds should be established, as described in #5712.
Regarding the establishment of backbone connections: it is important to observe what is directly to the left and right and diagonally to the left and right of the caret in the beginning. If there is not a gap, a backbone should be established in that direction.
image
If the user tires to add a monomer lacking appropriate attachment points for backbone connections, refer to current behavior - error message and no addition of a new monomer.

6.3. If a line (minus) is added to one side of the chain the backbone of the other chain should be broken.

A line can not be added if at any of the four positions around the caret there is a gap - just like when the user enters some unsupported symbol - nothing happens.
image
A note for the second example above: Addition of a line just breaks the backbone of the opposite chain. This backbone is broken between two lines, so they are deleted because a line cannot be at the end or the beginning of a chain. For the chain above, the line is not visible because a line cannot be opposite multiple gaps (req 4.5.)

6.4. If a symbol/line is deleted on one side of the chain, the symbol/line on the other side of the chain should also be deleted.

If a symbol is deleted, a backbone connection should be preserved. If a line (minus) is deleted, that means that the backbone should be broken.
image

6.5. If a line break (enter) is added, both backbone chains should be broken.

image

6.6. If a monomer is replaced (by selecting it and choosing a monomer/preset from the library) or changed (RNA builder), only that monomer should be changed, and a hydrogen bond (if it existed) should be preserved.

This will be the same for both editing modes. If the user wishes to edit monomers from both chains like this, they should select all the monomers they wish changed.

Editing one chain

  1. When in view mode, right clicking on any monomer in a double stranded chain should give the options to "Edit One Strand" and "Edit Both Strands", and the option "Edit Sequence" should be removed

7.1. "Edit Both Strands" mode logic is described in requirements 6. "Edit One Strand" mode is described bellow.

7.2. It should be obvious to the user that they are editing only one side of the sense/antisense duplex (see mockups).

The other chain(s) (the one(s) not being edited) should be dimmed.
The user is able to change the chain being edited by pressing up and down keys on the keyboard.
Editing both chains:
image
Editing one chain:
image

7.3. If a monomer/symbol is added to one chain (not to the left of a line), it should have no impact on the other chain (other than extending the backbone (adding lines) if there is a backbone in that place to accommodate the added monomers).

image
image
image
Establishment of backbone connections follows the same logic as for editing both chains, but just looking at positions around the caret for the chain being edited. If there is a monomer to the left, establish a backbone to the left, if there is one to the right establish a backbone to the right. No monomer is added to the other chain, and no new backbone needs to be established there.

7.4. If a monomer/symbol is added to one chain (to the left of a line), that line is replaced with the newly added monomer.

image
If there happens to be a monomer bellow the newly added monomer, no hydrogen bonds should be established automatically.

7.5. The lines can only be added left of a gap. When the user exits "Edit" mode, if the line(s) do not connect monomer symbols, all lines should be deleted. If the lines(s) connect monomer symbols, a new backbone should be established.

image
image

7.6. If a symbol is deleted on the chain, it should be replaced with a line. If a line is deleted on the chain, the backbone should be broken.

image

7.7. If a line break is added, only one chain backbone is broken.

image

7.8. The logic for updating (select and replace from the library) and modifying (RNA builder) monomers is the same as for editing both chains (requirement 6.6.) - the change does not impact the other chain.

Changing editing mode

  1. While editing the chain(s) there should be an easy way to change editing mode (one strand vs both strands) (see mockups).

When the user hovers over the space above the caret, they should see an icon, that when clicked, will change the editing mode.
The icon should only be visible on hover over that area.
image

UX

TBD