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.
At this moment Ketcher can be embedded into your application in two ways:
Look at the following link for details.
You can find the instruction for service installation here.
Project | Status | Description |
---|---|---|
ketcher-core | Core functionality: domain, shared services, functions and interface declarations | |
ketcher-standalone | Contains only the functionality necessary to start Ketcher in standalone mode | |
ketcher-react | Package contains only the functionality necessary to define components. | |
ketcher-macromolecules | Package contains the macromolecules editor functionality and UI components |
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.
Starting with version 3.0, Ketcher supports a new control in the top toolbar that allows switching to macromolecules editing mode. If you prefer having only small molecules editing mode available, you can remove the mode switcher from the toolbar by passing disableMacromoleculesEditor
property to the Editor
component.
import { Editor } from 'ketcher-react';
const App = () => {
return (
<Editor
{/* ...rest of the properties */}
disableMacromoleculesEditor
/>
);
};
Please refer to the example/src/App.tsx
file for a complete example of how to integrate Ketcher editor into your application.
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, options?: Object): Promise<void>
β draws passed structure on the canvas. Before drawing passed structure, current structure will be removed. The editor viewport will automatically adjust to fit all structures after insertion.
Parameters:
structure: string
. Structure is a string in any supported format.options?: { position?: { x: number, y: number } }
. β (Optional) βpositionβ - coordinates of top left corner of inserted structure in angstroms. Y coordinate value increases from bottom to top.addFragment(structure: string, options?: Object): Promise<void>
β adds the given structure to the canvas without altering the current structure. The editor viewport will automatically adjust to fit all structures after insertion.
Parameters:
structure: string
. Structure is a string in any supported format.options?: { position?: { x: number, y: number } }
. β (Optional) βpositionβ - coordinates of top left corner of inserted structure in angstroms. Y coordinate value increases from bottom to top.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:
data
β string
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
updateMonomersLibrary(monomersData: string | JSON): void
β given the monomers data, perform upsert operation for the built-in monomers library in the macromolecules editor. Might be invoked only when macromolecules editor is turned on. Update (replace) operation is performed for the particular monomer if its alias and class are matching with the existing one. Otherwise, insert operation is performed.
Parameters: monomersData: string | JSON
β monomers description in KET format being formatted as either JSON notation or this JSON being stringified to be more concise.
You can add extra configuration in editor.setSettings
Allowed parameters:
ketcher.setSettings({ "disableQueryElements": ["Pol", "CYH", "CXH"] })
ketcher.setSettings({ "general.dearomatize-on-load": true })
ketcher.setSettings({ "ignoreChiralFlag": true })
See Contributing Guide.
Please read LICENSE and NOTICE for details.
Copyright (c) 2021 EPAM Systems, Inc.