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

Preview: Error occurs on click of "Remove Explicit Hydrogens" in reaction #2755

Open
Zhirnoff opened this issue Feb 6, 2025 · 1 comment

Comments

@Zhirnoff
Copy link
Collaborator

Zhirnoff commented Feb 6, 2025

Summary
An error appears on attempt to Remove hydrogens. The Add hydrogens works correctly.

Steps to Reproduce

  1. Load a reaction from a KET file onto the canvas. ket-cascade-reaction-3-1-2-1-1.zip
  2. Click "Add/Remove Explicit Hydrogens" and verify the reaction updates correctly
  3. Click "Remove Explicit Hydrogens" again.

Actual behavior
The first click works correctly, but the second click produces an error.
The error message states: "Given string could not be loaded as (query or plain) molecule or reaction, see the error messages: 'molecule json loader: Not a molecule. Found 3 arrows.'"

Image

Expected behavior
Explicit hydrogens should be removed correctly on repeated actions, with no errors.

Desktop:

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

Ketcher version
[Version 3.0.0-rc.1]
Indigo version
[Version 1.27.0-dev.3]

Additional context
Bug found by autotest Reactions/Reaction-tools/Multi-Tailed-Arrow-Tool/multi-tailed-arrow-tool.spec.ts:3852

@Zhirnoff Zhirnoff added Cascade reactions Priority: High Severity: High High level visibility to the user labels Feb 6, 2025
@Zhirnoff Zhirnoff added this to the Indigo-1.30.0-rc.1 milestone Feb 6, 2025
@AliaksandrDziarkach
Copy link
Collaborator

Details

{
    "root": {
        "nodes": [
            {
                "$ref": "mol0"
            },
            {
                "$ref": "mol1"
            },
            {
                "$ref": "mol2"
            },
            {
                "$ref": "mol3"
            },
            {
                "$ref": "mol4"
            },
            {
                "$ref": "mol5"
            },
            {
                "$ref": "mol6"
            },
            {
                "type": "arrow",
                "data": {
                    "mode": "open-angle",
                    "pos": [
                        {
                            "x": 24.366666666666667,
                            "y": -15.313888888888892,
                            "z": 0
                        },
                        {
                            "x": 26.366666666666667,
                            "y": -15.313888888888892,
                            "z": 0
                        }
                    ]
                }
            },
            {
                "type": "multi-tailed-arrow",
                "data": {
                    "head": {
                        "position": {
                            "x": 16.94136,
                            "y": -13.99028,
                            "z": 0
                        }
                    },
                    "spine": {
                        "pos": [
                            {
                                "x": 16.14136,
                                "y": -11.74028,
                                "z": 0
                            },
                            {
                                "x": 16.14136,
                                "y": -16.37917,
                                "z": 0
                            }
                        ]
                    },
                    "tails": {
                        "pos": [
                            {
                                "x": 15.74136,
                                "y": -11.74028,
                                "z": 0
                            },
                            {
                                "x": 15.74136,
                                "y": -13.99028,
                                "z": 0
                            },
                            {
                                "x": 15.74136,
                                "y": -16.37917,
                                "z": 0
                            }
                        ]
                    },
                    "zOrder": 0
                }
            },
            {
                "type": "multi-tailed-arrow",
                "data": {
                    "head": {
                        "position": {
                            "x": 21.01111,
                            "y": -15.31389,
                            "z": 0
                        }
                    },
                    "spine": {
                        "pos": [
                            {
                                "x": 20.21111,
                                "y": -14.06389,
                                "z": 0
                            },
                            {
                                "x": 20.21111,
                                "y": -16.56389,
                                "z": 0
                            }
                        ]
                    },
                    "tails": {
                        "pos": [
                            {
                                "x": 19.81111,
                                "y": -14.06389,
                                "z": 0
                            },
                            {
                                "x": 19.81111,
                                "y": -16.56389,
                                "z": 0
                            }
                        ]
                    },
                    "zOrder": 0
                }
            }
        ],
        "connections": [],
        "templates": []
    },
    "mol0": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    17.59843537518435,
                    -13.407009531599554,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    19.328737070927218,
                    -13.40652434360215,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    18.465223732547027,
                    -12.906902003275134,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    19.328737070927218,
                    -14.407467182247094,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    17.59843537518435,
                    -14.411955171223084,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    18.467407078535345,
                    -14.906968225574762,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 2,
                "atoms": [
                    2,
                    0
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 2,
                "atoms": [
                    4,
                    5
                ]
            },
            {
                "type": 1,
                "atoms": [
                    5,
                    3
                ]
            },
            {
                "type": 2,
                "atoms": [
                    3,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    2
                ]
            }
        ]
    },
    "mol1": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    14.380302928465658,
                    -13.081333339618888,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.880690360560337,
                    -14.621425778119889,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.189929793594848,
                    -13.675193144028851,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.87991549637098,
                    -14.621425778119889,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.570575985850052,
                    -13.675193144028851,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 2,
                "atoms": [
                    4,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    1
                ]
            },
            {
                "type": 2,
                "atoms": [
                    1,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    0
                ]
            }
        ]
    },
    "mol2": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    13.514240188063106,
                    -15.87915000312561,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.514240188063106,
                    -16.879164670168734,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.380252889722449,
                    -17.379172003690293,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.246265591381794,
                    -16.879164670168734,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.246265591381794,
                    -15.87915000312561,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.380252889722449,
                    -15.379142669604049,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    5,
                    0
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    4
                ]
            },
            {
                "type": 1,
                "atoms": [
                    4,
                    5
                ]
            }
        ]
    },
    "mol3": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    14.26914177861134,
                    -10.804161329643044,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    15.078131739261012,
                    -11.39195403529184,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    14.769135573821274,
                    -12.343042232540174,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.769147983401407,
                    -12.343042232540174,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    13.46015181796167,
                    -11.39195403529184,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 1,
                "atoms": [
                    4,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    0
                ]
            }
        ]
    },
    "mol4": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    18.004929769919485,
                    -17.19080374885474,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    19.006181341191628,
                    -17.19080374885474,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    18.505605743604242,
                    -16.325862917811932,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    0,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    0
                ]
            }
        ]
    },
    "mol5": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    28.096096343627867,
                    -15.755882076798057,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    28.0923930035538,
                    -14.760784589868619,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    27.084183690956714,
                    -15.742970431674953,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    27.08168143414991,
                    -14.760784589868619,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    0,
                    1
                ]
            },
            {
                "type": 1,
                "atoms": [
                    1,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    0
                ]
            }
        ],
        "stereoFlagPosition": {
            "x": 28.096096343627867,
            "y": 13.760784589868619,
            "z": 0
        }
    },
    "mol6": {
        "type": "molecule",
        "atoms": [
            {
                "label": "C",
                "location": [
                    21.715587491066643,
                    -14.890825493117742,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    22.49952087688563,
                    -14.273253849197992,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    23.47255177547148,
                    -14.495803993990352,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    23.906634731155588,
                    -15.391613397691007,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    21.721096158016945,
                    -15.89801012679549,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    23.473252878537885,
                    -16.2986404504541,
                    0
                ]
            },
            {
                "label": "C",
                "location": [
                    22.49952087688563,
                    -16.52119059524646,
                    0
                ]
            }
        ],
        "bonds": [
            {
                "type": 1,
                "atoms": [
                    1,
                    0
                ]
            },
            {
                "type": 1,
                "atoms": [
                    0,
                    4
                ]
            },
            {
                "type": 1,
                "atoms": [
                    4,
                    6
                ]
            },
            {
                "type": 1,
                "atoms": [
                    6,
                    5
                ]
            },
            {
                "type": 1,
                "atoms": [
                    5,
                    3
                ]
            },
            {
                "type": 1,
                "atoms": [
                    3,
                    2
                ]
            },
            {
                "type": 1,
                "atoms": [
                    2,
                    1
                ]
            }
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants