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

Unable to contract or expand Unknown Superatoms that are parsed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats #2636

Closed
Zhirnoff opened this issue May 21, 2023 · 1 comment · Fixed by #2641 or #2645

Comments

@Zhirnoff
Copy link
Collaborator

Steps to Reproduce
Scenario 1 MolV3000

  1. Open Ketcher
  2. Open DevConsole
  3. Add contracted unknown superatoms through API:
ketcher.setMolecule(`
  -INDIGO-05212317082D

  0  0  0  0  0  0  0  0  0  0  0 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 10 10 1 0 0
M  V30 BEGIN ATOM
M  V30 1 C 13.5221 -7.9589 0.0 0
M  V30 2 C 15.2524 -7.9584 0.0 0
M  V30 3 C 14.3889 -7.4588 0.0 0
M  V30 4 C 15.2524 -8.9593 0.0 0
M  V30 5 C 13.5221 -8.9638 0.0 0
M  V30 6 C 14.3911 -9.4588 0.0 0
M  V30 7 C 16.1187 -7.4588 0.0 0
M  V30 8 C 12.6575 -9.4663 0.0 0
M  V30 9 C 12.6561 -7.4587 0.0 0
M  V30 10 C 16.1189 -9.4585 0.0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 2 3 1
M  V30 2 2 4 2
M  V30 3 1 1 5
M  V30 4 1 2 3
M  V30 5 2 5 6
M  V30 6 1 6 4
M  V30 7 1 2 7
M  V30 8 1 5 8
M  V30 9 1 1 9
M  V30 10 1 4 10
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 1 ATOMS=(10 1 2 3 4 5 6 7 8 9 10) BRKXYZ=(9 0.000000 0.000000 0.-
M  V30 000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000) BRKXYZ=(-
M  V30 9 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000-
M  V30 000 0.000000) LABEL="Some Name"
M  V30 END SGROUP
M  V30 END CTAB
M  END
`)

Actual behavior
Contracted unknown superatom is parsed as expanded, and brackets with the name are lost.
2023-05-21_19h48_47

Expected behavior
A contracted unknown superatom is parsed as contracted and user can expand it without loses a brackets with name.

Scenario 2 MolV3000

  1. Open Ketcher
  2. Open DevConsole
  3. Add expanded unknown superatoms through API:
ketcher.setMolecule(`
  -INDIGO-05212317132D

  0  0  0  0  0  0  0  0  0  0  0 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 10 10 1 0 0
M  V30 BEGIN ATOM
M  V30 1 C 14.0471 -6.8839 0.0 0
M  V30 2 C 15.7774 -6.8834 0.0 0
M  V30 3 C 14.9139 -6.3838 0.0 0
M  V30 4 C 15.7774 -7.8843 0.0 0
M  V30 5 C 14.0471 -7.8888 0.0 0
M  V30 6 C 14.9161 -8.3838 0.0 0
M  V30 7 C 16.6437 -6.3838 0.0 0
M  V30 8 C 13.1825 -8.3913 0.0 0
M  V30 9 C 13.1811 -6.3837 0.0 0
M  V30 10 C 16.6439 -8.3835 0.0 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 2 3 1
M  V30 2 2 4 2
M  V30 3 1 1 5
M  V30 4 1 2 3
M  V30 5 2 5 6
M  V30 6 1 6 4
M  V30 7 1 2 7
M  V30 8 1 5 8
M  V30 9 1 1 9
M  V30 10 1 4 10
M  V30 END BOND
M  V30 BEGIN SGROUP
M  V30 1 SUP 1 ATOMS=(10 1 2 3 4 5 6 7 8 9 10) BRKXYZ=(9 0.000000 0.000000 0.-
M  V30 000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000) BRKXYZ=(-
M  V30 9 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000-
M  V30 000 0.000000) LABEL="Some Name" ESTATE=E
M  V30 END SGROUP
M  V30 END CTAB
M  END
`)

Actual behavior
Expanded unknown superatom is parsed as expanded but brackets with the name are lost. Can't contract.
2023-05-21_19h49_49

Expected behavior
A expanded unknown superatom is parsed as expanded and user can contract it without loses a brackets with name.

Scenario 3 .ket format

  1. Open Ketcher
  2. Open DevConsole
  3. Add contracted unknown superatoms through API:
ketcher.setMolecule(`{
    "root": {
        "nodes": [
            {
                "$ref": "mol0"
            }
        ]
    },
    "mol0": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    14.047092730148846,
                    -6.883901747459449,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.777386871537951,
                    -6.883401749152395,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.913889795256674,
                    -6.3838034407446065,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.777386871537951,
                    -7.884298360211954,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.047092730148846,
                    -7.888798344975434,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.91608978780771,
                    -8.38379666895833,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    16.643683938338725,
                    -6.3838034407446065,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.182495657592051,
                    -8.391296643564132,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.181095662332302,
                    -6.383703441083195,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    16.643883937661546,
                    -8.3834966699741,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 2,
                "atoms": [
                    2,
                    0
                ]
            },
            {
                "type": 2,
                "atoms": [
                    3,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    2
                ]
            },
            {
                "type": 2,
                "atoms": [
                    4,
                    5
                ]
            },
            {
                "type": 1,
                "atoms": [
                    5,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    6
                ]
            },
            {
                "type": 1,
                "atoms": [
                    4,
                    7
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    8
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    9
                ]
            }
        ],
        "sgroups": [
            {
                "type": "SUP",
                "atoms": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7,
                    8,
                    9
                ],
                "name": "Some Name",
                "expanded": false,
                "id": 0
            }
        ]
    }
}`)

Actual behavior
Contracted unknown superatom is parsed as contracted but you can't expand it.

2023-05-21_19h53_24.mp4

Expected behavior
A contracted unknown superatom is parsed as contracted and user can expand it without loses a brackets with name.

Scenario 4 .ket format

  1. Open Ketcher
  2. Open DevConsole
  3. Add expanded unknown superatoms through API:
ketcher.setMolecule(`{
    "root": {
        "nodes": [
            {
                "$ref": "mol0"
            }
        ]
    },
    "mol0": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    14.047092730148846,
                    -6.883901747459449,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.777386871537951,
                    -6.883401749152395,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.913889795256674,
                    -6.3838034407446065,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.777386871537951,
                    -7.884298360211954,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.047092730148846,
                    -7.888798344975434,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.91608978780771,
                    -8.38379666895833,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    16.643683938338725,
                    -6.3838034407446065,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.182495657592051,
                    -8.391296643564132,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.181095662332302,
                    -6.383703441083195,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    16.643883937661546,
                    -8.3834966699741,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 2,
                "atoms": [
                    2,
                    0
                ]
            },
            {
                "type": 2,
                "atoms": [
                    3,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    2
                ]
            },
            {
                "type": 2,
                "atoms": [
                    4,
                    5
                ]
            },
            {
                "type": 1,
                "atoms": [
                    5,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    6
                ]
            },
            {
                "type": 1,
                "atoms": [
                    4,
                    7
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    8
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    9
                ]
            }
        ],
        "sgroups": [
            {
                "type": "SUP",
                "atoms": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7,
                    8,
                    9
                ],
                "name": "Some Name",
                "expanded": true,
                "id": 0
            }
        ]
    }
}`)

Actual behavior
Expanded unknown superatom is parsed as expanded but when you trying contract brackets with the name are lost. Can't contract.

2023-05-21_19h54_08.mp4

Expected behavior
A expanded unknown superatom is parsed as expanded and user can contract it without loses a brackets with name.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 112.0.5615.138 (Official Build) (64-bit)

Ketcher version
Version 2.10.0-rc.4

#184643893

@Zhirnoff Zhirnoff added this to the Ketcher 2.10.0-rc.5 milestone May 21, 2023
@Zhirnoff Zhirnoff changed the title Unable to contract or expand Unknown Superatoms that are parsed via API in MolV3000 and KET formats Unable to contract or expand Unknown Superatoms that are parsed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats May 22, 2023
@Zhirnoff
Copy link
Collaborator Author

Note: Same behaviour for CDX, CDXML, CML, Base64CDX formats

Nitvex added a commit that referenced this issue May 22, 2023
…ed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats
Nitvex added a commit that referenced this issue May 22, 2023
…ed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats (#2641)
Nitvex added a commit that referenced this issue May 22, 2023
…at are parsed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats (#2641)
Nitvex added a commit that referenced this issue May 22, 2023
…at are parsed via API in MolV3000, KET, CDX, CDXML, CML, Base64CDX formats (#2641) (#2645)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment