Package org.openscience.cdk.tools
Class SmilesValencyChecker
- java.lang.Object
-
- org.openscience.cdk.tools.SmilesValencyChecker
-
- All Implemented Interfaces:
IDeduceBondOrderTool
,IValencyChecker
public class SmilesValencyChecker extends Object implements IValencyChecker, IDeduceBondOrderTool
Small customization of ValencyHybridChecker suggested by Todd Martin specially tuned for SMILES parsing.- Author:
- Egon Willighagen
- Source code:
- main
- Belongs to CDK module:
- valencycheck
- Keywords:
- atom, valency
- Created on:
- 2004-06-12
-
-
Field Summary
Fields Modifier and Type Field Description protected static ILoggingTool
logger
protected AtomTypeFactory
structgenATF
-
Constructor Summary
Constructors Constructor Description SmilesValencyChecker()
SmilesValencyChecker(String atomTypeList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allSaturated(IAtomContainer ac)
int
calculateNumberOfImplicitHydrogens(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, int neighbourCount)
Calculates the number of hydrogens that can be added to the given atom to fullfil the atom's valency.int
calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container)
boolean
couldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
Determines if the atom can be of type AtomType.boolean
couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type)
Determines if the atom can be of type AtomType.protected AtomTypeFactory
getAtomTypeFactory(IChemObjectBuilder builder)
boolean
isSaturated(IAtomContainer container)
Determines of all atoms on the AtomContainer are saturated.boolean
isSaturated(IAtom atom, IAtomContainer container)
Checks whether an Atom is saturated by comparing it with known AtomTypes.boolean
isSaturated(IBond bond, IAtomContainer atomContainer)
Returns whether a bond is saturated.boolean
isUnsaturated(IBond bond, IAtomContainer atomContainer)
Returns whether a bond is unsaturated.void
saturate(IAtomContainer atomContainer)
Saturates a molecule by setting appropriate bond orders.boolean
saturate(IBond[] bonds, IAtomContainer atomContainer)
Saturates a set of Bonds in an AtomContainer.boolean
saturateByIncreasingBondOrder(IBond bond, IAtomContainer atomContainer)
Tries to saturate a bond by increasing its bond orders by 1.0.boolean
unsaturateByDecreasingBondOrder(IBond bond)
-
-
-
Field Detail
-
structgenATF
protected AtomTypeFactory structgenATF
-
logger
protected static final ILoggingTool logger
-
-
Constructor Detail
-
SmilesValencyChecker
public SmilesValencyChecker()
-
SmilesValencyChecker
public SmilesValencyChecker(String atomTypeList)
-
-
Method Detail
-
saturate
public void saturate(IAtomContainer atomContainer) throws CDKException
Saturates a molecule by setting appropriate bond orders.- Specified by:
saturate
in interfaceIDeduceBondOrderTool
- Throws:
CDKException
- Keywords:
- bond order, calculation
- Created on:
- 2003-10-03
-
saturate
public boolean saturate(IBond[] bonds, IAtomContainer atomContainer) throws CDKException
Saturates a set of Bonds in an AtomContainer.- Throws:
CDKException
-
unsaturateByDecreasingBondOrder
public boolean unsaturateByDecreasingBondOrder(IBond bond)
-
isUnsaturated
public boolean isUnsaturated(IBond bond, IAtomContainer atomContainer) throws CDKException
Returns whether a bond is unsaturated. A bond is unsaturated if all Atoms in the bond are unsaturated.- Throws:
CDKException
-
saturateByIncreasingBondOrder
public boolean saturateByIncreasingBondOrder(IBond bond, IAtomContainer atomContainer) throws CDKException
Tries to saturate a bond by increasing its bond orders by 1.0.- Returns:
- true if the bond could be increased
- Throws:
CDKException
-
isSaturated
public boolean isSaturated(IBond bond, IAtomContainer atomContainer) throws CDKException
Returns whether a bond is saturated. A bond is saturated if both Atoms in the bond are saturated.- Throws:
CDKException
-
isSaturated
public boolean isSaturated(IAtomContainer container) throws CDKException
Determines of all atoms on the AtomContainer are saturated.- Specified by:
isSaturated
in interfaceIValencyChecker
- Throws:
CDKException
-
allSaturated
public boolean allSaturated(IAtomContainer ac) throws CDKException
- Throws:
CDKException
-
couldMatchAtomType
public boolean couldMatchAtomType(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, IAtomType type)
Determines if the atom can be of type AtomType. That is, it sees if this AtomType only differs in bond orders, or implicit hydrogen count.
-
calculateNumberOfImplicitHydrogens
public int calculateNumberOfImplicitHydrogens(IAtom atom, double bondOrderSum, IBond.Order maxBondOrder, int neighbourCount) throws CDKException
Calculates the number of hydrogens that can be added to the given atom to fullfil the atom's valency. It will return 0 for PseudoAtoms, and for atoms for which it does not have an entry in the configuration file.- Throws:
CDKException
-
isSaturated
public boolean isSaturated(IAtom atom, IAtomContainer container) throws CDKException
Checks whether an Atom is saturated by comparing it with known AtomTypes. It returns true if the atom is an PseudoAtom and when the element is not in the list.- Specified by:
isSaturated
in interfaceIValencyChecker
- Throws:
CDKException
-
calculateNumberOfImplicitHydrogens
public int calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container) throws CDKException
- Throws:
CDKException
-
getAtomTypeFactory
protected AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder) throws CDKException
- Throws:
CDKException
-
couldMatchAtomType
public boolean couldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
Determines if the atom can be of type AtomType.
-
-