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

Extend Ketcher API with a function to update monomers library #5990

Closed
svvald opened this issue Nov 19, 2024 · 1 comment · Fixed by #6020
Closed

Extend Ketcher API with a function to update monomers library #5990

svvald opened this issue Nov 19, 2024 · 1 comment · Fixed by #6020
Assignees

Comments

@svvald
Copy link
Collaborator

svvald commented Nov 19, 2024

A new function updateMonomersLibrary has to be added to a Ketcher API. This function should accept monomers description in ket format in JSON notation.
Once this function is invoked, new monomers have to be added to the monomers library in the macromolecules mode.
If some of the provided monomers overlap with the existing ones with their type and name, new monomers have to replace the existing ones

Also additional parameter has to be provided for Editor props for customers to be able to provide additional library data on Ketcher initialization

@svvald svvald added this to the Ketcher 2.28.0-rc.1 (Current) milestone Nov 19, 2024
@svvald svvald self-assigned this Nov 19, 2024
@svvald svvald linked a pull request Nov 27, 2024 that will close this issue
9 tasks
svvald added a commit that referenced this issue Dec 2, 2024
svvald added a commit that referenced this issue Dec 2, 2024
svvald added a commit that referenced this issue Dec 3, 2024
* #5990 – Extend Ketcher API to allow updating monomers library

* #5990 – Fix JSON update and make library persistent across modes, update API docs in README
@Zhirnoff
Copy link
Collaborator

Zhirnoff commented Dec 5, 2024

Tested. Used command

ketcher.updateMonomersLibrary(`{
  "root": {
    "nodes": [],
    "connections": [],
    "templates": [
      {
        "$ref": "monomerTemplate-Test___TestMonomerForUpdate1"
      },
      {
        "$ref": "monomerTemplate-Test___TestMonomerForUpdate2"
      },
      {
        "$ref": "monomerTemplate-Test___TestMonomerForUpdate3"
      }
    ]
  },
  "monomerTemplate-Test___TestMonomerForUpdate1": {
    "type": "monomerTemplate",
    "atoms": [
      {
        "label": "O",
        "location": [
          -0.8526,
          1.541,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -0.3405,
          0.131,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          0.3301,
          2.4636,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          1.1586,
          0.1823,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          1.5731,
          1.6239,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          2.0777,
          -1.0008,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -1.1818,
          -1.1087,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          -2.6787,
          -1.0008,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          -3.3525,
          -1.9937,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          3.2666,
          -0.8378,
          0
        ]
      }
    ],
    "bonds": [
      {
        "type": 1,
        "atoms": [
          0,
          1
        ]
      },
      {
        "type": 1,
        "atoms": [
          0,
          2
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          3
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          6
        ],
        "stereo": 1
      },
      {
        "type": 1,
        "atoms": [
          2,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          5
        ],
        "stereo": 6
      },
      {
        "type": 1,
        "atoms": [
          5,
          9
        ]
      },
      {
        "type": 1,
        "atoms": [
          6,
          7
        ]
      },
      {
        "type": 1,
        "atoms": [
          7,
          8
        ]
      }
    ],
    "class": "AminoAcid",
    "classHELM": "PEPTIDE",
    "id": "Test___TestMonomerForUpdate1",
    "fullName": "TestMonomerForUpdate1",
    "alias": "Test1",
    "attachmentPoints": [
      {
        "attachmentAtom": 7,
        "leavingGroup": {
          "atoms": [
            8
          ]
        },
        "type": "left"
      },
      {
        "attachmentAtom": 5,
        "leavingGroup": {
          "atoms": [
            9
          ]
        },
        "type": "right"
      }
    ],
    "naturalAnalogShort": "A"
  },
  "monomerTemplate-Test___TestMonomerForUpdate2": {
    "type": "monomerTemplate",
    "atoms": [
      {
        "label": "O",
        "location": [
          -0.8526,
          1.541,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -0.3405,
          0.131,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          0.3301,
          2.4636,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          1.1586,
          0.1823,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          1.5731,
          1.6239,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          2.0777,
          -1.0008,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -1.1818,
          -1.1087,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          -2.6787,
          -1.0008,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          -3.3525,
          -1.9937,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          3.2666,
          -0.8378,
          0
        ]
      }
    ],
    "bonds": [
      {
        "type": 1,
        "atoms": [
          0,
          1
        ]
      },
      {
        "type": 1,
        "atoms": [
          0,
          2
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          3
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          6
        ],
        "stereo": 1
      },
      {
        "type": 1,
        "atoms": [
          2,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          5
        ],
        "stereo": 6
      },
      {
        "type": 1,
        "atoms": [
          5,
          9
        ]
      },
      {
        "type": 1,
        "atoms": [
          6,
          7
        ]
      },
      {
        "type": 1,
        "atoms": [
          7,
          8
        ]
      }
    ],
    "class": "Base",
    "classHELM": "RNA",
    "id": "Test___TestMonomerForUpdate2",
    "fullName": "TestMonomerForUpdate2",
    "alias": "Test",
    "attachmentPoints": [
      {
        "attachmentAtom": 7,
        "leavingGroup": {
          "atoms": [
            8
          ]
        },
        "type": "left"
      },
      {
        "attachmentAtom": 5,
        "leavingGroup": {
          "atoms": [
            9
          ]
        },
        "type": "right"
      }
    ],
    "naturalAnalogShort": "A"
  },
  "monomerTemplate-Test___TestMonomerForUpdate3": {
    "type": "monomerTemplate",
    "atoms": [
      {
        "label": "O",
        "location": [
          -0.8526,
          1.541,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -0.3405,
          0.131,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          0.3301,
          2.4636,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          1.1586,
          0.1823,
          0
        ],
        "stereoLabel": "abs"
      },
      {
        "label": "C",
        "location": [
          1.5731,
          1.6239,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          2.0777,
          -1.0008,
          0
        ]
      },
      {
        "label": "C",
        "location": [
          -1.1818,
          -1.1087,
          0
        ]
      },
      {
        "label": "O",
        "location": [
          -2.6787,
          -1.0008,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          -3.3525,
          -1.9937,
          0
        ]
      },
      {
        "label": "H",
        "location": [
          3.2666,
          -0.8378,
          0
        ]
      }
    ],
    "bonds": [
      {
        "type": 1,
        "atoms": [
          0,
          1
        ]
      },
      {
        "type": 1,
        "atoms": [
          0,
          2
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          3
        ]
      },
      {
        "type": 1,
        "atoms": [
          1,
          6
        ],
        "stereo": 1
      },
      {
        "type": 1,
        "atoms": [
          2,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          4
        ]
      },
      {
        "type": 1,
        "atoms": [
          3,
          5
        ],
        "stereo": 6
      },
      {
        "type": 1,
        "atoms": [
          5,
          9
        ]
      },
      {
        "type": 1,
        "atoms": [
          6,
          7
        ]
      },
      {
        "type": 1,
        "atoms": [
          7,
          8
        ]
      }
    ],
    "class": "CHEM",
    "classHELM": "CHEM",
    "id": "Test___TestMonomerForUpdate3",
    "fullName": "TestMonomerForUpdate3",
    "alias": "Test",
    "attachmentPoints": [
      {
        "attachmentAtom": 7,
        "leavingGroup": {
          "atoms": [
            8
          ]
        },
        "type": "left"
      },
      {
        "attachmentAtom": 5,
        "leavingGroup": {
          "atoms": [
            9
          ]
        },
        "type": "right"
      }
    ],
    "naturalAnalogShort": "A"
  }
}`)

2024-12-05_12h52_35
2024-12-05_12h52_47
2024-12-05_12h52_55

Desktop:

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

Ketcher version
[Version 2.28.0-rc.1]
Indigo version
[Version 1.27.0-rc.1]

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

Successfully merging a pull request may close this issue.

2 participants