Search:
Class scilligence.JSDraw2.Mol
class
scilligence.JSDraw2.Mol
Property Summary
array
atoms
Array of Atom Objects
array
bonds
Array of Bond Objects
array
graphics
Array of Graphics (not Atom and Bond) Objects
Constructor Summary
Mol()
Function Summary
Perform atom-by-atom mapping using the Mol as a query
addAtom
(Atom
a)
Add an Atom
Add a Bond
addGraphics
(Graphics
g)
Add a graphics
center()
Return the center coorindate of all objects
Clean up the reaction, and make it looks nicer
clear()
Remove all object
clone
(bool
selectedOnly)
Clone the Mol object
containsAtom
(Atom
a)
Check if the Mol contains an atom
delObject
(object
obj)
Delete an object
Find a bond
flipX
(number
x)
Flip the molecule around an X axis
flipY
(number
y)
Flip the molecule around a Y axis
fullstructureMatch
(Mol
target)
Perform a full-structure search
Get exact mass
getFormula
(bool
html)
Get molecular formula
getFragment
(Atom
a)
Get the whole fragment containing an input atom
getGroupRect
(Group
g)
Return the Rect of a Group
Get molecular weight
Get molfile
getProp
(string
k)
Get Mol property
Get Rxnfile
Get the Rect of selected atoms
Get SMILES
Get JSDraw xml file format
isEmpty()
Test if the Mol object is empty - without any atom, bond, or graphics
isRxn()
Test if the molecule is a reaction
Move all objects to the center
Move all objects
parseRxn()
Parse the molecule as a reaction
rect()
Return the Rect of all object
Remove all hydrogen atoms
resetIds()
Reset object IDs including atoms, bonds, and other graphics
Rotate all objects around a point
Scale the molecule
Set atom alias
Set atom charges
Set atom type
Set bond type
Set color to all objects
setJdx
(string
data)
Set Secptrum JDX data
setMolfile
(string
molfile)
Set molfile
Set Mol property
setRgfile
(string
rgfile)
Set RGfile
setRxnfile
(string
rxnfile)
Set Rxnfile
setSelected
(bool
f)
Set selecting flags to all objects
setXml
(string
xml)
Set JSDraw xml file format
Split it into fragments
substructureMatch
(Mol
target)
Perform a sub-structure search using the Mol as a query
Property Details
property array atoms
Array of Atom Objects
property array bonds
Array of Bond Objects
property array graphics
Array of Graphics (not Atom and Bond) Objects
Function Details
function aamap
aamap(Mol
target, bool
fullstructure, bool
highlighting)
Perform atom-by-atom mapping using the Mol as a query
Parameters:
target
- the target mol
fullstructure
- indicate if performing a full-structure search
highlighting
- indicate if highlighting mapped atoms and bonds
Returns:
the map result as a dictionary
function addAtom
addAtom(Atom
a)
Add an Atom
Parameters:
a
- the atom to be added
Returns:
the Atom added
function addBond
addBond(Bond
b, bool
resetcharge)
Add a Bond
Parameters:
b
- the bond to be added
resetcharge
- indicate if reset atoms' charges of bonded atoms
Returns:
the Bond added
function addGraphics
addGraphics(Graphics
g)
Add a graphics
Parameters:
g
- the graphics to be added
Returns:
the Graphics added
function center
center()
Return the center coorindate of all objects
Returns:
the center as a Point object
function cleanupRxn
cleanupRxn()
Clean up the reaction, and make it looks nicer
Returns:
null
function clear
clear()
Remove all object
Returns:
null
function clone
clone(bool
selectedOnly)
Clone the Mol object
Parameters:
selectedOnly
- indicate if cloning only selected objects
Returns:
a new Mol object
function containsAtom
containsAtom(Atom
a)
Check if the Mol contains an atom
Parameters:
a
- the input atom
Returns:
true or false
function delObject
delObject(object
obj)
Delete an object
Parameters:
obj
- Atom, bond, or graphics to be removed
Returns:
null
function findBond
findBond(Atom
a1, Atom
a2)
Find a bond
Parameters:
a1
- the first atom
a2
- the second atom
Returns:
the bond
function flipX
flipX(number
x)
Flip the molecule around an X axis
Parameters:
x
- the x axis
Returns:
null
function flipY
flipY(number
y)
Flip the molecule around a Y axis
Parameters:
y
- the y axis
Returns:
null
function fullstructureMatch
fullstructureMatch(Mol
target)
Perform a full-structure search
Parameters:
target
- the target mol
Returns:
true or false
function getExactMass
getExactMass()
Get exact mass
Returns:
a number
function getFormula
getFormula(bool
html)
Get molecular formula
Parameters:
html
- indicate if rendering the formula in HTML format
Returns:
a string
function getFragment
getFragment(Atom
a)
Get the whole fragment containing an input atom
Parameters:
a
- the input atom
Returns:
a Mol object
function getGroupRect
getGroupRect(Group
g)
Return the Rect of a Group
Parameters:
g
- the input group
Returns:
a Rect object
function getMolWeight
getMolWeight()
Get molecular weight
Returns:
a number
function getMolfile
getMolfile(bool
rxn, bool
v3000)
Get molfile
Parameters:
rxn
- get it as a Rxn file
v3000
- render it in Molfile V3000 format
Returns:
a string
function getProp
getProp(string
k)
Get Mol property
Parameters:
k
- the property name
Returns:
the property
function getRxnfile
getRxnfile(bool
groupbyplus, bool
v3000)
Get Rxnfile
Parameters:
groupbyplus
- indicate if grouping reactants/products by explicit plus signs
v3000
- indicate if rendering the rxnfile in V3000 format
Returns:
a string
function getSelectedRect
getSelectedRect()
Get the Rect of selected atoms
Returns:
a Rect object
function getSmiles
getSmiles()
Get SMILES
Returns:
a string
function getXml
getXml(number
width, number
height, bool
viewonly)
Get JSDraw xml file format
Parameters:
width
- the width of the view
height
- the height of the view
viewonly
- in viewonly mode
Returns:
a string
function isEmpty
isEmpty()
Test if the Mol object is empty - without any atom, bond, or graphics
Returns:
true or false
function isRxn
isRxn()
Test if the molecule is a reaction
Returns:
true or false
function mergeMol
mergeMol(Mol
m)
Merge another Molecule
Parameters:
m
- the Molecule to be merged function moveCenter
moveCenter(number
width, number
height)
Move all objects to the center
Parameters:
width
- the width of the view
height
- the height of the view
Returns:
null
function offset
offset(number
dx, number
dy, bool
selectedOnly)
Move all objects
Parameters:
dx
- x offset
dy
- y offset
selectedOnly
- indicated if moving only selected objects
Returns:
null
function parseRxn
parseRxn()
Parse the molecule as a reaction
Returns:
a Reaction object: { reactants, products, arrow, above, below }
function rect
rect()
Return the Rect of all object
Returns:
a Rect object
function removeHydrogens
removeHydrogens()
Remove all hydrogen atoms
Returns:
the count of removed atoms
function resetIds
resetIds()
Reset object IDs including atoms, bonds, and other graphics
Returns:
null
function rotate
rotate(Point
origin, number
deg)
Rotate all objects around a point
Parameters:
origin
- the position to be rotated around
deg
- degrees to be rotated
Returns:
null
function scale
scale(number
scale, Point
origin)
Scale the molecule
Parameters:
scale
- the scaling factor
origin
- the origin of scaling
Returns:
null
function setAtomAlias
setAtomAlias(Atom
a, string
alias)
Set atom alias
Parameters:
a
- the target atom
alias
- alias name
Returns:
true of false
function setAtomCharge
setAtomCharge(Atom
a, number
charge)
Set atom charges
Parameters:
a
- the target atom
charge
- charges
Returns:
true of false
function setAtomType
setAtomType(Atom
a, string
elem)
Set atom type
Parameters:
a
- the target atom
elem
- element symbol of atom
Returns:
true of false
function setBondType
setBondType(Bond
b, BONDTYPES
type)
Set bond type
Parameters:
b
- the target bond
type
- predefined bond type
Returns:
true of false
function setColor
setColor(string
color, bool
selectedOnly)
Set color to all objects
Parameters:
color
- a color, such as red, blue, #ffe, #f0f0f0
selectedOnly
- indicate if only set the color to selected objects
Returns:
null
function setJdx
setJdx(string
data)
Set Secptrum JDX data
Parameters:
data
- JDX string
Returns:
a Mol object
function setMolfile
setMolfile(string
molfile)
Set molfile
Parameters:
molfile
- the input molfile
Returns:
the Mol object
function setProp
setProp(string
k, object
v)
Set Mol property
Parameters:
k
- the property name
v
- the property value
Returns:
null
function setRgfile
setRgfile(string
rgfile)
Set RGfile
Parameters:
rgfile
- the input rgfile
Returns:
the Mol object
function setRxnfile
setRxnfile(string
rxnfile)
Set Rxnfile
Parameters:
rxnfile
- the input rxnfile
Returns:
the Mol object
function setSelected
setSelected(bool
f)
Set selecting flags to all objects
Parameters:
f
- true or false
Returns:
null
function setXml
setXml(string
xml)
Set JSDraw xml file format
Parameters:
xml
- the input JSDraw html/xml string
Returns:
a Mol object
function splitFragments
splitFragments()
Split it into fragments
Returns:
an array of Mol
function substructureMatch
substructureMatch(Mol
target)
Perform a sub-structure search using the Mol as a query
Parameters:
target
- the target mol
Returns:
true or false
Example: var molfile = "\n"; molfile += "MolEngine02021312372D\n"; molfile += "\n"; molfile += " 2 1 0 0 0 0 0 0 0 0999 V2000\n"; molfile += " 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n"; molfile += " 1.3510 0.7800 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n"; molfile += " 1 2 1 0 0 0 0\n"; molfile += "M END\n"; var m = new JSDraw3.Mol(); m.setMolfile(molfile); var smiles = m.getSmiles();