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

The structure saved in CML format does not open #1878

Closed
Zhirnoff opened this issue Mar 25, 2024 · 4 comments · Fixed by #1947
Closed

The structure saved in CML format does not open #1878

Zhirnoff opened this issue Mar 25, 2024 · 4 comments · Fixed by #1947
Assignees
Labels
Bug CML Bucket: CML format related issues Priority: Medium

Comments

@Zhirnoff
Copy link
Collaborator

Zhirnoff commented Mar 25, 2024

Steps to Reproduce

  1. Open from file as New Project: The structure saved in CML format does not open.zip
  2. Save canvas as CML
  3. Open saved CML file ( For example, I provide the file that I received when saving ketcher (22).zip )
    image

Actual behavior
The structure saved in CML format does not open.
System throws exception: Convert error! Given string could not be loaded as (query or plain) molecule or reaction, see the error messages: 'CML loader: 'query features' are allowed only for queries', 'RXN loader: bad header ', 'RXN loader: bad header ', 'CML loader: atom id a-1 cannot be found'
image

Expected behavior
The structure saved in CML format opens
image

Desktop (please complete the following information):

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

Indigo version
[Version 1.19.0-rc.2]

Attachments
Error in Standalone mode:
2024-03-25_20h36_52

Error in Remote mode:
2024-03-25_20h37_59
2024-03-25_20h38_14

@nainaksh
Copy link

nainaksh commented Apr 19, 2024

I am working on the issue. Find below analysis.
Structure

The structure we want to create is trigonal. But in the code, it is considered as Tetrahydral because of below parameter is by default set to true.
image

Due to this, the CML conversion trying to add atomRefs4 attributes, but this trigonal structure has only 2 atoms present and tetrahydral requires at least 3 atoms. The 3rd atom id is set to -1 and that is why the exception occurs.

I tried to make the default variable is_tetrahydral(false)
After this change the CML conversion is successful but the ABS is not handled in this case. I am currently looking into this.

@nainaksh
Copy link

Because of the stereolabel, the stereocenter is constructed. stereo_centers.size=1
addStereocentersIgnoreBad method inserts neighbor vertices into the pyramid array.

image

image

A stereocenter is an atom, typically carbon, that has four attachments. As per this statement, this case is incorrect.

@nainaksh
Copy link

The solution could be-
Add a virtual atom to the molecule to make it tetrahedral structure. While setting atomParity, use virtual atomId to set atomref4 attribute.

@AlexeyGirin
Copy link
Collaborator

Verified.
Windows 10
Chrome Version 125.0.6422.113 (Official Build) (64-bit)
Ketcher Version 2.21.0-rc.2 Build at 2024-05-31; 10:48:44
Indigo Toolkit Version 1.21.0-dev.5.2-g994bdab98-x86_64-linux-gnu-11.2.1

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CML Bucket: CML format related issues Priority: Medium
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants