chemaxon.struc
Class Molecule

java.lang.Object
  extended by chemaxon.struc.CGraph
      extended by chemaxon.struc.MoleculeGraph
          extended by chemaxon.struc.Molecule
All Implemented Interfaces:
MTransformable, chemaxon.struc.ReadableMolecule, StereoConstants, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
RgMolecule, RxnMolecule

public class Molecule
extends MoleculeGraph

Molecule class. A MoleculeGraph that may also contain S-groups.

Version:
5.1.2, 09/11/2008
Author:
Peter Csizmadia, Andras Volford, Szabolcs Csepregi, Erika Biro
See Also:
Serialized Form

Field Summary
static int DEFAULT_UNGROUP
          Do not ungroup and do not expand S-group's children.
static int RECURSIVE_UNGROUP
          Ungroup and expand (if possible) the child S-groups.
static int RMCLEANUP_FROMSGROUPS
          Remove atoms from S-groups.
static int RMCLEANUP_SGROUPATOMS
          Remove S-groups of removed superatoms.
protected static int RMSG_DEFAULT
          Remove S-group's children and remove S-group from its parent.
protected static int RMSG_KEEP_CHILDREN
          Do not remove S-group's children.
protected static int RMSG_KEEP_MULTICENTER
          Do not remove central atom of multicenter S-groups.
protected static int RMSG_KEEP_PARENT
          Do not remove S-group from its parent.
 
Fields inherited from class chemaxon.struc.MoleculeGraph
AROM_BASIC, AROM_CHEMAXON, AROM_DAYLIGHT, AROM_GENERAL, CACHE_REMOVE_AROMATAMODULE, CACHE_REMOVE_GRINVMODULE, CACHE_REMOVE_PARITYMODULE, CACHE_REMOVE_SSSRMODULE, DIM_MASK, GRINV_DONT_STORE, GRINV_NOHYDROGEN, GRINV_OLDSTEREO, GRINV_STEREO, GRINV_USEMAPS, GRINV_VALUE_OPTIONS, INVALID_LINKNODE_MESSAGE, MIN_RING_SIZE_FOR_TRANS_DB, OMIT_POSTCLEAN, orix, oriy, oriz, propertyContainer, RMCLEANUP_MOBJECT, RMCLEANUP_PARENTDOC, RMCLEANUP_STEREO, useOnlyFirstAtomInStereoCalculation
 
Fields inherited from class chemaxon.struc.CGraph
btab, CACHE_REMOVE_ALL, CACHE_REMOVE_CACHEMEMORY, cacheMemory, cssr, ctab, edgeCount, edges, fragIds, grinv, grinvCC, grinvOptions, INITIAL_CAPACITY, nFrags, nGrinv, nodeCount, nodes, parentGraph, RMCLEANUP_ALL, RMCLEANUP_EDGES, RMCLEANUP_FIXCOMPONENT, RMCLEANUP_NONE, sssr, sssr2idx, sssrl2idx, superGraph
 
Fields inherited from interface chemaxon.struc.ReadableMolecule
HS_S, HS_SP, HS_SP2, HS_SP3, HS_UNKNOWN
 
Fields inherited from interface chemaxon.struc.StereoConstants
ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_MASK, CHIRALITY_R, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_ODD, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, TRANS
 
Constructor Summary
Molecule()
          Construct a molecule.
Molecule(Molecule p, int na, int nb)
          Construct a molecule or fragment with the specified number of atoms and bonds.
Molecule(Molecule p, MolAtom a)
          Construct a graph consisting of a single vertex (atom).
Molecule(Molecule p, MolBond b)
          Construct a graph consisting of a single edge (bond).
 
Method Summary
protected  void addNode0(CNode node)
          Adds a node.
protected  void addSgroup(Sgroup sg, boolean setparent)
          Adds an S-group to this object and its parent.
protected  void addSgroupClones(Molecule origparentm, Molecule origm, Molecule newm)
          Adds the S-groups of a child molecule clone to the new parent molecule clone.
protected  void addSgroupsOf(Molecule m)
          Adds S-groups to this object and its parent.
 void aromatize(int method)
          Aromatize molecule.
 double bondlength()
          Calculate the regular bond length for the unified structure.
 boolean canBeReactionComponent()
          Tests whether an object of this class can be a reaction component.
 void checkConsistency()
          Checks the internal consistency of the structure.
protected  void checkSgroupConsistency()
          Checks the internal consisitency of S-groups.
 boolean clean(int dim, java.lang.String opts, MProgressMonitor pmon)
          Calculates atom coordinates.
protected  void cleanSgroups(int dim, java.lang.String opts)
          Clean S-groups.
 void clear()
          Clears the molecule.
 void clearExtraLabels()
          Clears extra atom labels.
 void clearForImport(java.lang.String format)
          Initializes molecule for import.
 void clearProperties()
          Clears RDfile/SDfile properties.
 java.lang.Object clone()
          Makes an identical copy of the molecule.
 void clonecopy(CGraph g)
          Makes another molecule identical to this one.
 void clonecopy(int[] iatoms, MoleculeGraph g)
          Copies the specified atoms and bonds of this graph to another one.
protected  void clonecopyWithoutSgroups(Molecule m)
          Copies the all the contents except the S-groups into another molecule object.
 void clonelesscopy(CGraph g)
          Copies to selection.
 Molecule cloneMolecule()
          Makes an identical copy of the molecule.
 Molecule cloneMoleculeWithDocument()
          Makes an identical copy of the molecule and its document.
 boolean contains(CNode node)
          Checks if the graph contains the specified node.
protected  void contractExpandedSgroups()
           
 boolean contractSgroups()
          Contracts all S-groups.
 Molecule[] convertToFrags()
          Converts this molecule to its disconnected fragments.
 int countExpandableContractableSgroups()
          Counts the expandable and contractable S-groups.
 int countOrderedComponentSgroups()
          Counts the ordered component S-groups.
 boolean dearomatize()
          Dearomatize molecule.
 void draw(java.awt.Graphics g, java.lang.String opts)
          Deprecated. As of release 4.1.6, replaced by chemaxon.marvin.util.MPainterUtil.draw(Molecule,Graphics,String)
 void endReuse(int n)
          End reusing atoms.
 boolean expandSgroups()
          Expands all S-groups.
 boolean expandSgroups(int opts)
          Expands all S-groups.
 byte[] exportToBinFormat(java.lang.String fmt)
          Creates a binary representation of the molecule.
 java.lang.String exportToFormat(java.lang.String fmt)
          Creates a string representation of the molecule.
 java.lang.Object exportToObject(java.lang.String fmt)
          Creates a String, byte[] array or Image representation of the molecule.
protected  void fillSelectionMolecule(SelectionMolecule s)
          Adds all atoms and bonds to the specified molecule.
 Sgroup[] findAllSgroupContaining(MolAtom a)
          Finds the smallest S-groups containing the specified node.
 chemaxon.struc.sgroup.MulticenterSgroup findContainingMulticenterSgroup(MolAtom atom)
          Gets the containing multicenter S-group of a multicenter atom.
 Sgroup findContractableSgroup()
          Finds an expanded residue.
 Sgroup findExpandableSgroup()
          Finds a contracted residue.
 SelectionMolecule[] findFrags()
          Determines the disconnected fragments and puts them into an array.
 CGraph[] findFrags(java.lang.Class cl)
          Determines the disconnected fragments and puts them into an array.
 Sgroup findSgroupContaining(MolAtom a)
          Finds the largest S-group that contains the specified node.
 Sgroup findSgroupOf(MolAtom a)
          Finds the smallest S-group related to the specified node.
 Sgroup findSmallestSgroupContaining(MolAtom a)
          Finds the smallest S-group that contains the specified node.
protected  boolean fixSelfReferringProperty(MProp prop)
          Fix a property containing reference to the molecule.
 java.lang.String getComment()
          Gets the comment.
 long getEndPosition()
          Gets the end position of this molecule in the input file.
protected  SelectionMolecule getGraphUnionAsSelection()
          Gets a selection molecule containing all the atoms and bonds.
 MolImageSize getImageSize(java.lang.String fmt)
          Gets size information of an image created with the specified format string.
 java.lang.String getInputFormat()
          Gets the input file format.
protected  Molecule getMostSimplifiedMolecule()
          Gets the simplified molecule object even if there is a parent document with other objects.
 java.lang.String getName()
          Gets the molecule name.
 java.lang.String getProperty(java.lang.String key)
          Gets an RDfile/SDfile property.
 int getPropertyCount()
          Gets the total number of RDfile/SDfile properties.
 java.lang.String getPropertyKey(int i)
          Gets an RDfile/SDfile property key.
 java.util.Enumeration getPropertyKeys()
          Deprecated. as of Marvin 4.1, replaced by properties().getKeys()
 java.lang.Object getPropertyObject(java.lang.String key)
          Gets an RDfile/SDfile property object.
 Sgroup getSgroup(int i)
          Gets an S-group.
 Sgroup[] getSgroupArray()
          Gets the array of S-groups.
 int getSgroupCount()
          Gets the number of S-groups.
 MolAtom[] getSgroupLigands()
          Gets the S-group's ligands if the structure represents an S-group.
 Molecule getSimplifiedMolecule()
          Gets the simplified molecule object.
 Sgroup[] getSortedSgroups()
          Gets the sorted S-groups in parent-child order.
 long getStartPosition()
          Gets the starting position of this molecule in the input file.
 double[] getVisibleCoords(MolAtom ma)
          Returns the coordinates of the given atom (contained in the molecule).
 int indexOf(Sgroup sg)
          Gets the array index of an S-group.
 boolean isEmpty()
          Tests whether the molecule is empty.
 boolean isExpandable(int opts)
          Tests if the molecule is expandable with the specified options.
 boolean isGUIContracted()
          Tests if the molecule has a GUI-contracted S-group or not.
protected  boolean isPeptideChain(Molecule mol)
           
 boolean isReaction()
          Checks if the structure represents a reaction or not.
 boolean isSgroup()
          Checks if the structure represents an S-group or not.
protected  void makeBiopolymerSnake(Molecule mol)
          If there is a chain with all the members being SuperatomSgroups, the method arranges them into a "snake" form to fit into the canvas (intead of being linear).
protected  void makeItSimilar(CGraph g)
          Copies some properties of this molecule to the other one specified as argument.
 void mergeNodes(CNode that, CNode node)
          Merges bonds of an atom with another atom, then add the atom to the molecule.
 CGraph newInstance()
          Creates a new Molecule object.
 SelectionMolecule newSelectionMolecule()
          Creates a new SelectionMolecule object appropriate for storing selection from this molecule.
 boolean partialClean(int dim, int[] fixed, java.lang.String opts)
          Calculates atom coordinates by using fixed atoms.
protected  void postClean()
          Operations performed after cleaning.
protected  void regenFragIds()
          Searches the disconnected fragments.
 void removeAll()
          Removes all the nodes and edges.
 void removeAllEdges()
          Removes all edges.
protected  void removeAllSgroups()
          Removes all S-groups.
protected  void removeEdge(CEdge edge, int cleanupFlags)
          Removes an edge by reference.
protected  void removeEdge(int i, int cleanupFlags)
          Removes an edge.
 void removeNode(CNode node, int cleanupFlags)
          Removes a node and its edges.
 void removeNode(int i, int cleanupFlags)
          Remove a node and its edges.
protected  void removeSgroupFromList(Sgroup sg)
          Removes an S-group from the sgroupVector.
protected  void removeSgroupsOf(Molecule m)
          Removes S-groups from this object and its parent.
protected  void removeSgroupsOf(Molecule m, int rmflags)
          Removes S-groups that are contained in a given molecule but not contained in another molecule.
protected  void reparentSgroups(Molecule p)
          Change parents of all S-groups in this molecule.
static java.lang.String residueSymbolOf(int id)
          Gets the name of a residue.
static int residueTypeOf(java.lang.String name)
          Gets the residue identifier for a residue name.
 MolAtom reuseAtom(int z, int i)
          Reuse an atom or create a new one.
 void setComment(java.lang.String s)
          Sets the comment.
 void setDim(int d)
          Sets the dimension.
 void setEndPosition(long off)
          Sets the end position of this molecule in the input file.
 void setGUIContracted(boolean v)
          Contracts some S-groups to use in GUI or expands for any other use.
 void setInputFormat(java.lang.String format)
          Sets the input file format.
 void setName(java.lang.String s)
          Sets the molecule name.
protected  void setNode0(int i, CNode node)
          Sets the node at the specified index.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets an RDfile/SDfile property.
 void setPropertyObject(java.lang.String key, java.lang.Object value)
          Sets an RDfile/SDfile property object.
 void setSgroupParent(MolAtom a, Sgroup sg, boolean set)
          Sets or unsets an S-group as a parent of an atom.
 void setStartPosition(long off)
          Sets the starting position of this molecule in the input file.
 void sortSgroupXBonds()
          Sorts superatom S-group crossing bonds in attachment point number order.
 byte[] toBinFormat(java.lang.String fmt)
          Creates a binary representation of the molecule.
 java.lang.String toFormat(java.lang.String fmt)
          Creates a string representation of the molecule.
 java.lang.Object toObject(java.lang.String fmt)
          Creates a String, byte[] array or Image representation of the molecule.
 void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates and Data Sgroup coordinates.
 boolean ungroupSgroup(int i)
          Ungroups the specified S-group and expands it if it is an Expandable S-group.
 boolean ungroupSgroup(int i, int opts)
          Ungroups the specified S-group and expands it if it is an Expandable S-group.
 boolean ungroupSgroup(Sgroup sg)
          Expand and ungroup the specified S-group.
 boolean ungroupSgroup(Sgroup sg, int opts)
          Expand and ungroup the specified S-group.
 boolean ungroupSgroups()
          Expand and ungroup all S-groups.
 
Methods inherited from class chemaxon.struc.MoleculeGraph
addAtomsAndBondsTo, addExplicitHydrogens, addExplicitHydrogens, addExplicitLonePairs, adjustMultiChiralFlag, aromatize, aromatize, arrangeComponents, calcCenter, calcCenter, calcDehydrogenizedGrinv, calcHeight, calcHybridization, calcOutRect, calcOutRect, calcOutRectCenter, calcOutRectCenter, calcWidth, canBeCT, canBeCT, clean, clearCachedInfo, clonecopyCGraphWithoutSgroups, contains, createBHtab, createCHtab, createDehydrogenizedReadOnlyGraph, findAtomClone, fuse0, getAromaticAndAliphaticRings, getAromrings, getAromrings, getAtom, getAtomArray, getAtomCount, getBond, getBondArray, getBondCount, getCharge, getChirality, getDesiredLength, getDesiredLength, getDim, getDocument, getDocumentForChild, getEdgeArray, getEdgeVector, getExactMass, getExplicitHcount, getExplicitLonePairCount, getFlags, getFormula, getGraphUnion, getGrinv, getGrinv, getGrinv, getGrinvOptions, getHybridizationState, getImplicitHcount, getLocalChirality, getLocalParity, getLocation, getLonePairCount, getMass, getMassno, getNeighbor, getNeighborCount, getNodeVector, getNonAromrings, getNonAromrings, getParentDocument, getParity, getPoints, getRadical, getSSSRBondSet, getSSSRBondSetInLong, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getSubGraphCount, getSubGraphs, getSubGraphs, getTotalCharge, hasAtomSet, hasBondSet, hasExplicitLonePairs, hasExtraLabelSet, hasImplicitH, hasSelfReferringProperty, hasValenceError, hydrogenize, implicitizeHydrogens, implicitizeHydrogens, implicitizeHydrogens, isAbsStereo, isAtom, isBond, isMultiChiral, isOnlyFirstAtomInStereoCalculation, isQuery, isRingBond, isSelfReference, isSimilarTo, isValidLinkNode, moveTo, partialClean, properties, qpropCheck, removeExplicitLonePairs, restoreCache, revalidateCoordDependentProps, saveCache, setAbsStereo, setAtomSetSeqs, setBondSetSeqs, setChirality, setEdge, setFlags, setGrinvOptions, setLinkNodeDefaultOuters, setLocalParity, setLocation, setParity, setParity, setParity, setSetSeqs, stereoClean, sumConservedQuantities, toString, transform, updateDim, useOnlyFirstAtomInStereoCalculation, valenceCheck, valenceCheck
 
Methods inherited from class chemaxon.struc.CGraph
add, add, addEdge0, addEdgeWithoutChangingIt, addNodeWithoutChangingIt, checkEdgeConsistency, contains, findBasicFrags, findComponentIds, findComponentIds, findEdge, findFrag, findFragById, findInArray, findNode, fuse, fuse, fuse0, getBtab, getCSSR, getCtab, getEdge, getEdgeCount, getEdgeList, getForefather, getFragCount, getFragIds, getGrinv, getGrinvCC, getLock, getNode, getNodeCount, getParent, getSmallestRingSizeForIdx, getSSSR, getSSSREdges, getSSSRIdxesForAtoms, incGrinvCC, incGrinvCCOnly, indexOf, indexOf, insertEdge, insertEdgeInOrder, insertNode, insertNullEdges, insertNullNodes, isGrinvCCValid, isolate, isolate, isRealNodeParent, isRing, isSymmetric, mergeFrags, pack, regenCtabs, regenEdges, removeEdge, removeEdge, removeIsolatedEdges, removeIsolatedNodes, removeNode, removeNode, replaceEdge, resetCtab, resetGrinvInParents, setGrinvCC, setNode, sortEdgesAccordingTo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RMCLEANUP_SGROUPATOMS

public static final int RMCLEANUP_SGROUPATOMS
Remove S-groups of removed superatoms.

Since:
Marvin 4.1, 07/27/2006
See Also:
removeNode(CNode, int), removeNode(int, int), CGraph.RMCLEANUP_ALL, Constant Field Values

RMCLEANUP_FROMSGROUPS

public static final int RMCLEANUP_FROMSGROUPS
Remove atoms from S-groups.

Since:
Marvin 4.1, 07/27/2006
See Also:
removeNode(CNode, int), removeNode(int, int), CGraph.RMCLEANUP_ALL, Constant Field Values

RMSG_DEFAULT

protected static final int RMSG_DEFAULT
Remove S-group's children and remove S-group from its parent.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_CHILDREN

protected static final int RMSG_KEEP_CHILDREN
Do not remove S-group's children.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_PARENT

protected static final int RMSG_KEEP_PARENT
Do not remove S-group from its parent.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_MULTICENTER

protected static final int RMSG_KEEP_MULTICENTER
Do not remove central atom of multicenter S-groups.

Since:
Marvin 5.0, 10/22/2007
See Also:
Constant Field Values

RECURSIVE_UNGROUP

public static final int RECURSIVE_UNGROUP
Ungroup and expand (if possible) the child S-groups.

Since:
Marvin 5.1, 06/05/2008
See Also:
Constant Field Values

DEFAULT_UNGROUP

public static final int DEFAULT_UNGROUP
Do not ungroup and do not expand S-group's children.

Since:
Marvin 5.1, 06/05/2008
See Also:
Constant Field Values
Constructor Detail

Molecule

public Molecule(Molecule p,
                int na,
                int nb)
Construct a molecule or fragment with the specified number of atoms and bonds.

Parameters:
p - the molecule that contains the created fragment
na - no reallocation needed until the number of atoms is less than this value
nb - no reallocation needed until the number of bonds is less than this value

Molecule

public Molecule(Molecule p,
                MolAtom a)
Construct a graph consisting of a single vertex (atom).

Parameters:
p - the parent structure
a - the atom

Molecule

public Molecule(Molecule p,
                MolBond b)
Construct a graph consisting of a single edge (bond).

Parameters:
p - the parent structure
b - the bond

Molecule

public Molecule()
Construct a molecule.

Method Detail

setDim

public void setDim(int d)
Sets the dimension.

Overrides:
setDim in class MoleculeGraph
Parameters:
d - 0, 2, or 3
See Also:
MoleculeGraph.getFlags()

clear

public void clear()
Clears the molecule.

Overrides:
clear in class MoleculeGraph
See Also:
MoleculeGraph.clearForImport(java.lang.String), CGraph.nodes

clearForImport

public void clearForImport(java.lang.String format)
Initializes molecule for import.

Overrides:
clearForImport in class MoleculeGraph
Parameters:
format - input file format
Since:
Marvin 2.7
See Also:
CGraph.edges, MoleculeGraph.orix, MoleculeGraph.oriy, MoleculeGraph.oriz, MoleculeGraph.setFlags(int)

getStartPosition

public long getStartPosition()
Gets the starting position of this molecule in the input file.

Returns:
the starting position

setStartPosition

public void setStartPosition(long off)
Sets the starting position of this molecule in the input file.

Parameters:
off - the starting position

getEndPosition

public long getEndPosition()
Gets the end position of this molecule in the input file.

Returns:
the end position

setEndPosition

public void setEndPosition(long off)
Sets the end position of this molecule in the input file.

Parameters:
off - the end position

getName

public java.lang.String getName()
Gets the molecule name.

Specified by:
getName in interface chemaxon.struc.ReadableMolecule
Overrides:
getName in class MoleculeGraph
Returns:
the molecule name or an empty string
Since:
Marvin 2.7

setName

public void setName(java.lang.String s)
Sets the molecule name.

Parameters:
s - the molecule name, empty string or null (null is equivalent to empty string)
Since:
Marvin 2.7

getComment

public final java.lang.String getComment()
Gets the comment.

Returns:
the comment or empty string
Since:
Marvin 2.9

setComment

public final void setComment(java.lang.String s)
Sets the comment.

Parameters:
s - the comment, empty string or null (null is equivalent to empty string)
Since:
Marvin 2.9

getInputFormat

public final java.lang.String getInputFormat()
Gets the input file format. Set by the import module if the molecule is from a file.

Returns:
"mol", "csmol", "sdf", "cssdf", "rdf", "csrdf", "smiles", "sybyl", "mol2", "pdb", "xyz" or "cube" or "inchi"
Since:
Marvin 2.7

setInputFormat

public void setInputFormat(java.lang.String format)
Sets the input file format.

Parameters:
format - the input format
Since:
Marvin 2.7
See Also:
getInputFormat()

clearProperties

public void clearProperties()
Clears RDfile/SDfile properties.


getPropertyCount

public int getPropertyCount()
Gets the total number of RDfile/SDfile properties.

Returns:
number of properties
Since:
Marvin 2.7

getPropertyKeys

public java.util.Enumeration getPropertyKeys()
Deprecated. as of Marvin 4.1, replaced by properties().getKeys()


getPropertyKey

public java.lang.String getPropertyKey(int i)
Gets an RDfile/SDfile property key.

Parameters:
i - property index
Returns:
the property name
Since:
Marvin 2.7

getProperty

public java.lang.String getProperty(java.lang.String key)
Gets an RDfile/SDfile property.

Parameters:
key - property name
Returns:
the value of the property, or null if the key is not found

getPropertyObject

public java.lang.Object getPropertyObject(java.lang.String key)
Gets an RDfile/SDfile property object.

Parameters:
key - property name
Returns:
the value of the property, or null if the key is not found
Since:
Marvin 3.1.2

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets an RDfile/SDfile property. Setting null value removes the property.

Parameters:
key - the property name
value - the value or null

setPropertyObject

public void setPropertyObject(java.lang.String key,
                              java.lang.Object value)
Sets an RDfile/SDfile property object. Setting null value removes the property.

Parameters:
key - the property name
value - the value or null
Since:
Marvin 3.1.2

residueTypeOf

public static int residueTypeOf(java.lang.String name)
Gets the residue identifier for a residue name.

Parameters:
name - residue name
Returns:
the residue type

residueSymbolOf

public static java.lang.String residueSymbolOf(int id)
Gets the name of a residue.

Parameters:
id - the residue identifier
Returns:
the residue symbol

setNode0

protected void setNode0(int i,
                        CNode node)
Sets the node at the specified index. Overridden because Sgroups must be set correctly in RgMolecule.clone() and RxnMolecule.clone().

Overrides:
setNode0 in class MoleculeGraph
Parameters:
i - the atom index
node - the atom

removeNode

public void removeNode(CNode node,
                       int cleanupFlags)
Removes a node and its edges. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

Overrides:
removeNode in class MoleculeGraph
Parameters:
node - the node
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeNode

public void removeNode(int i,
                       int cleanupFlags)
Remove a node and its edges. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

Overrides:
removeNode in class MoleculeGraph
Parameters:
i - the node index
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeEdge

protected void removeEdge(CEdge edge,
                          int cleanupFlags)
Removes an edge by reference.

Overrides:
removeEdge in class CGraph
Parameters:
edge - the edge
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeEdge

protected void removeEdge(int i,
                          int cleanupFlags)
Removes an edge.

Overrides:
removeEdge in class MoleculeGraph
Parameters:
i - the edge index
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeAllEdges

public void removeAllEdges()
Removes all edges.

Overrides:
removeAllEdges in class CGraph

removeAll

public void removeAll()
Removes all the nodes and edges.

Overrides:
removeAll in class CGraph

isEmpty

public boolean isEmpty()
Tests whether the molecule is empty.

Overrides:
isEmpty in class CGraph
Returns:
true if the graph does not contain any nodes, edges or non-empty S-groups, false otherwise
Since:
Marvin 4.1.1, 09/06/2006

clean

public boolean clean(int dim,
                     java.lang.String opts,
                     MProgressMonitor pmon)
Calculates atom coordinates.

Overrides:
clean in class MoleculeGraph
Parameters:
dim - dimensions
opts - cleaning options or null
pmon - progress observer object or null
Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
See Also:
MoleculeGraph.clean(int, java.lang.String)

cleanSgroups

protected void cleanSgroups(int dim,
                            java.lang.String opts)
Clean S-groups.

Parameters:
dim - dimensions
opts - cleaning options or null
Since:
Marvin 4.1, 07/31/2006

contractExpandedSgroups

protected void contractExpandedSgroups()

isPeptideChain

protected boolean isPeptideChain(Molecule mol)

postClean

protected void postClean()
Operations performed after cleaning. Creates a peptide snake if needed

Since:
Marvin 4.1, 07/31/2006

makeBiopolymerSnake

protected void makeBiopolymerSnake(Molecule mol)
If there is a chain with all the members being SuperatomSgroups, the method arranges them into a "snake" form to fit into the canvas (intead of being linear). We are assuming that it is already checked that all the entries are SuperatomSgroups.


aromatize

public void aromatize(int method)
Aromatize molecule.

Overrides:
aromatize in class MoleculeGraph
Parameters:
method - specifies the algorithm for aromatization.
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
See Also:
MoleculeGraph.AROM_BASIC, MoleculeGraph.AROM_GENERAL, Document about aromatization

dearomatize

public boolean dearomatize()
Dearomatize molecule.

Overrides:
dearomatize in class MoleculeGraph
Returns:
true if success, else false.
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

clonecopy

public void clonecopy(CGraph g)
Makes another molecule identical to this one.

Overrides:
clonecopy in class MoleculeGraph
Parameters:
g - the target molecule

fixSelfReferringProperty

protected boolean fixSelfReferringProperty(MProp prop)
Fix a property containing reference to the molecule. Called from clonelesscopy().

Overrides:
fixSelfReferringProperty in class MoleculeGraph
Parameters:
prop - the property
Since:
Marvin 4.1.6, 02/14/2007
See Also:
MoleculeGraph.clonecopy(CGraph)

addSgroupClones

protected final void addSgroupClones(Molecule origparentm,
                                     Molecule origm,
                                     Molecule newm)
Adds the S-groups of a child molecule clone to the new parent molecule clone.

Parameters:
origparentm - the original parent molecule
origm - the original child molecule
newm - the new child molecule (clone of the original)
Since:
Marvin 3.4

clonecopy

public void clonecopy(int[] iatoms,
                      MoleculeGraph g)
Copies the specified atoms and bonds of this graph to another one.

Overrides:
clonecopy in class MoleculeGraph
Parameters:
iatoms - array of node indices to copy or null
g - the target graph
Since:
Marvin 5.0.2, 03/11/2008

clonecopyWithoutSgroups

protected void clonecopyWithoutSgroups(Molecule m)
Copies the all the contents except the S-groups into another molecule object.

Parameters:
m - the target molecule
Since:
Marvin 3.4

clonelesscopy

public void clonelesscopy(CGraph g)
Copies to selection. Makes another molecule identical to this one, but does not clone atoms, bonds, and the properties.

Overrides:
clonelesscopy in class MoleculeGraph
Parameters:
g - the target molecule object (the selection)

cloneMoleculeWithDocument

public Molecule cloneMoleculeWithDocument()
Makes an identical copy of the molecule and its document. Copies non-molecular data: graphics objects, electron flows, text boxes.

Returns:
the copy
Since:
Marvin 4.1, 01/16/2006

cloneMolecule

public Molecule cloneMolecule()
Makes an identical copy of the molecule.

Returns:
the copy
Since:
Marvin 3.5.1, 11/20/2004

clone

public final java.lang.Object clone()
Makes an identical copy of the molecule.

Overrides:
clone in class MoleculeGraph
Returns:
the copy

getImageSize

public MolImageSize getImageSize(java.lang.String fmt)
Gets size information of an image created with the specified format string. Examples:
 MolImageSize g1 = mol.getImageSize("image:scale24");
     // (g1.width, g2.width) is the bounding box size for an image created
     // with scaling factor 24
 MolImageSize g2 = mol.getImageSize("image:w100h100");
     // g2.scale is the maximum scaling factor for 100x100 image
 

Parameters:
fmt - format string that contains the image export options
Returns:
an object containing the image size and the scaling factor
Throws:
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 2.9.11
See Also:
toBinFormat(java.lang.String), toObject(java.lang.String)

toFormat

public final java.lang.String toFormat(java.lang.String fmt)
Creates a string representation of the molecule. The format descriptor string can also contain export options. Format and options are separated by a colon, multiple options can be separated by commas. See the text formats and their options on the File Formats in Marvin page. Examples:
 s1 = mol.toFormat("mol");
 s2 = mol.toFormat("smiles:a-H"); // aromatize and remove Hydrogens
 

Parameters:
fmt - the format descriptor string
Returns:
string representation of the molecule in the specified format
Throws:
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
See Also:
toObject(java.lang.String)

exportToFormat

public final java.lang.String exportToFormat(java.lang.String fmt)
                                      throws MolExportException
Creates a string representation of the molecule. Similar to toFormat(String), the only difference is that export exceptions are not converted to IllegalArgumentException.

Parameters:
fmt - the format descriptor string
Returns:
string representation of the molecule in the specified format
Throws:
MolExportException - Export error
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 4.0, 07/01/2005
See Also:
toFormat(String)

toBinFormat

public final byte[] toBinFormat(java.lang.String fmt)
Creates a binary representation of the molecule. Works with all the text formats that are supported by the toFormat method, and also with the binary image formats (jpeg, msbmp, png, ppm). When creating an image, display options can also be specified in the format descriptor