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

"Long bonds" for linearly displayed circular structures #6167

Open
ljubica-milovic opened this issue Dec 17, 2024 · 0 comments
Open

"Long bonds" for linearly displayed circular structures #6167

ljubica-milovic opened this issue Dec 17, 2024 · 0 comments
Labels
feature request Flex mode Bucket: Flex canvas related mode Snake mode Bucket: Snake mode related issues

Comments

@ljubica-milovic
Copy link
Collaborator

ljubica-milovic commented Dec 17, 2024

Background

Currently, both in snake and flex modes, for linearly layouted cyclic chains, the representation is not always acceptable because the longest bond is often hidden by other monomers.
image
After layout:
image
(The bond between 1st and 6th monomer is not visible)

Requirement (snake mode)

All non R1-R2 bonds behave like side-chain connections and do not overlap with other bonds after layout (so, do not need to be addressed).

  1. For every pair of monomers who make up a circular structure and have a R1-R2 bond connecting them check if there is a third monomer from that cycle whose center is 0,375A away from the line connecting centers of the first two monomers. If there is, the bond between first two monomers should behave as a side chain bond but be coloured dark gray/as a backbone connection.

For this requirement a circular structure is a collection of monomers where every (n-1)th one is connected via R1-R2 bond to the nth one and the nth is connected via R1-R2 to the 1st one.
The value of 0,375A is chosen because the dimensions of monomers is 0,75A, insuring no bond overlaps with a monomer or another bond from the same cycle (with standard use cases).

Example 1 (standard use case; there is a R1-R2 bond between 1st and 5th)
image
image
Between monomers 1. and 2. there are no other monomers. Same as for 2. and 3., 3. and 4. and 4. and 5.
Between monomers 1 and 5 there are three monomers from the cycle (2, 3, and 4) that are close to the line connecting the monomer centers => the backbone connection should behave as a side chain connection:
image

Example 2 (non-standard use case; there is a R1-R2 bond between 1st and 5th)
image
Monomers 2 and 4 are between 1 and 5 => backbone between 1 and 5 should behave as a side chain connection:
image

Requirements (flex mode)

For flex mode, any bonds can overlap. So the circular structure is any connection of monomers where (n-1)th one is connected via any bond (covalent or hydrogen) at any attachment points to the nth one, and the nth one is connected to the 1st one. Also, as opposed to the snake mode, one monomer can belong to multiple circular structures.

  1. For every pair of monomers who make up a circular structure check if there is a third monomer from that cycle whose center is 0,375A away from the line connecting centers of the first two monomers. If there is, the bond between first two monomers should behave as a snake side chain bond.

  2. The side chain bond should be composed of the shortest path from both monomers to the bounding bond of the chain that does no overlap with other bonds/monomers, and the path following the bounding box.

If the shortest path from the monomer to the bounding box is the same to the top or to the bottom choose top. If the path is the same to the left and to the right, choose to the left.

  1. If multiple snake side chain bonds occupy the same path they should not overlap.

Example 3 (standard use case; there is an bond between 1st and 3rd and a bond between 3rd and 5th)
image
image
There are two cycles with three monomers each (3rd monomer belongs to both).
For the first cycle, the 2nd monomer is between the 1st and 3rd.
For the second cycle, the 4th monomer is between the 3rd and 5th.
Both the bonds between 1st and 3rd, and the bonds between 3rd and 5th should behave as side chain snake bonds:
image

Example 4 (non-standard use case; there is a bond between 1st and 5th, and a bond between 2nd and 4th
image
image
There are two cycles - one with 3 monomers and one with 5 (2nd, 3rd, and 4th belong to both).
For the bigger cycle, 2nd, 3rd, and 4th are between the 1st and 5th.
For the smaller cycle, 3rd monomer is between the 2nd and 4th.
Both the bonds between 1st and 5th and the 2nd and 4th should behave as side chain snake bonds and should not overlap:
image

Example 5 (nonstandard use case; there is an bond between 1st and 3rd and a bond between 3rd and 5th)
image
image
There are three cycles - 1st, 2nd and 3rd; 3rd, 4th and 5th; an all monomers.
For the first cycle (between the 1st, 2nd and 3rd monomers), the 2nd one overlaps the path between the 1st and 3rd.
For the second cycle (between 3rd, 4th and 5th monomers), the 4th one overlaps the path between the 3rd and 5th.
For the biggest cycle, the same monomers overlap as for the previous ones.
That means that the bonds between the 1st and 3rd, and between the 3rd and 5th should behave as side chain snake bonds:
image

@ljubica-milovic ljubica-milovic added draft feature request Snake mode Bucket: Snake mode related issues Flex mode Bucket: Flex canvas related mode labels Dec 17, 2024
@ljubica-milovic ljubica-milovic added this to the Ketcher 3.1.0-rc.1 milestone Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Flex mode Bucket: Flex canvas related mode Snake mode Bucket: Snake mode related issues
Projects
None yet
Development

No branches or pull requests

1 participant