Package net.bioclipse.managers
Class CDKManager
java.lang.Object
net.bioclipse.managers.CDKManager
- All Implemented Interfaces:
IBactingManager
,net.bioclipse.managers.business.IBioclipseManager
Bioclipse manager that provides cheminformatics functionality using the
Chemistry Development Kit database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendToSDF
(String sdFile, net.bioclipse.cdk.domain.ICDKMolecule molecule) Extends the given SD file with an molfile entry for the givenICDKMolecule
.net.bioclipse.cdk.domain.ICDKMolecule
asCDKMolecule
(net.bioclipse.core.domain.IMolecule imol) Helper function that casts or converts the inputIMolecule
to anICDKMolecule
.asSVG
(net.bioclipse.core.domain.IMolecule molecule) double
calculateMajorIsotopeMass
(net.bioclipse.core.domain.IMolecule molecule) double
calculateMass
(net.bioclipse.core.domain.IMolecule molecule) calculateSMILES
(net.bioclipse.core.domain.IMolecule molecule) Returns the SMILES for a molecule.List<net.bioclipse.cdk.domain.ICDKMolecule>
Create a new JavaList
for storingICDKMolecule
.org.openscience.cdk.io.formats.IChemFormat
determineIChemFormat
(String path) Determines the file format of the given input.org.openscience.cdk.io.formats.IChemFormat
determineIChemFormatOfString
(String fileContent) Determines the file format of the given input.doi()
Lists the DOIs of the articles associated to this manager.net.bioclipse.cdk.domain.ICDKMolecule
Creates a newICDKMolecule
from CML in the givenString
.net.bioclipse.cdk.domain.ICDKMolecule
fromSMILES
(String smilesDescription) Creates a newICDKMolecule
from the SMILES in the givenString
.net.bioclipse.cdk.domain.ICDKMolecule
fromString
(String molstring) Creates a newICDKMolecule
from the content of the givenString
, but guesses the format the input is in.Set<org.openscience.cdk.interfaces.IAtom>
getAtomsWithDefinedStereo
(net.bioclipse.core.domain.IMolecule molecule) Determine the atoms for which the stereochemistry is defined.Set<org.openscience.cdk.interfaces.IAtom>
getAtomsWithUndefinedStereo
(net.bioclipse.core.domain.IMolecule molecule) Determine the atoms for which the stereochemistry is not fully defined.org.openscience.cdk.io.formats.IChemFormat
boolean
isValidCAS
(String number) Determines if the given CAS registry number is valid.net.bioclipse.cdk.domain.ICDKMolecule
loadMolecule
(InputStream instream, org.openscience.cdk.io.formats.IChemFormat format) Creates a newICDKMolecule
from the content of the givenInputStream
, assuming it is in the format as given by theIChemFormat
.net.bioclipse.cdk.domain.ICDKMolecule
loadMolecule
(String file) Loads a molecule from file using CDK.net.bioclipse.cdk.domain.ICDKMolecule
Calculates the maximum common substructure (mcss) starting of two or more molecules starting with the mcss of the first two molecules.molecularFormula
(net.bioclipse.cdk.domain.ICDKMolecule m) Calculates the molecular formula for the given molecule.org.openscience.cdk.interfaces.IMolecularFormula
molecularFormulaObject
(net.bioclipse.cdk.domain.ICDKMolecule m) Calculates the molecular formula for the given molecule.net.bioclipse.cdk.domain.ICDKMolecule
Deprecated.net.bioclipse.cdk.domain.ICDKMolecule
newMolecule
(org.openscience.cdk.interfaces.IAtomContainer atomContainer) Creates a newCDKMolecule
from the givenIAtomContainer
.net.bioclipse.cdk.domain.ICDKMolecule
newMolecule
(org.openscience.cdk.interfaces.IChemObjectBuilder builder) Creates a newCDKMolecule
.List<org.openscience.cdk.interfaces.IAtomContainer>
partition
(net.bioclipse.core.domain.IMolecule molecule) int
totalFormalCharge
(net.bioclipse.core.domain.IMolecule molecule) Calculates the total formal charge.
-
Constructor Details
-
CDKManager
Creates a newCDKManager
.- Parameters:
workspaceRoot
- location of the workspace, e.g. "."
-
-
Method Details
-
loadMolecule
public net.bioclipse.cdk.domain.ICDKMolecule loadMolecule(String file) throws IOException, net.bioclipse.core.business.BioclipseException Loads a molecule from file using CDK. If many molecules, just return first. To return a list of molecules, use loadMolecules(...)- Parameters:
file
- The path to the file- Returns:
- a
IMolecule
object - Throws:
IOException
net.bioclipse.core.business.BioclipseException
-
loadMolecule
public net.bioclipse.cdk.domain.ICDKMolecule loadMolecule(InputStream instream, org.openscience.cdk.io.formats.IChemFormat format) throws net.bioclipse.core.business.BioclipseException, IOException Creates a newICDKMolecule
from the content of the givenInputStream
, assuming it is in the format as given by theIChemFormat
.- Parameters:
instream
- the stream with content in the given formatformat
- format of the content of the stream- Returns:
- a data object for the given input
- Throws:
net.bioclipse.core.business.BioclipseException
IOException
-
fromCml
public net.bioclipse.cdk.domain.ICDKMolecule fromCml(String molstring) throws net.bioclipse.core.business.BioclipseException, IOException Creates a newICDKMolecule
from CML in the givenString
.- Parameters:
molstring
- the molecule in CML format- Returns:
- a data object for the given input
- Throws:
net.bioclipse.core.business.BioclipseException
IOException
-
asCDKMolecule
public net.bioclipse.cdk.domain.ICDKMolecule asCDKMolecule(net.bioclipse.core.domain.IMolecule imol) throws net.bioclipse.core.business.BioclipseException Helper function that casts or converts the inputIMolecule
to anICDKMolecule
.- Parameters:
imol
- the inputIMolecule
that needs casting or converting- Returns:
- the molecule as
ICDKMolecule
- Throws:
net.bioclipse.core.business.BioclipseException
-
createMoleculeList
Create a new JavaList
for storingICDKMolecule
.- Returns:
- the created list
-
fromSMILES
public net.bioclipse.cdk.domain.ICDKMolecule fromSMILES(String smilesDescription) throws net.bioclipse.core.business.BioclipseException Creates a newICDKMolecule
from the SMILES in the givenString
.- Parameters:
smilesDescription
- the molecule in CML format- Returns:
- a data object for the given input
- Throws:
net.bioclipse.core.business.BioclipseException
-
determineIChemFormat
public org.openscience.cdk.io.formats.IChemFormat determineIChemFormat(String path) throws IOException Determines the file format of the given input.- Parameters:
path
-String
with the location of the chemical file to determine the format of- Returns:
- path String pointing to the file to test
- Throws:
IOException
-
determineIChemFormatOfString
public org.openscience.cdk.io.formats.IChemFormat determineIChemFormatOfString(String fileContent) throws IOException Determines the file format of the given input.- Parameters:
fileContent
-String
with the chemical file- Returns:
- an
IChemFormat
representing the format - Throws:
IOException
-
fromString
public net.bioclipse.cdk.domain.ICDKMolecule fromString(String molstring) throws net.bioclipse.core.business.BioclipseException, IOException Creates a newICDKMolecule
from the content of the givenString
, but guesses the format the input is in.- Parameters:
molstring
- the stream with content in the given format- Returns:
- a data object for the given input
- Throws:
net.bioclipse.core.business.BioclipseException
IOException
-
molecularFormulaObject
public org.openscience.cdk.interfaces.IMolecularFormula molecularFormulaObject(net.bioclipse.cdk.domain.ICDKMolecule m) Calculates the molecular formula for the given molecule.- Parameters:
m
- the molecule asICDKMolecule
- Returns:
- a
IMolecularFormula
object
-
molecularFormula
Calculates the molecular formula for the given molecule.- Parameters:
m
- the molecule asICDKMolecule
- Returns:
- the molecular formula as
String
-
getAtomsWithUndefinedStereo
public Set<org.openscience.cdk.interfaces.IAtom> getAtomsWithUndefinedStereo(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException Determine the atoms for which the stereochemistry is not fully defined.- Parameters:
molecule
- to test the atoms of- Returns:
- a Java
Set
with that atoms without fully defined stereochemistry - Throws:
net.bioclipse.core.business.BioclipseException
-
getAtomsWithDefinedStereo
public Set<org.openscience.cdk.interfaces.IAtom> getAtomsWithDefinedStereo(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException Determine the atoms for which the stereochemistry is defined.- Parameters:
molecule
- to test the atoms of- Returns:
- a Java
Set
with that atoms with defined stereochemistry - Throws:
net.bioclipse.core.business.BioclipseException
-
appendToSDF
public void appendToSDF(String sdFile, net.bioclipse.cdk.domain.ICDKMolecule molecule) throws net.bioclipse.core.business.BioclipseException Extends the given SD file with an molfile entry for the givenICDKMolecule
.- Parameters:
sdFile
- the file to add the molecule toomolecule
- the molecule to add to the file- Throws:
net.bioclipse.core.business.BioclipseException
-
isValidCAS
Determines if the given CAS registry number is valid.- Parameters:
number
- the CAS registry number- Returns:
- boolean that represents the validity
-
partition
public List<org.openscience.cdk.interfaces.IAtomContainer> partition(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException - Throws:
net.bioclipse.core.business.BioclipseException
-
getFormat
-
getFormats
-
asSVG
public String asSVG(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException - Throws:
net.bioclipse.core.business.BioclipseException
-
calculateSMILES
public String calculateSMILES(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException Returns the SMILES for a molecule.- Parameters:
molecule
-IMolecule
to generate the SMILES for- Returns:
- String with the SMILES representation
- Throws:
net.bioclipse.core.business.BioclipseException
-
totalFormalCharge
public int totalFormalCharge(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException Calculates the total formal charge.- Parameters:
molecule
-IMolecule
to calculate the total formal charge for- Throws:
net.bioclipse.core.business.BioclipseException
-
calculateMass
public double calculateMass(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException - Throws:
net.bioclipse.core.business.BioclipseException
-
calculateMajorIsotopeMass
public double calculateMajorIsotopeMass(net.bioclipse.core.domain.IMolecule molecule) throws net.bioclipse.core.business.BioclipseException - Throws:
net.bioclipse.core.business.BioclipseException
-
mcss
public net.bioclipse.cdk.domain.ICDKMolecule mcss(List<net.bioclipse.core.domain.IMolecule> molecules) throws net.bioclipse.core.business.BioclipseException Calculates the maximum common substructure (mcss) starting of two or more molecules starting with the mcss of the first two molecules.- Parameters:
molecules
- anList
ofIMolecule
- Returns:
- the mcss as an
ICDKMolecule
- Throws:
net.bioclipse.core.business.BioclipseException
- when the mcss cannot be computed from the input
-
newMolecule
public net.bioclipse.cdk.domain.ICDKMolecule newMolecule()Deprecated.usenewMolecule(IChemObjectBuilder)
ornewMolecule(IAtomContainer)
insteadCreates a newCDKMolecule
.- Returns:
- an
ICDKMolecule
created using the CDKSilentChemObjectBuilder
.
-
newMolecule
public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IChemObjectBuilder builder) Creates a newCDKMolecule
.- Parameters:
builder
- theIChemObjectBuilder
to use to create a CDKIAtomContainer
- Returns:
- an
ICDKMolecule
created using the givenIChemObjectBuilder
-
newMolecule
public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IAtomContainer atomContainer) Creates a newCDKMolecule
from the givenIAtomContainer
.- Parameters:
atomContainer
- theIAtomContainer
- Returns:
- an
ICDKMolecule
for the givenIAtomContainer
-
getManagerName
- Specified by:
getManagerName
in interfacenet.bioclipse.managers.business.IBioclipseManager
-
doi
Description copied from interface:IBactingManager
Lists the DOIs of the articles associated to this manager.- Specified by:
doi
in interfaceIBactingManager
- Returns:
- a
List
of String with DOIs
-
newMolecule(IChemObjectBuilder)
ornewMolecule(IAtomContainer)
instead