Giter Site home page Giter Site logo

epam / ketcher Goto Github PK

View Code? Open in Web Editor NEW
441.0 37.0 158.0 467.41 MB

Web-based molecule sketcher

Home Page: https://lifescience.opensource.epam.com/ketcher/demo.html

License: Apache License 2.0

HTML 0.08% JavaScript 7.98% Less 2.75% TypeScript 89.15% CSS 0.04% Shell 0.01% Dockerfile 0.01%

ketcher's Introduction

Ketcher npm version Downloads License

Ketcher is an open-source web-based chemical structure editor incorporating high performance, good portability, light weight, and ability to easily integrate into a custom web-application. Ketcher is designed for chemists, laboratory scientists and technicians who draw structures and reactions.

Key Features

  • ⚡️ Fast 2D structure representation that satisfies common chemical drawing standards
  • 💠 3D structure visualization
  • 📝 Template library (including custom and user's templates)
  • 🔩 Add atom and bond basic properties and query features, add aliases and Generic groups
  • 🌀 Stereochemistry support during editing, loading, and saving chemical structures
  • ➿ Storing history of actions, with the ability to rollback to previous state
  • 💾 Ability to load and save structures and reactions in MDL Molfile or RXN file format, InChI String, ChemAxon Extended SMILES, ChemAxon Extended CML file formats
  • 🔬 Zoom in/out, hotkeys, cut/copy/paste
  • 🔮 OCR - ability to recognize structures at pictures (image files) and reproduce them
  • 📋 Copy and paste between different chemical editors
  • 🛠️ Settings support (Rendering, Displaying, Debugging)
  • 📷 Use of SVG to achieve best quality in-browser chemical structure rendering

Editor builtin tools:

  • Atom Tool, Bond Tool, and Template Tool to draw and edit structures
  • Aromatize/De-aromatize Tool
  • Calculate CIP Descriptors Tool
  • Structure Check Tool
  • MW and Structure Parameters Calculate Tool
  • Select, modify, and erase connected and unconnected atoms and bonds using Selection Tool, or using Shift key
  • Advanced Structure Clean up Tool (+ stereochemistry checking and structure layout)
  • Simple Structure Clean up Tool (checks bonds length, angles and spatial arrangement of atoms)
  • Easy to use R-Group and S-Group tools (Generic, Multiple group, SRU polymer, peratom, Data S-Group)
  • Reaction Tool (reaction generating, manual and automatic atom-to-atom mapping)
  • Flip/Rotate Tool

Installation and usage

At this moment Ketcher can be embedded into your application in two ways:

  • as a react component library
  • as ready-to-run application (to find desired version please look at Assets block of releases). The application can be injected as IFrame or a separate page.

FAQ

How to use react component library

Look at the following link for details.

Configure indigo service

You can find the instruction for service installation here.

Packages

Project Status Description
ketcher-core npm version Core functionality: domain, shared services, functions and interface declarations
ketcher-standalone npm version Contains only the functionality necessary to start Ketcher in standalone mode
ketcher-react npm version Package contains only the functionality necessary to define components.

3D Viewer

Ketcher uses Miew-React for viewing and editing data in 3D.

You can find the latest version of Miew-React here. The last checked version - 1.0.0.

Ketcher API

Ketcher can return drawn structures using the following methods:

getSmiles(isExtended = false): Promise<string> – returns string representation of drawn structure in SMILES format.
Parameters: isExtended: boolean. By default, false. Indicates, whether extended SMILES format needs to be used.

getMolfile(molfileFormat): Promise<string> – returns string representation of drawn structure in MOL-format.
Parameters: molfileFormat: 'v2000' | 'v3000'. Optional, by default, 'auto'. Indicates, in which format result will be returned. If no desired format is provided, then it is chosen automatically, depending on drawn structure.

getRxn(molfileFormat): Promise<string> – returns string representation of drawn structure in RXN-format.
Parameters: molfileFormat: 'v2000' | 'v3000'. Optional, by default, 'v2000'. Indicates, in which format result will be returned.

getKet(): Promise<string> – returns string representation of drawn structure in internal Ket-format.

getSmarts(): Promise<string> – returns string representation of drawn structure in Smarts-format.

getCml(): Promise<string> – returns string representation of drawn structure in Cml-format.

getSdf(molfileFormat): Promise<string> – returns string representation of drawn structure in Sdf-format.
Parameters: molfileFormat: 'v2000' | 'v3000'. Optional, by default, 'v2000'. Indicates, in which format result will be returned.

getCDXml(): Promise<string> – returns string representation of drawn structure in CDXml-format.

getCDX(): Promise<string> – returns string representation of drawn structure in CDX-format.

getInchi(withAuxInfo = false): Promise<string> – returns string representation of drawn structure in Inchi-format.
Parameters: withAuxInfo: boolean. Optional, by default, false.

getInchiKey(): Promise<string> – returns string representation of drawn structure in InChiKey-format.

containsReaction(): boolean – returns true, in case drawn structure contains reaction; false otherwise.

isQueryStructureSelected(): boolean – returns true, in case selected structure has query.

setMolecule(structure: string): Promise<void> – draws passed structure on the canvas. Before drawing passed structure, current structure is removed.
Parameters: structure: string. Structure is a string in any supported format.

addFragment(structure: string): Promise<void> – adds passed structure on the canvas. Current structure is not changed.
Parameters: structure: string. Structure is a string in any supported format.

layout(): Promise<void> – performs layout algorithm for drawn structure.

recognize(image: Blob, version?: string): Promise<Struct> – recognizes a structure from image.
Parameters: image: Blob – image to recognize. Returns Struct – object, which represents recognized structure.

generateImage(data: string, options: {  
    outputFormat: 'png' | 'svg';
    backgroundColor: string;
    bondThickness: number;
}): Promise<Blob>

Generates image from passed structure.
Parameters:
datastring representation of structure in any supported format.
options – object with the following properties:
* outputFormat – can be 'png' or 'svg'
* backgroundColor – image background color
* bondThickness – thickness of bonds in output structure

Settings

You can add extra configuration in editor.setSetting

Allowed parameters:

  • disableQueryElements: Disable the elements from the Extended Table
ketcher.setSettings({ "disableQueryElements": ["Pol", "CYH", "CXH"] })
  • general.dearomatize-on-load: Dearomatize the molecule when ketcher application starts
ketcher.setSettings({ "general.dearomatize-on-load": true })
  • ignoreChiralFlag: Ignore the chiral flag from .mol files
ketcher.setSettings({ "ignoreChiralFlag": true })

Contribution

See Contributing Guide.

License

Apache 2.0

Please read LICENSE and NOTICE for details.

Copyright (c) 2021 EPAM Systems, Inc.

ketcher's People

Contributors

aelyseev avatar alexeygirin avatar anamoskvina avatar andreimazol avatar captain2b avatar chgayane avatar daniilsavchuk avatar dmitrysigaev avatar elenaodnoshivkina avatar evgeniifrolov1 avatar ilya-asiyuk-epam avatar karen-sarkisyan avatar konstantinepam23 avatar magomedgasanov avatar mariia-katkova avatar nitvex avatar porcelain11 avatar qnan avatar r1z3risgod avatar rrodionov91 avatar rybalkin-ggasoftware avatar softcat23 avatar starlastarla avatar tomas-light avatar viktoriiafedotkina avatar viktormakarov-epam avatar vitaepam avatar yuleicul avatar zaimbeshich1 avatar zhirnoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ketcher's Issues

Introduce Graph format to Ketcher

Branch "format" contains MVP version of new internal format. Needs to clean up the code and prepare PR with viable version.

  1. Resolve all merge conflicts
  2. Check test coverage on new code and write if needed to reach 80%
  3. Verify that save/open actions support new format

getMolfile in v3000 format

It would be nice to have the ability to getMolfile from ketcher in v3000 format from this line. Wouldn't it be as simple as adding an arg which can be passed as an option to the stringify function?

function getMolfile(v3000) {
	return molfile.stringify(ketcher.editor.struct(),
		{ ignoreErrors: true,
                  v3000: v3000
                }
        );
}

Radicals rendering incorrectly after saving structure in InChi and InChi Auxinfo.

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Double click with SelectionTool at any atom.
  3. Note this atom as monoradical. Click OK.
  4. Double click with SelectionTool at another atom.
  5. Note this atom as diradical (singlet). Click OK.
  6. Double click with SelectionTool at another atom.
  7. Note this atom as diradical (triplet). Click OK.
  8. Click "Save as..." button.
  9. Select InChi format. Click "Save to file".
  10. Click "Save as..." button.
  11. Select InChi Auxinfo format. Click "Save to file".
  12. Clear the canvas.
  13. Open the file saved at 9th and 11th steps one by one.

Actual result
Radicals are replaced with other radicals or with charge.
For InChi:
image

For InChi Auxinfo:
image

Expected result
The radicals are displayed at the same way as before saving.

Stereo Labels and Stereo Flags for structures without stereocenters

In some cases atoms shouldn't have Stereo Labels and Stereo Flags and shouldn't be marked. For example, see screenshots:
cyclohexane
unsteric

These molecules don't have any stereocenters.

The user should have a possibility to turn off Stereo Labels and Stereo Flags for structures without stereocenters. Or Ketcher should automatically calculate if the atom is steric or not in order to mark only steric atoms and structures.

Epic link: #56

Backend integration documentation?

Currently I'm using ketcher on my own backend as I use it mainly as an input source.

It would be really nice to know what indigo service's quieries and answers look like to be able to integrate it correctly in my application.

Do you have any documentation on that?

Validate format conversion (warning messages)

Now warning messages like
'ERROR:SMILES data format doesn't support s-groups' warning should appear.'
*'ERROR:InChi data format doesn't support s-groups.'*don't appear. As example you can see defect
It's necessary to decide:

  1. Whether to display the warning message that file will not be saved or do not display it.
  2. How to realize it
  3. How this verification will be implemented: through the client or the server

Warnings.zip

Note

See the attached file with warnings and errors for different actions.

Note2
When user enters incorrect data in "Isotope" or "Charge" fields in "Atom Properties" menu, the error message "Error: is not of a type(s) integer" is appears.
It will be better if the message is something like that: "There must be integer".

Mount on DOM element

Hi,

Fantastic piece of software. Looking at using it in an application, is it possible to mount Ketcher on a DOM element instead of using in an iFrame, in a framework-agnostic way?

Need to create the warning message in the case if user tries to save incorrect structure in non-Mol format

It was decided to implement the next logic:

When user creates any structure that contains any incorrect properties, settings etc., when "Check Structure" contains any warnings or errors and then user tries to save such structure, the warning message should appear and warn user that this structure contains errors or incorrectness and user can lose some properties or the whole structure after saving in this format.

New saving format will possibly able to solve these problems.

SavedDifferentTypesStructuresDifFormats_Edited052018.zip

Warning message should appear for S-Groups and Data S-Group while saving in Extended SMILES and Inchi Auxinfo formats

Steps to reproduce:

  1. Open sec_butyl_abr.mol file in Ketcher.

sec_butyl_abr.zip

  1. Click the Save As button. Choose the 'Extended SMILES' format.

Actual Result:

No warning message appears

Expected Result

Warning message should appear:
"In Extended SMILES the structure will be saved without S-groups"

Note:
SMILES data format doesn't support s-groups warning should appear for all types of S-groups except the multiple Sgroup type

Blocked a frame with origin https://xxxxx from accessing a cross-origin frame.

Hi,

We have started using ketcher with indigo. We serve both from the same instance in a separate url from the main platform url where the user loads the page. Our server uses node.js and we have deployed indigo using nginx and certboot in docker-compose.

So, our platform and ketcher are served from different domains and these leads to the following error:

Blocked a frame with origin "xxxx" from accessing a cross-origin frame. 

But if ketcher is not served from the same domain than indigo there's CORS failures.

Any advise or solution? Using window.postMessage needs refactoring ketcher to reference our main domain.

Thanks

Chiral flag should be removed when all Up/Down stereobonds are removed

Steps to reproduce:

  1. Launch Editor.
  2. Create any chiral structure.
  3. Change all Up/Down stereobonds with Simple bonds.

Expected result:
Chiral flag disappears when all Up/Down stereobonds are removed.

Actual result:
Chiral flag stays at the canvas when all Up/Down stereobonds are removed.

Epic link: #56

Aromatic bonds are replaces with double bonds or disappear from structure after saving in inchi and inchi auxinfo-formats.

Steps to reproduce:

  1. Launch Editor.
  2. Create any structure, for example, chain.
  3. Replace any of the structure bond with aromatic bond.
  4. Click "Save as..." button.
  5. Select inchi format. Click "Save to file".
  6. Click "Save as..." button.
  7. Select inchi auxinfo format. Click "Save to file".
  8. Clear the canvas.
  9. Open saved at 5 and 7 steps structures one by one.

Actual result:
Aromatic bond is replaced with double bond:
image

Scenario 2:
Steps to reproduce:

  1. Launch Editor.
  2. Create any structure, for example, chain.
  3. Replace neighborhood structure bonds through one with double bond.
  4. Replace the bond between double bonds with aromatic bond.
  5. Click "Save as..." button.
  6. Select inchi format. Click "Save to file".
  7. Click "Save as..." button.
  8. Select inchi auxinfo format. Click "Save to file".
  9. Clear the canvas.
  10. Open saved at 6 and 8 steps structures one by one.

Actual result:
The aromatic bond disappears from the structure.
image

Fire custom event on structure change

When user changes structure on canvas would be good to fire "change" event with information about performed operation (e.g. { op: "AtomMove", from: { x: 10, y: 10 }, to: { x: 20, y: 20 }).
Now Ketcher is already firing empty "change" event. #3
Needs to investigate possibility to pass information about performed action to fired event.
Create format of custom event and apply it on all operations if previous right.

Fix Babel 7 migration

Updating to Babel 7.x requires changes in dependencies and configs. Previous merge broke the build script, needs to be fixed.

Adding/extending toolbar functionality in Ketcher

How hard is it to add new functionalities to the Ketcher toolbar? For instance, if I would like to have a new toolbar button which allows us to add enhanced stereo labels to the sketched molecule

Is there any API/hook which we could utilize to add new functionality buttons to the toolbar? Also, how feasible is it to edit the existing functionalities of the toolbar icons?

project still maintained?

Planning on using this in a potentially commercial app, any insights before I proceed?

Thanks in advance.

Last release was in 2018, so checking up.

Upgrade development dependency versions

  1. Bump the versions of dev dependencies to most recent ones to reduce the amount of npm audit security issues.
  2. Upgrade all deprecated dependencies to later version or replace them if needed.
  3. Update source code according to updated dependencies.
  4. Update IO and Render tests in order to work with new versions of dependencies.

Atom Generics (except A) and Special nodes are replaced with R# after saving in Daylight Smile format.

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Click Periodic table.
  3. Open Extended tab.
  4. Click the "A" button in the Atom Generic section, click the OK button and click any structure atom.
  5. Repeat steps 3-4 with other Atom Generics and Special nodes.
  6. Click "Save as" button. Select Daylight SMILE format. Click OK.
  7. Clear the canvas.
  8. Open the structure saved at 6th step.

Actual result
All Atom Generics and Special nodes are replaced with R#.
image

Expected result
Atom Generics and Special nodes should stay at the structure after user saves the structure in Daylight SMILE and opens it in Ketcher.
If it's impossible to save such structures in Daylight SMILE the warning message about this should appear in Save window before the saving.

SAVE and OPEN STRUCTURE with STEREO MARKS

As a Ketcher collaborator I'd like to verify saving stereo flags to MOL file and implement missed functionality.

1. Structure with Chiral Stereo flag
Structure with Chiral Stereo flag can be saved in both V2000 and V3000 file format.
• Mol file in V2000 format has the '1' in second string at the CTAB block:
Ketcher 10121612192D 1 1.00000 0.00000 0
9 8 0 1 0 999 V2000
• Mol file in V3000 format has the CFG value(s) near atom(s) (stereocenter) and near stereobond(s).

2. Structure with AND Enantiomer Stereo flag
Structure with AND Enantiomer Stereo flag can be saved in both V2000 and V3000 file format.
• Mol file in V2000 format has the '0' in second string at the CTAB block:
Ketcher 10121612192D 1 1.00000 0.00000 0
9 8 0 0 0 999 V2000
• Mol file in V3000 format has the CFG value(s) near atom(s) (stereocenter) and near stereobond(s).

3. Structure with OR Enantiomer Stereo flag
Structure with OR Enantiomer Stereo flag can be saved in V3000 file format only.
Mol file has
• the CFG value(s) near atom(s) (stereocenter) and near stereobond(s)and
• 'collection' at the CTAB end:
M V30 BEGIN COLLECTIONM V30 MDLV30/STEREL1 ATOMS=(1 9)
M V30 END COLLECTIONM V30 END CTAB

4. Structure with MIXED Stereo flag
Structure with MIXED Stereo flag can be saved in V3000 file format only.
Mol file has
• the CFG value(s) near atom(s) (stereocenter) and near stereobond(s)and
• 'collection' at the CTAB end:
M V30 BEGIN COLLECTIONM V30 MDLV30/STEABS ATOMS=(1 3)
M V30 MDLV30/STEREL1 ATOMS=(1 9)
M V30 MDLV30/STERAC1 ATOMS=(1 6)
M V30 END COLLECTIONM V30 END CTAB

Epic link: #56

Representation of Stereo Flags

The following behavior should be implemented to Stereo Flags:

  1. As soon as correct stereocenter appears on canvas, Stereo Flag should appear above the structure at the right side.
    StereoFlags1
  2. Stereo Flags should't appear for structures without correct stereocenters, for example:
    StereoFlags2
  3. User should be able to move Stereo Flag to any place on canvas, using any Selection Tool.
  4. Stereo Flag shouldn’t be overlapped with the structure.
  5. User should not be able to delete Stereo Flags, using 'Erase' button or 'Delete' button on keyboard.
  6. Stereo Flags for reactions. When reagents and products have stereocenters, Stereo Flags should appear above the corresponding structures at the right side of each structure having stereocenter. See the example:
    StereoFlags3
  7. Stereo Flags that were saved in reactions should be rendered correctly. See the example of incorrect rendering Stereo Flags.
    StereoFlags4
    Epic link: #56

Add drawing tool for simple objects

As a Ketcher collaborator I'd like to implement drawing tool in Ketcher to add capability for user to draw following elements on canvas:

  1. Circle,
  2. Rectangle

[EPIC] Enhanced Stereochemistry

PART 1
CREATE STEREO MARKS

  1. The ‘Stereochemistry’ button is present at the Atom toolbar.

  2. User clicks the ‘Stereochemistry’ button, ‘Enhanced Stereochemistry’ window is opened.

When canvas is empty or the created structure is without a stereocenter or with non-tetrahedral stereochemistry nothing is happened, the ‘Enhanced Stereochemistry’ window doesn’t appear.
When the structure with the correct tetrahedral stereochemistry is present on canvas and user selects the created structure, the ‘Enhanced Stereochemistry’ window appears.
When the structure with the correct tetrahedral stereochemistry is present on canvas and user doesn’t select anything on canvas, the ‘Enhanced Stereochemistry’ window appears.
When the structure with the correct tetrahedral stereochemistry is present on canvas and user selects the correct stereocenter, the ‘Enhanced Stereochemistry’ window appears.
When the structure with the correct tetrahedral stereochemistry is present on canvas and user selects several correct stereocenters, the ‘Enhanced Stereochemistry’ window appears.
When the structure with the correct tetrahedral stereochemistry is present on canvas and user selects the part of the structure without stereocenter, the ‘Enhanced Stereochemistry’ window doesn’t appear.
When several structures with the correct tetrahedral stereochemistry are present on canvas and user selects several correct stereocenters of the different structures or parts with stereocenters of the different structures or several structures, the ‘Enhanced Stereochemistry’ window appears.

Stereocenter must be marked with Single Up, Single Down, Single Up/Down bonds. Otherwise Ketcher won’t recognize it as a stereocenter, it won’t be possible to open the “Enhanced Stereochemistry” window to assign stereomarks.

  1. ‘Enhanced Stereochemistry’ window design:

‘Enhanced Stereochemistry’ title is present at the window header.
The stereochemistry settings are listed in the window:
• ABS
• Add to AND [ ] Group
• Add to OR [ ] Group
• Create new AND Group
• Create new OR Group

The radiobutton for each setting is present at the left side.
The fields for numbers entering are present for 'Add to AND [ ] Group' and 'Add to OR [ ] Group' settings. 'Add to AND [ ] Group' setting becomes available when at least one AND group has been created on the canvas. 'Add to OR [ ] Group' setting becomes available when at least one OR group has been created on the canvas. Only digital symbols are allowed for this fields!
'OK' and 'Cancel' buttons are present at the window bottom.

If one correct stereocenter is selected the appropriate radiobutton in the ‘Enhanced Stereochemistry’ window is checked (ABS/ Add to AND [N] Group/Add to OR [N] Group, where N is the number of a group)
If several stereocenters marked before are selected:
• All selected stereocenters have the same stereo mark, the appropriate radiobutton in the ‘Enhanced Stereochemistry’ window is checked.
• The selected stereocenters have different stereo marks, all radiobuttons in the ‘Enhanced Stereochemistry’ window are unchecked.

image

  1. Assign the Stereo marks.
    (Preconditions – IUPAC style of stereo labels display is selected. A structure with an absolute stereo configuration has been loaded or a new structure with the correct tetrahedral stereochemistry has been created. The structure has at least 3 stereocenters).

User selects one of the structure stereocenters, clicks ‘Stereochemistry’ button, 'ABS' radiobutton is checked by default. User chooses any unchecked radiobutton (e.g. 'Create new AND Group').
• Clicks the 'Cancel' button: ‘Enhanced Stereochemistry’ window is closed. No any stereo mark appears.
• Clicks the 'OK' button: ‘Enhanced Stereochemistry’ window is closed. &1 stereo mark appears below the selected stereocenter.
User selects another structure stereocenter, clicks ‘Stereochemistry’ button, chooses any unselected radiobutton, e.g. Add to AND [ ] Group, enters the number of a group ('1' in our example).
• Clicks the 'Cancel' button: ‘Enhanced Stereochemistry’ window is closed. No any stereo mark appears.
• Clicks the 'OK' button: ‘Enhanced Stereochemistry’ window is closed. ‘&1’ stereo mark appears below the selected stereocenter.

image

If several AND Groups/OR Groups have been already created user can assign a stereo mark by entering the number of one of the groups in the input field.
User selects a structure stereocenter, clicks ‘Stereochemistry’ button, chooses 'Add to AND [ ] Group' or 'Add to OR [ ] Group radiobutton.
• Enters or not the number of one of the created groups in the input field and clicks the 'Cancel' button: ‘Enhanced Stereochemistry’ window is closed. No any stereo mark appears.
• Enters the number of one of the created groups and clicks the 'OK' button: ‘Enhanced Stereochemistry’ window is closed. ‘&N’ or ‘orN’ stereo mark appears below the selected stereocenter (Where N is the number of the created group).
• Leaves the input field without changes. The 'OK' button is disabled.
User selects the previously marked stereocenter (for example ‘&1’), clicks the ‘Stereochemistry’ button, chooses radiobutton for another stereo mark (e.g. 'ABS').
• Clicks the 'Cancel' button: the ‘Enhanced Stereochemistry’ window is closed. The previously marked stereocenter (for our example ‘&1’) is not changed.
• Clicks the 'OK' button: the ‘Enhanced Stereochemistry’ window is closed. The previously assigned stereo mark (for our example ‘&1’) disappear (as 'abs' stereo marks are not shown when IUPAC style of stereo labels display is selected).
User selects several previously marked stereocenters, clicks ‘Stereochemistry’ button, chooses any radiobutton, e.g. 'Create new OR Group'.
• Clicks the 'Cancel' button: ‘Enhanced Stereochemistry’ window is closed. All previously marked stereocenters have the initial marks.
• Clicks the 'OK' button: ‘Enhanced Stereochemistry’ window is closed. All previously marked stereocenters are replaced with the selected one (‘orN’ for our case).

  1. Stereo Flags
    • User creates a new structure with correct stereocenter. As soon as he adds the Stereo Bond to the stereocenter, no stereo mark appears below the stereocenter, ABS (Chiral) stereo flag appears above the structure at the right side:

image

• User selects the stereocenter (or whole structure), clicks ‘Stereochemistry’ button - 'ABS' radiobutton is selected, chooses 'Create new AND Group' radiobutton and clicks the 'OK' button. No stereo mark appears below the stereocenter, the AND Enantiomer stereo flag appears above the structure at the right side.
• User selects the stereocenter (or whole structure), clicks ‘Stereochemistry’ button, chooses 'Create new OR Group' radiobutton and clicks the 'OK' button. No stereo mark appears below the stereocenter, the OR Enantiomer stereo flag appears above the structure at the right side:

image

If the structure stereocenters have the different stereo marks, the MIXED stereo flag appears above the structure.
• User adds a new stereobond. As soon as he adds the Stereo Bond to the stereocenter, the ‘or1’ stereo mark appears below the previously created stereocenter, the MIXED stereo flag appears above the structure at the right side:

image

If all structure stereocenters have the identical stereo marks, the appropriate stereo flag appears above the structure.
• User selects the newly created stereocenter, clicks the ‘Stereochemistry’ button, chooses 'Add to OR [1] radiobutton and clicks the 'OK' button. The stereo marks have disappeared, the OR Enantiomer stereo flag appears above the structure at the right side:

image

If several structures with the correct stereocenters are present on the canvas, each structure has the separate stereo flag.

image

PART 2

SAVE and OPEN STRUCTURE with STEREO MARKS

  1. Structure with Chiral Stereo flag

Structure with Chiral Stereo flag can be saved in both V2000 and V3000 file format.
• Mol file in V2000 format has the '1' in second string at the CTAB block:
Ketcher 10121612192D 1 1.00000 0.00000 0
9 8 0 1 0 999 V2000
• Mol file in V3000 format has the CFG value(s) near atom(s) (stereocenter) and near stereobond(s).

  1. Structure with AND Enantiomer Stereo flag

Structure with AND Enantiomer Stereo flag can be saved in both V2000 and V3000 file format.
• Mol file in V2000 format has the '0' in second string at the CTAB block:
Ketcher 10121612192D 1 1.00000 0.00000 0
9 8 0 0 0 999 V2000
• Mol file in V3000 format has the CFG value(s) near atom(s) (stereocenter) and near stereobond(s).

  1. Structure with OR Enantiomer Stereo flag

Structure with OR Enantiomer Stereo flag can be saved in V3000 file format only.
Mol file has
• the CFG value(s) near atom(s) (stereocenter) and near stereobond(s)and
• 'collection' at the CTAB end:
M V30 BEGIN COLLECTIONM V30 MDLV30/STEREL1 ATOMS=(1 9)
M V30 END COLLECTIONM V30 END CTAB

  1. Structure with MIXED Stereo flag

Structure with MIXED Stereo flag can be saved in V3000 file format only.
Mol file has
• the CFG value(s) near atom(s) (stereocenter) and near stereobond(s)and
• 'collection' at the CTAB end:
M V30 BEGIN COLLECTIONM V30 MDLV30/STEABS ATOMS=(1 3)
M V30 MDLV30/STEREL1 ATOMS=(1 9)
M V30 MDLV30/STERAC1 ATOMS=(1 6)
M V30 END COLLECTIONM V30 END CTAB

Note
About the V3000 file format for the stereo structures you can read in the attached ctfile_2007.pdf file.

  1. Open file with structure with Stereo flags

Any mol-file (V2000 or V3000) with structure(s) with Chiral (Absolute)/ AND Enantiomer/ OR Enantiomer/ Mixed Stereo flags and abs/&/or stereo marks should be opened without any problems.
All stereo marks and Stereo flags should be rendered correctly.

Molecule with some stereocenters, with no enhanced stereochemical labels but with Chiral flag (read from Molfile V2000) is equivalent (in terms of exact structure match) to molecule where all valid tetrahedral stereocenters belong to ABS stereogroup.
Molecule with some stereocenters, with no enhanced stereochemical labels and without Chiral flag (read from molfile V2000) is equivalent (in terms of exact structure match) to molecule where all valid tetrahedral stereocenters belong to the same AND stereogroup.

  1. Open the saved in Ketcher file with structure with Stereo flags in other structure editors

Any saved in Ketcher mol-file (V2000 or V3000) with structure(s) with Chiral / AND Enantiomer/ OR Enantiomer/ Mixed Stereo flags and abs/&/or stereo marks should be opened in other structure editors (Marvin, ChemDraw, Biovia Draw) without any problems.
All stereo marks and Stereo flags should be rendered correctly.

  1. When a structure with Stereo flag is saved in ket:

• If user doesn't move the Stereo flag the information about the coordinates is not present in ket file and their values are set by default.
• If user moves the Stereo flag (to a new position or it is returned to the initial position after being moved) its coordinates are present in ket file. After opening the saved ket file the Stereo flag appears at the position in which it was before saving.

PART 3

SETTINGS for the STEREO FLAGS and STEREO MARKS

In the ‘Settings’ user is able to specify the preferences for the rendering of the stereochemistry flags and labels.
• Colors:
• Color of Absolute Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at absolute stereogenic centers.
• Color of AND Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at AND stereogenic centers.
• Color of OR Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at OR stereogenic centers.
• Color stereogenic centers - Specifies how color is used with one of the following values:
• Labels only

image

Note: in BIOVIA Draw the default colors for stereocenters are:

Absolute – Red;
AND – MediumBlue
OR – ForestGreen
The color for the next label (AND1, AND2, AND3 or OR1, OR2, OR3…) is a little lighter then for previous one.

image

• Label Display At Stereogenic Centers - Specifies how labels for stereogroups are displayed at individual tetrahedral stereogenic centers.

IUPAC Style (should be selected by default)
Classic
On
Off
The following table shows the four options:

image

• User can change the text of the four Stereo flags as follows:

Text of Absolute flag – Set text of absolute chirality flag
Text of AND flag – Set text of AND chirality flag
Text of OR flag – Set text of OR chirality flag
Text of Mixed flag – Set text of Mixed chirality flag.
Note to hide the chirality flags, delete the text of the chirality flags.

• User can change the Font styles for the Stereo label and Stereo Flag texts.

R pseudoatom is replaced with R# (RGroup) after saving in Extended SMILES and CML formats.

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Click Periodic table.
  3. Open Extended tab.
  4. Click the "R" button in the Special nodes section, click the OK button and click any structure atom.
  5. Click "Save as" button. Select Extended SMILE format. Click OK.
  6. Clear the canvas.
  7. Open the structure saved at 5th step.

Actual result
The R pseudoatom is replaced with R#.
image

If user clicks R# with Selection Tool R-Group window is opened. If user clicks Check Structure, the window contains the information "R-Groups warning: Structure contains RGroup components".
image

Expected result
R should stay R pseudoatom after saving in Extended SMILE and should not became RGroup.
The same problem is when user saves the structure in CML-format.

Migrate Ketcher to React

This moment Ketcher is based on preact library. In order to follow market trends it is required to migrate solution from preact to React.

Query atom properties disappear from the structure after saving in Daylight and Extended SMILES-format.

Steps to reproduce:

  1. Launch Editor.
  2. Create any structure, for example, chain.
  3. Double click any structure atom.
  4. In the open "Atom properties" window select any query atom property, click OK.
  5. Repeat previous step with another atom and another query atom property.
  6. Click "Save as..." button.
  7. Select Dayligt SMILE format. Click "Save to file".
  8. Click "Save as..." button.
  9. Select Extended SMILE format. Click "Save to file".
  10. Clear the canvas.
  11. Open saved at 5 and 7 steps structures one by one.

Actual result:
The query atom properties disappear from the structure.
In Extended smile format "H count" is replaced with double radical

Expected result:
The added atom properties stay at the structure.

The structure with any Atom Generic and R, Pol or H+ can be saved but can't be opened after saving in Daylight SMARTS format.

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Click Periodic table.
  3. Open Extended tab.
  4. Click Pol in the Special Nodes section, click the OK button and click any structure atom.
  5. Click "Save as" button. Select Daylight SMART format. Close warning message.
  6. Click Periodic table.
  7. Open Extended tab.
  8. Click any button in the Atom Generic section, for example, A, click the OK button and click another structure atom.
  9. Click "Save as" button. Select Daylight SMART format. Click OK.
  10. Clear the canvas.
  11. Open the structure saved at 5th step.

Actual result
After 5th step when user tries to save the structure with Pol, the message "Indigo Exception: SMILE saver: SMARTS format availible for quary only" appears on the screen.
image

When any Atom Generic and Pol, R or H+ (for example, A and Pol, M and H+ etc.) present at the structure, the structure can be saved in Daylight Smart format, but can't be opened. The error message appears at the screen "Indigo Exception: molecule auto loader: SMILES loader: empty atom?" :
image

Expected result:
The structure after opening from saved file should display at the same way as before saving. If the editor can't support such structure, warning message about it should appear before the saving and structure shouldn't be saved.

Note:
I checked combinations of Special Nodes and Atom Generics:

Special node\Atom Generic A AH Q QH M MH X XH
can't opened can't opened can't opened can't opened can't opened can't opened can't opened can't opened
can't opened can't opened can't opened can't opened can't opened can't opened can't opened can't opened
OK OK OK OK OK OK OK OK
OK OK OK OK OK OK OK OK
can't opened can't opened can't opened can't opened can't opened can't opened can't opened can't opened

Impossible to save nested S-Groups in Extended SMILES and SMARTS formats

Steps to reproduce:

  1. Open attached Combination_Sgroups.molfile in Ketcher. Combination_Sgroups.mol
    Combination_Sgroups.zip
  2. Click the Save As button. Choose the 'Extended SMILES' format.

Actual Result:
Error message appears: Convert error! IndigoException: SMILES saver: overlapping (nested?) repeating units can not be saved.
The developer's console contains the message: /v2/indigo/convert 400 (BAD REQUEST)

Expected Result

User should be able to save nested S-Groups in Extended SMILES and SMARTS formats

Note:
The same situation can be observed while saving in SMARTS format

Atom Generics (except A and Q) disappear from structure after saving in CML format

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Click Periodic table.
  3. Open Extended tab.
  4. Click the "AH" button in the Atom Generics section, click the OK button and click any structure atom.
  5. Click "Save as" button. Select CML format. Click OK.
  6. Clear the canvas.
  7. Open the structure saved at 5th step.

Expected result:
Atom Generics should stay at the structure after saving and display in the same way as before saving.

Actual result
The AH atom Generic disappears from the structure in spite of presence AH in the CML formula in the "Open" window.
image

FYI, A and Q stay at the structure after saving.
If at the structure there are a or Q and any other atom generics (that dissapeared when present at the structure alone), in this case the both atom generics stay at the structure after saving.
If at the structure there are several atom generics except A and Q, in this case all atom generics dsappears from the strcture after saving.

Incorrect rendering of Stereo Flags in reactions

Steps to Reproduce:

  1. Create any reaction with multiple reagents and products. Reagents and products should contain Stereo Labels and Stereo Flags.
  2. Click 'Save as' button and save the created reaction in Graph Format.
  3. Open saved in .ket file in Ketcher.

Actual Result:
Reaction_opened
All Stereo Flags were moved to the right top corner.

Expected Result:
StereoFlags_reaction_saved

All Stereo Flags should appear at the right top corner.

Epic link: #56
Relates to: #57

The structure with non-default periodic table atoms rendering incorrectly after saving in inchi format

Steps to reproduce

  1. Launch application
  2. Create any structure, for example, chain.
  3. Open Periodic table.
  4. Select Calcium, click OK.
  5. Click any non-terminal structure atom.
  6. Click "Save as" button.
  7. In the "Format" field select inchi. Click "Save to file" button.
  8. Clear the canvas.
  9. Open saved in 7th step file.

Actual result
The structure is broken, some atoms are replaced with radicals.
image

If there are several non-carbon atoms at the structure, the structure is broken into several structures:
image

Expected result
The structure should open after saving in the same form as it was created.

The structure with Rmember saved in CML-format cannot be open.

Steps to reproduce

  1. Create any structure, for example, chain.
  2. With RGroup Fragment tool assign this structure as RGroup member, for example, R3.
  3. Click "Save as..." button.
  4. Select CML format. Click "Save to file".
  5. Clear the canvas.
  6. Open the file saved at 4th step.

Actual result
When user saves the R Member structure no error or warning message appears at the screen. But when user tries to open this saved file, error message "Syntax error: unexpected token < in JSON at position 0" appears, the file isn't opened.
image

Expected result
I suppose that there are two variants to solve this problem:

  1. We should support such structure and Ketcher should open them in correct way.
  2. If the first variant is impossible, we should not to allow user to save such structures, warn user with message. The possibility of saving the files that cannot be opened should be disabled.

The structures with atoms with valences rendering incorrectly after saving

Steps to reproduce

  1. Launch application
  2. Create any structure, for example, chain.
  3. Double click any structure carbon atom.
  4. In the opened "Atom properties" window select Valence 0 (zero). Click OK.
  5. Click "Save as" button.
  6. In the Format field set "Daylight SMILE". Click "Save to file" button.
  7. Clear the canvas.
  8. Open saved in 6th step file.

Actual result
The atom with added valence is replaced with diradical (singlet).
Other variants show in the table:

Valence\Format MOL Daylight Smile Extended Smile Daylight SMART Inchi Inchi Auxinfo CML
0 OK is replaced with diradical disappears Can't be saved disappears disappears disappears
1 OK is replaced with diradical disappears Can't be saved disappears disappears OK
2 OK is replaced with diradical is replaced with diradical Can't be saved is replaced with triplet is replaced with diradical OK
3 OK is replaced with monoradical is replaced with monoradical Can't be saved is replaced with monoradical is replaced with monoradical OK
4 OK disappears disappears Can't be saved disappears disappears OK
5 OK OK OK Can't be saved OK OK OK
6 OK OK OK Can't be saved OK OK OK
7 OK OK OK Can't be saved OK OK OK
8 OK OK OK Can't be saved OK OK OK

This table is about carbon atom. For other atoms it can be different behavior.

Expected result:
The structures with added valences should saved and opened as they were created. In the case if such structure can't be saved the warning message should appear and warn user that the valences can be lost after saving.

Support for dative bonds

Hi, it would be great if Ketcher supported dative bonds. These are especially common for metal complexes used as e.g. catalysts. Note that RDKit SMILES supports dative bonds via <- and ->; see https://www.rdkit.org/docs/RDKit_Book.html#dative-bonds.

Background: We are using Ketcher as the interactive structure editor for the Open Reaction Database and several of our alpha testing submissions involve organometallic catalysts. See the discussion on open-reaction-database/ord-data#14. Support for dative bonds would significantly reduce the burden for users to encode these catalysts when using our web-based reaction editor.

cc: @connorcoley

Colors for the STEREO FLAGS and STEREO MARKS

As a Ketcher collaborator I'd like to implement rendering colors of the stereochemistry flags and labels.

In the ‘Settings’ user is able to specify the preferences for the rendering of the stereochemistry flags and labels.
Colors:
• Color of Absolute Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at absolute stereogenic centers.
• Color of AND Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at AND stereogenic centers.
• Color of OR Centers - Specifies the color in which the stereo bonds, stereogroup labels, or both are displayed at OR stereogenic centers.
• Color stereogenic centers - Specifies how color is used with one of the following values:
a) Labels only
labels
b) Bonds only
bonds
c) Labels and Bonds
labels-bonds
d) Off
color-Off

Draw the default colors for stereocenters are:
Absolute – Red;
AND – MediumBlue
OR – ForestGreen
The color for the next label (AND1, AND2, AND3 or OR1, OR2, OR3…) is a little lighter then for previous one.
labels-color

Part 3 in Epic #56

Some query bonds are replaced with Single bond after saving in SMILES-format

Steps to reproduce:

  1. Launch Editor.
  2. Create any structure, for example, chain.
  3. Replace any of the structure bond with single/double bond.
  4. Click "Save as..." button.
  5. Select Dailigt SMILE format. Click "Save to file".
  6. Click "Save as..." button.
  7. Select Extended SMILE format. Click "Save to file".
  8. Clear the canvas.
  9. Open saved at 5 and 7 steps structures one by one.

Expected result:

The single/double bond stays at the structure.

Actual result:

Single/Double bond is replace with Single bond.
In the table you can see which query bonds are replaced with single bond:

The type of bond Daylight SMILE Extended SMILE
any bond Is opened correctly is replaced with single bond
aromatic bond Is opened correctly Is opened correctly
single/Double bond Is replaced with single bond Is replaced with single bond. In SMILE-string there are "//"-signs
single/aromatic bond is replaced with single bond Is replaced with single bond
Double/aromatic bond Is replaced with single bond Is replaced with single bond. In SMILE-string there are "//"-signs

installation

Hi
when i do npm start -- --miew-path=<miew-dir> or npm run build -- --miew-path=<miew-dir>
It says that the command isn't correct .

The "double" Rgroup labels are replaced with R# when user saves the structure in CML-format.

Steps to reproduce:

  1. Create any structure.
  2. With the R-Group Label Tool set any label for any structure atom, for example, R1.
  3. Click the 'Save As' button. Choose the CML-format.

Actual correct result

The structure is saved and opened correctly.

  1. With the R-Group Label Tool set any other label for the same structure atom. Now two labels present on the atom.
  2. Click the 'Save As' button. Choose the CML-format.
  3. Clear the canvas.
  4. Click "Open..." button, open saved in 5th step structure.

Actual result:
The R-Labels are replaced with R#.

Steps to reproduce:

  1. Create any structure.
  2. With the R-Group Label Tool set any label for any structure atom, for example, R1.
  3. Click the 'Save As' button. Choose the CML-format.

Actual correct result

The structure is saved and opened correctly.

  1. With the R-Group Label Tool set any other label for the same structure atom. Now two labels present on the atom.
  2. Click the 'Save As' button. Choose the CML-format.
  3. Clear the canvas.
  4. Click "Open..." button, open saved in 5th step structure.

Actual result:
The R-Labels are replaced with R#.
image

The check structure contains the message that RLabels present at the canvas:

Nevertheless when user wth R-Group Label Tool clicks this R# atom, no R-Labes are selected in the opened window:

Expected result:
The structure is opened in the same view that before saving - the both RLabels presents at the structure and when users clicks the atom with R-Group Label Tool, these rLabels are selected in the opened window.

The check structure contains the message that RLabels present at the canvas:
image

Nevertheless when user wth R-Group Label Tool clicks this R# atom, no R-Labes are selected in the opened window:
image

Expected result:
The structure is opened in the same view that before saving - the both RLabels presents at the structure and when users clicks the atom with R-Group Label Tool, these rLabels are selected in the opened window.

Label Display At Stereogenic Centers for the STEREO FLAGS and STEREO MARKS

As a Ketcher collaborator I'd like to implement the following settings for enhanced stereochemistry in Ketcher.

Specifies how labels for stereogroups are displayed at individual tetrahedral stereogenic centers.
IUPAC Style (should be selected by default)
Classic
On
Off
The following table shows the four options:
display-labels

Part 3 in Epic #56

Query bond properties can't be saved in Daylight SMARTS and SMILES (Daylight and Extended) formats

Steps to reproduce

  1. Draw any structure, for example, using a chain tool.
    image
  2. Apply all possible Bond properites.
  3. Click the Save As button. Choose the 'Daylight SMARTS' format
  4. Open the saved file in Ketcher and compare two structures.

Actual result
image

Query bond properties are lost after opening the saved file.

Expected result

Query bond properties should be saved in SMARTS format and correctly represented in Ketcher.

Note:
The same problem is with Daylight SMILES and Extended SMILE.

Migrate Gulp task to Webpack

The current version of Ketcher is based on CRA Typescript template. In order to reuse all infrastructure benefits provided by it it is necessary to migrate exisiting Gulp task to webpack by adding new loaders.
In scope of this task:

  • add possibility to extend default webpack configuration of CRA
  • add *.less loader
  • add *.md loader
  • generate build info
  • tasks to run tests are OOS

The structure with query atom properties can be saved in SMARTS-format but cannot be opened.

Steps to reproduce:

  1. Launch Editor.
  2. Create any structure, for example, chain.
  3. Double click any structure atom.
  4. Select any value for any query atom property, for example, Ring bond count. Click OK.
  5. Click "Save as..." button.
  6. Select Dayligt SMART format. Click "Save to file".
  7. Clear the canvas.
  8. Open saved at 6 step structure.

Actual result:
The error message appears at the screen: "Indigo Exception: molecule auto loader: SMILES loader: empty atom?"
image

Expected result:
I suppose that there are two varioants to solve this problem:

  1. We should support such structure and Ketcher should open them in correct way.
  2. If the first variant is impossible, we should not to allow user to save such structures, warn user with message. The possibility of saving the files that cannot be opened should be disabled.

Recognize Molecule: pictures in tif-format cannot be loaded

Steps to reproduce

  1. Click the 'Recognize Molecule' button.
  2. Click the 'Choose File' button.
  3. Choose the *.tif picture.
    tif.zip

Actual result

'Error, it isn't a picture' error message appears.

Expected result

*.tif pictures should be loaded and recognized

The structure with AH from Atom Generics is rendered incorrectly after saving in Daylight SMARTS format

Steps to reproduce

  1. Create any structure, for example, chain.
  2. Click Periodic table.
  3. Open Extended tab.
  4. Click the "AH" button in the Atom Generics section, click the OK button and click any structure atom.
  5. Click "Save as" button. Select Daylight SMART format. Click OK.
  6. Clear the canvas.
  7. Open the structure saved at 5th step.

Actual result
The structure is rendered incorrectly - all atoms except the terminal ones are replaced with diradicals (singlets), terminal atoms display with minus charge.
image

Expected result
The structure should display in the same way as before saving.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.