-
analysisRings(options) → {Hash}
-
Returns ring system details of structure fragment.
Parameters:
Name |
Type |
Description |
options |
Hash
|
Options to find rings. Can include the following fields:
{
bondTypes: []
}
If this param is not set, Kekule.globalOptions.algorithm.ringSearch will be used. |
- Inherited From:
- Source:
Returns:
Ring info of ctab, now has one field {ringBlocks: []} in which ringBlocks is
An array, each items in it is a cycle block detail. Item containing a series of hash with fields:
{
connectors: Array of all vertexes in cycle block.
nodes: Array of all edges in cycle block.
allRings: Array of all rings in cycle block, each item list connectors and nodes of one ring.
sssrRings: Array, each item containing connectors and nodes in a SSSR member ring.
}
-
Type
-
Hash
-
appendAnchorNode(node)
-
Add anchor node of container. If node not in nodes container, nothing will be done.
Parameters:
- Inherited From:
- Source:
-
appendBond(nodesOrIndexes, bondOrder, bondType) → {Kekule.Bond}
-
A util method to create a new bond object connected with nodes and append to current connection table.
Parameters:
Name |
Type |
Description |
nodesOrIndexes |
Array
|
Array of connected nodes or indexes of those nodes |
bondOrder |
Int
|
Order of bond. |
bondType |
Int
|
Type of bond. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.Bond
-
appendConnector(connector)
-
Add connector to container.
Parameters:
- Inherited From:
- Source:
-
appendLinkedConnector(connector)
-
Link a connector to this node.
Parameters:
- Inherited From:
- Source:
-
appendNode(node)
-
Add node to container. If node already in container, nothing will be done.
Parameters:
- Inherited From:
- Source:
-
-
Calculate molecular formula from this connection table.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.MolecularFormula
-
canonicalize(canonicalizerId)
-
Canonicalize a structure fragment by canonicalizer. If canonicalizerId is not set,
the default one will be used.
Parameters:
Name |
Type |
Description |
canonicalizerId |
String
|
|
- Inherited From:
- Source:
-
clean(options)
-
Clean the structure in ctab, removing illegal nodes and connectors.
Parameters:
Name |
Type |
Description |
options |
Hash
|
An option hash, can including fields: {orphanChemNode, hangingChemConnector}. |
- Inherited From:
- Source:
-
clear()
-
Clear all CTab and formula struuctures.
- Inherited From:
- Source:
-
clearAnchorNodes()
-
Remove all anchor nodes.
- Inherited From:
- Source:
-
clearConnectors()
-
Remove all connectors.
- Inherited From:
- Source:
-
clearNodes()
-
Remove all nodes.
- Inherited From:
- Source:
-
compareStructure(targetObj, options) → {Int}
-
Explicit set compare method to chem structure and compare to targetObj.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
equalStructure(targetObj, options) → {Bool}
-
Check if this object and targetObj has equivalent chem structure.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
-
Get charge marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemMarker.ChemPropertyMarker
-
-
Get radical marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemMarker.ChemPropertyMarker
-
findAllRings() → {Array}
-
Returns all rings in a structure fragment.
- Inherited From:
- Source:
Returns:
An array containing a series of hash with fields:
{
connectors: Array of all found connectors.
nodes: Array of all found nodes.
}
Each array item marks a ring.
-
Type
-
Array
-
findAromaticRings(allowUncertainRings, candidateRings) → {Array}
-
Perceive and all aromatic rings in molecule, same as method perceiveAromaticRings.
Parameters:
Name |
Type |
Description |
allowUncertainRings |
Bool
|
Whether uncertain rings (e.g., with variable atom) be included in result. |
candidateRings |
Array
|
Rings in ctab that the detection will be performed.
If this param is not set, all memebers of SSSR of ctab will be checked. |
- Inherited From:
- Source:
Returns:
Found aromatic rings.
-
Type
-
Array
-
findCycleBlocks(graph) → {Array}
-
Returns all connectors and nodes in cylce block.
Parameters:
- Inherited From:
- Source:
Returns:
An array containing a series of hash with fields:
{
connectors: Array of all found connectors.
nodes: Array of all found nodes.
}
Each array item marks a cycle block.
-
Type
-
Array
-
-
Returns the direct node/substructure that contains originObj.
originObj may be a child node or connector of substructure in this structure fragment.
If originObj is actually not in this ctab, null will be returned.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
findSSSR() → {Array}
-
Returns Smallest set of smallest rings of structure fragment.
- Inherited From:
- Source:
Returns:
An array containing a series of hash with fields:
{
nodes: Array of all found nodes.
connectors: Array of all found connectors.
}
Each array item marks a SSSR ring.
-
Type
-
Array
-
getAbsBaseCoord(coordMode, allowCoordBorrow) → {Hash}
-
Get absolute center coord of object.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
|
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Hash
-
getAllAutoScaleRefLengths(coordMode, allowCoordBorrow) → {Array}
-
Returns all length factors in object to help the scale ratio in autoscale mode.
To molecule, typically this is the all of bond lengths.
If no length can be found in this object, [] will be returned.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
|
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getAllChildConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Inherited From:
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
getAllContainingConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Inherited From:
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
-
Get anchor node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getAnchorNodeCount() → {Int}
-
Return count of anchorNodes.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
getAutoScaleRefLength(coordMode, allowCoordBorrow) → {Float}
-
Returns length factor in object to help the scale ratio in autoscale mode.
To molecule, typically this is the median of bond length.
If no length can be found in this object, null will be returned.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
|
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Float
-
getBaseCoord(coordMode, allowCoordBorrow) → {Hash}
-
Get center coord of object.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
|
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Hash
-
getBelongedRingMinSize() → {Int}
-
Returns the min size of all belonged rings.
- Inherited From:
- Source:
Returns:
Min ring node count. If the object is not belonged to any ring, null will be returned.
-
Type
-
Int
-
getBelongedSssrRings() → {Array}
-
Returns SSSR ring that this object belonged.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getChildAt(index) → {Variant}
-
Get child object (including both nodes and connectors) at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Variant
-
getChildCount() → {Int}
-
Get count of child objects (including both nodes and connectors).
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Get connector at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
-
Get a structure connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getConnectorCount() → {Int}
-
Return count of connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Returns median of all connector lengths.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
|
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Float
-
-
Get connector between this object and another object.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getContainerBox(coordMode, allowCoordBorrow) → {Hash}
-
Calculate the box to fit all sub molecule.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Determine to calculate 2D or 3D box. Value from Kekule.CoordMode. |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getContainerBox2D(allowCoordBorrow) → {Hash}
-
Calculate the 2D box to contain the object.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getContainerBox3D(allowCoordBorrow) → {Hash}
-
Calculate the 3D box to contain the object.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getCoordDeterminateObjects() → {Array}
-
If this object determinate other object's coord, this method should returns them.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
-
Returns direct child object of ctab which hold node as nested child.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
getDisplayRichText(hydrogenDisplayLevel, showCharge, displayLabelConfigs)
-
Get label to display the atom.
Parameters:
- Inherited From:
- Source:
-
-
Returns the shadow fragment with all subgroups unmarshalled
Parameters:
Name |
Type |
Description |
autoCreate |
Bool
|
Whether allow to create new one when the shadow does not exists. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
-
Returns the flatterned shadowed object of source.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getFlatternedShadowShadowObjs(srcObjs) → {Array}
-
Returns the flatterned shadowed objects of source.
Parameters:
Name |
Type |
Description |
srcObjs |
Array
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
-
Returns the source object from flatterned shadow.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getFlatternedShadowSourceObjs(shadowObjs) → {Array}
-
Returns the source objects from flatterned shadow.
Parameters:
Name |
Type |
Description |
shadowObjs |
Array
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLabel() → {String}
-
Returns a label that represents current node.
Desendants should override this method.
- Inherited From:
- Source:
Returns:
-
Type
-
String
-
getLeafNodes() → {Array}
-
Get all leaf nodes (node that do not have children, usually atom).
Note if a sub group has no children, it will be regarded as leaf node too.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedBonds(bondType) → {Array}
-
Parameters:
Name |
Type |
Description |
bondType |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedChemNodes(ignoreHydrogenAtoms) → {Array}
-
Returns neighbor nodes linked to this node through proper connectors.
Parameters:
Name |
Type |
Description |
ignoreHydrogenAtoms |
Bool
|
Whether explicit hydrogen atoms are returned. Default is false. |
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
-
Get linked connector object at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getLinkedConnectorCount() → {Int}
-
Return count of linkedConnectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
getLinkedDoubleBonds() → {Array}
-
Returns linked double covalent bond to this node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedHydrogenAtoms() → {Array}
-
Returns linked hydrogen atoms.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedMultipleBonds() → {Array}
-
Returns linked multiple covalent bond to this node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedNonHydrogenConnectors() → {Array}
-
Returns connectors that connected to a non hydrogen node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedNonHydrogenObjs() → {Array}
-
Returns linked objects except hydrogen atoms.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedObjsOnConnector() → {Array}
-
Returns other objects connected to this one through connector.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getNextSiblingOfChild(childObj) → {Variant}
-
Returns next sibling node or connector to childObj.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
Node or connector. |
- Inherited From:
- Source:
Returns:
-
Type
-
Variant
-
-
Get node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get node at indexStack.
For example, indexStack is [2, 3, 1], then this.getNodeAt(2).getNodeAt(3).getNodeAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get a structure node object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getNodeCount() → {Int}
-
Return count of nodes.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Get a structure node or connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
-
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
-
Returns the most possible isotope of node.
To
Kekule.Atom, this should be simplely the isotope of atom
while variable atom or pseudoatom may has its own implementation.
This method returns null if isotope is uncertain to this node.
Descendants need to override this method.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.Isotope
-
getRingAromaticType(ring, refRings)
-
Returns aromatic type of a ring.
Parameters:
Name |
Type |
Description |
ring |
Object
|
|
refRings |
Array
|
Should list all related rings to ring, help to determine the p electron number.
If this value is not set, SSSR of molecule will be used instead. |
- Inherited From:
- Source:
-
-
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
getSubFragments() → {Array}
-
Get all sub fragments (node that have children, usually SubGroup).
Note if a sub group has no children, it will not be regarded as sub fragment.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
hasChildObj(childObj) → {Bool}
-
Check if childObj is a child node or connector of this fragment's ctab.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasConnector(connector, checkNestedStructure) → {Bool}
-
Check if a connector exists in structure.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
Connector to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasCtab()
-
Check whether a connection table is used to represent this fragment.
- Inherited From:
- Source:
-
-
Check whether a formula is used to represent this fragment.
- Inherited From:
- Source:
-
hasNode(node, checkNestedStructure) → {Bool}
-
Check if a node exists in structure.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
Node to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasSubFragments() → {Bool}
-
Returns whether there are sub fragment(s) (node that have children, usually SubGroup) in this fragment.
Note if a sub group has no children, it will not be regarded as sub fragment.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
indexOfAnchorNode(node) → {Int}
-
Get index of anchor node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfChild(obj) → {Int}
-
Get the index of obj in children list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
|
- Inherited From:
- Source:
Returns:
Index of obj or -1 when not found.
-
Type
-
Int
-
indexOfConnector(connector) → {Int}
-
Get index of connector inside fragment.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfLinkedConnector(connector) → {Int}
-
Returns index of connector connected to node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfNode(node) → {Int}
-
Get index of node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexStackOfNode(node) → {Variant}
-
Returns index of node. If node exists in nested sub group, index in sub group will be pushed to stack as well.
Parameters:
- Inherited From:
- Source:
Returns:
If node is the direct child of this structure, returns {Int}, otherwise stack {Array} will be returned.
-
Type
-
Variant
-
insertBefore(obj, refChild) → {Int}
-
Insert obj before refChild in node or connector list of ctab.
If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
A node or connector. |
refChild |
Variant
|
Ref node or connector |
- Inherited From:
- Source:
Returns:
Index of obj after inserting.
-
Type
-
Int
-
insertConnectorAt(connector, index)
-
Insert connector to index. If index is not set, node will be inserted as the first connector of ctab.
Parameters:
- Inherited From:
- Source:
-
insertNodeAt(node, index)
-
Insert node to index. If index is not set, node will be inserted as the first node of ctab.
Parameters:
- Inherited From:
- Source:
-
isConnectorInAromaticRing(connector) → {Bool}
-
Check if a connector is in aromatic ring stored in aromaticRings property.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isCoordDependent() → {Bool}
-
Whether the coord of chem object is calculated from other object (like connector).
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isCtabEmpty() → {Bool}
-
Returns if the ctab of this structure fragment has no nodes or connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isEmpty() → {Bool}
-
Returns if this fragment has no formula or ctab, or ctab has no nodes or connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isHydrogenAtom() → {Bool}
-
Returns whether this node is a H atom (but not D or T).
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isNodeInAromaticRing(node) → {Bool}
-
Check if a node is in aromatic ring stored in aromaticRings property.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isSameStructureWith(target, compareOptions) → {Bool}
-
Check if two structure fragment (molecule) is same in chem level (same
atoms, bonds and structures).
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isSubFragment(node) → {Bool}
-
Check if a node has a sub structure (has child nodes).
Note if a sub group has no children, it will not be regarded as sub fragment.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
-
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
move(delta, coordMode) → {Hash}
-
Move node by delta.
Parameters:
Name |
Type |
Description |
delta |
Hash
|
|
coordMode |
Int
|
|
- Inherited From:
- Source:
Returns:
New coord after moving.
-
Type
-
Hash
-
move2D(delta) → {Hash}
-
Move node 2D coord by delta.
Parameters:
Name |
Type |
Description |
delta |
Hash
|
|
- Inherited From:
- Source:
Returns:
New coord after moving.
-
Type
-
Hash
-
move3D(delta) → {Hash}
-
Move node 3D coord by delta.
Parameters:
Name |
Type |
Description |
delta |
Hash
|
|
- Inherited From:
- Source:
Returns:
New coord after moving.
-
Type
-
Hash
-
nodesHasCoord2D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 2D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
nodesHasCoord3D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 3D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
perceiveAromaticRings(allowUncertainRings, candidateRings) → {Array}
-
Perceive and mark all aromatic rings in molecule. Found rings will be stored in aromaticRings
property of structure fragment object.
Parameters:
Name |
Type |
Description |
allowUncertainRings |
Bool
|
Whether uncertain rings (e.g., with variable atom) be included in result. |
candidateRings |
Array
|
Rings in molecule that the detection will be performed.
If this param is not set, all memebers of SSSR of molecule will be checked. |
- Inherited From:
- Source:
Returns:
Found aromatic rings.
-
Type
-
Array
-
perceiveChiralNodes(coordMode, ignoreCanonicalization:, options) → {Array}
-
Detect and mark parity of all chiral nodes in structure fragment.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Use 2D or 3D coord to calculate. |
ignoreCanonicalization: |
Bool
|
Bool. If false, ctab will be canonicalized before perception.
|
options |
Hash
|
Chiral calculation options, including:
{
implicitFischerProjection: Bool, whether the "+" cross of Fischer projection need to be recognized and take into consideration.
Only works when coord mode is 2D.
fischerAllowedError: the allowed error when checking vertical and horizontal line in Fischer projection cross,
default is 0.08 (deltaY/deltaX or vice versa, about 4.5 degree).
reversedFischer: If true, the node on vertical line will be toward observer instead,
allowExplicitHydrogenInFischer: Whether the simplification Fischer projection in saccharide chain form is allowed (H is omitted from structure).
} |
- Inherited From:
- Source:
Returns:
Array of all chiral nodes.
-
Type
-
Array
-
perceiveStereoConnectors(coordMode) → {Array}
-
Detect and mark parity of all stereo connectors in structure fragment.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Use 2D or 3D coord to calculate. |
- Inherited From:
- Source:
Returns:
Array of all chiral nodes.
-
Type
-
Array
-
perceiveStereos(coordMode, ignoreCanonicalization:, options) → {Array}
-
Detect and mark parity of all chiral nodes/connectors in structure fragment.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Use 2D or 3D coord to calculate. |
ignoreCanonicalization: |
Bool
|
Bool. If false, ctab will be canonicalized before perception.
|
options |
Hash
|
Chiral calculation options, including:
{
implicitFischerProjection: Bool, whether the "+" cross of Fischer projection need to be recognized and take into consideration.
Only works when coord mode is 2D.
fischerAllowedError: the allowed error when checking vertical and horizontal line in Fischer projection cross,
default is 0.08 (deltaY/deltaX or vice versa, about 4.5 degree).
reversedFischer: If true, the node on vertical line will be toward observer instead,
allowExplicitHydrogenInFischer: Whether the simplification Fischer projection in saccharide chain form is allowed (H is omitted from structure).
} |
- Inherited From:
- Source:
Returns:
Array of all nodes and connectors with special stereo parities.
-
Type
-
Array
-
recalcCoords()
-
Recalculate coords of group and child notes.
The coords of child nodes are based on group coord, while group coord is calculated
by anchorNodes. So those value may need to be recalculate when anchor nodes changed.
- Inherited From:
- Source:
-
removeAnchorNode(node)
-
Remove a node in anchorNodes.
Parameters:
- Inherited From:
- Source:
-
removeAnchorNodeAt(index)
-
Remove node at index of anchorNodes.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
-
removeChild(childObj)
-
Remove child obj directly from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
- Inherited From:
- Source:
-
removeChildObj(childObj, cascadeRemove, freeRemoved)
-
Remove childObj from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
cascadeRemove |
Bool
|
Whether remove related objects (e.g., bond connected to an atom). |
freeRemoved |
Bool
|
Whether free all removed objects. |
- Inherited From:
- Source:
-
removeConnector(connector, preserveConnectedObjs)
-
Remove a connector in container.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Inherited From:
- Source:
-
removeConnectorAt(index, preserveConnectedObjs)
-
Remove connector at index of connectors.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Inherited From:
- Source:
-
removeCtab()
-
Delete ctab info from this fragment.
- Inherited From:
- Source:
-
-
Delete formula info from this fragment.
- Inherited From:
- Source:
-
removeLinkedConnector(connector)
-
Remove a connector in linkedContainer.
Parameters:
- Inherited From:
- Source:
-
removeLinkedConnectorAt(index)
-
Remove connector at index of linkedConnectors.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
-
removeNode(node, preserveLinkedConnectors)
-
Remove a node in container.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Inherited From:
- Source:
-
removeNodeAt(index, preserveLinkedConnectors)
-
Remove node at index in container.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Inherited From:
- Source:
-
removeThisFromLinkedConnector()
-
Remove this node from all linked connectors.
Ths method should be called before a object is removed from a structure.
- Inherited From:
- Source:
-
replaceNode(oldNode, newNode)
-
Replace oldNode with new one, preserve coords and all linked connectors.
Parameters:
- Inherited From:
- Source:
-
search(subStructure, options) → {Variant}
-
Search sub structure in this fragment.
Parameters:
Name |
Type |
Description |
subStructure |
Kekule.StructureFragment
|
Structure to find. |
options |
Hash
|
Search options, can include the following fields:
{
doStandardize: Bool, whether standardize molecule (especially perceive aromatic rings) before searching.
exactMatch: Bool, if true, only the same structure with subStructure will be matched.
ignoreCharge: Bool
ignoreBondOrder: Bool
} |
- Inherited From:
- Source:
Returns:
If sub structure is found, an array of matching node and connectors will be returned.
Otherwise false will be returned.
-
Type
-
Variant
-
sortConnectors(sortFunc)
-
Sort direct child connectors in structure fragment.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of nodes. |
- Inherited From:
- Source:
-
sortNodes(sortFunc)
-
Sort direct child nodes in structure fragment.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of nodes. |
- Inherited From:
- Source:
-
standardize(options)
-
Standardize this structure fragment (molecule).
Standardization may include canonicalization, aromatic perception and so on.
Parameters:
Name |
Type |
Description |
options |
Hash
|
Standardization options, including the following fields:
{
unmarshalSubFragments: bool, whether unmarshal all sub structures cascadedly of molecule, default is true.
doCanonicalization: bool, whether do canonicalization to molecule, default is true.
canonicalizerExecutorId: string, which canonicalizer executor should be used. If this
value is not set, default one will be used instead.
doAromaticPerception: bool, whether do aromatic ring perception to molecule, default is true.
}. |
- Inherited From:
- Source:
-
traverse(callback, startingNode, breadthFirst, partialNodes) → {Hash}
-
Traverse the nodes in connection tab through a depth or breadth first spanning tree algorithm.
Parameters:
Name |
Type |
Description |
callback |
Func
|
Function called when meet a new node or connector, has two params: callback(currNodeOrConnector, isConnector) |
startingNode |
Kekule.StructureNode
|
Starting position of travers. |
breadthFirst |
Bool
|
Set to true to use breadth first algorithm or false to use depth first algorithm. |
partialNodes |
Array
|
If this param is set, only part of the structure will be traversed. |
- Inherited From:
- Source:
Returns:
A hash object containing all the nodes and connectors sequence traversed. {nodes, connectors}.
Note that all nodes but not all connectors (e.g., the one in ring) may be traversed.
If the structure has no ctab, null will be returned.
-
Type
-
Hash
-
unmarshalAllSubFragments(cascade)
-
Parameters:
Name |
Type |
Description |
cascade |
Bool
|
If subfragments should also unmarshal their children fragments. |
- Inherited From:
- Source:
-
unmarshalSubFragment(subFragment, cascade)
-
Parameters:
Name |
Type |
Description |
subFragment |
Kekule.StructureFragment
|
Sub fragment to be ungrouped. |
cascade |
Bool
|
If subfragment should also unmarshal its children fragments. |
- Inherited From:
- Source: