vibesketch.document.ket¶
The KET bridge: between the canvas engine’s JSON and RDKit molecules.
KET is Ketcher’s document format. Reading goes KET to a molfile to RDKit, so wedge bonds become stereo centres and double-bond geometry becomes E/Z exactly as a molfile reader would see them. KET coordinates have the same orientation as a molfile’s, so no axis flips. Writing goes RDKit to KET with a bond length of 1.0, the length Ketcher draws with.
Anything the reader cannot turn into a well-defined molecule is reported,
never guessed: query atoms and bonds, R-groups, polymer brackets and
valence errors make a fragment unsupported with the reason.
Module Attributes
The bond length Ketcher draws with, in KET units. |
|
|
Horizontal gap between laid-out items, in bond lengths. |
The KET arrow mode that draws each of the document's arrow kinds. |
|
|
Vertical gap between the rows of a scheme, in bond lengths. |
Functions
|
Why a KET molecule cannot be read as a plain structure, or |
|
A molfile for KET atoms and bonds, in their order; callers check |
|
The molecules, arrows, plus signs and text on a KET canvas. |
|
A KET document laying |
Classes
|
|
|
One connected molecule on the canvas. |
|
What the canvas holds, in chemical terms. |
|
|
|
One reaction row: the molecules at the arrow's tail and head, and what is at it. |
- vibesketch.document.ket.ARROW_MODES = {'equilibrium': 'equilibrium-open-angle', 'forward': 'open-angle', 'resonance': 'both-ends-filled-triangle', 'retrosynthetic': 'retrosynthetic'}¶
The KET arrow mode that draws each of the document’s arrow kinds.
- vibesketch.document.ket.BOND_LENGTH = 1.0¶
The bond length Ketcher draws with, in KET units.
- class vibesketch.document.ket.KetArrow(tail: 'tuple[float, float]', head: 'tuple[float, float]', mode: 'str')¶
Bases:
object
- class vibesketch.document.ket.KetFragment(mol, node, centre, bounds, unsupported=None)¶
Bases:
objectOne connected molecule on the canvas.
- Parameters:
- class vibesketch.document.ket.KetScene(fragments=<factory>, arrows=<factory>, pluses=<factory>, texts=<factory>)¶
Bases:
objectWhat the canvas holds, in chemical terms.
- Parameters:
- fragments: list[KetFragment]¶
- class vibesketch.document.ket.SceneStep(tail, head, reagents=<factory>, arrow='forward', conditions=<factory>)¶
Bases:
objectOne reaction row: the molecules at the arrow’s tail and head, and what is at it.
- Parameters:
- vibesketch.document.ket.molecule_reason(molecule)¶
Why a KET molecule cannot be read as a plain structure, or
None.
- vibesketch.document.ket.molfile(atoms, bonds)¶
A molfile for KET atoms and bonds, in their order; callers check
molecule_reason()first.
- vibesketch.document.ket.read_scene(ket)¶
The molecules, arrows, plus signs and text on a KET canvas.
- vibesketch.document.ket.write_scene(molecules, *, reaction=None, conditions=None, steps=None)¶
A KET document laying
moleculesout in a row, or a reaction scheme.With
reaction=(reactants, reagents, products)the row is the reactants joined by plus signs, an arrow with the reagents above it and theconditionsbelow, then the products. Withstepseach step is such a row, the rows one below the other, a species that takes part in several steps drawn in each, andmoleculesin a last row.