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 TypeMethodDescriptionvoidappendToSDF(String sdFile, net.bioclipse.cdk.domain.ICDKMolecule molecule) Extends the given SD file with an molfile entry for the givenICDKMolecule.net.bioclipse.cdk.domain.ICDKMoleculeasCDKMolecule(net.bioclipse.core.domain.IMolecule imol) Helper function that casts or converts the inputIMoleculeto anICDKMolecule.asSVG(net.bioclipse.core.domain.IMolecule molecule) doublecalculateMajorIsotopeMass(net.bioclipse.core.domain.IMolecule molecule) doublecalculateMass(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 JavaListfor storingICDKMolecule.org.openscience.cdk.io.formats.IChemFormatdetermineIChemFormat(String path) Determines the file format of the given input.org.openscience.cdk.io.formats.IChemFormatdetermineIChemFormatOfString(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.ICDKMoleculeCreates a newICDKMoleculefrom CML in the givenString.net.bioclipse.cdk.domain.ICDKMoleculefromSMILES(String smilesDescription) Creates a newICDKMoleculefrom the SMILES in the givenString.net.bioclipse.cdk.domain.ICDKMoleculefromString(String molstring) Creates a newICDKMoleculefrom 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.IChemFormatbooleanisValidCAS(String number) Determines if the given CAS registry number is valid.net.bioclipse.cdk.domain.ICDKMoleculeloadMolecule(InputStream instream, org.openscience.cdk.io.formats.IChemFormat format) Creates a newICDKMoleculefrom the content of the givenInputStream, assuming it is in the format as given by theIChemFormat.net.bioclipse.cdk.domain.ICDKMoleculeloadMolecule(String file) Loads a molecule from file using CDK.net.bioclipse.cdk.domain.ICDKMoleculeCalculates 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.IMolecularFormulamolecularFormulaObject(net.bioclipse.cdk.domain.ICDKMolecule m) Calculates the molecular formula for the given molecule.net.bioclipse.cdk.domain.ICDKMoleculeDeprecated.net.bioclipse.cdk.domain.ICDKMoleculenewMolecule(org.openscience.cdk.interfaces.IAtomContainer atomContainer) Creates a newCDKMoleculefrom the givenIAtomContainer.net.bioclipse.cdk.domain.ICDKMoleculenewMolecule(org.openscience.cdk.interfaces.IChemObjectBuilder builder) Creates a newCDKMolecule.List<org.openscience.cdk.interfaces.IAtomContainer>partition(net.bioclipse.core.domain.IMolecule molecule) inttotalFormalCharge(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
IMoleculeobject - Throws:
IOExceptionnet.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 newICDKMoleculefrom 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.BioclipseExceptionIOException
-
fromCml
public net.bioclipse.cdk.domain.ICDKMolecule fromCml(String molstring) throws net.bioclipse.core.business.BioclipseException, IOException Creates a newICDKMoleculefrom CML in the givenString.- Parameters:
molstring- the molecule in CML format- Returns:
- a data object for the given input
- Throws:
net.bioclipse.core.business.BioclipseExceptionIOException
-
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 inputIMoleculeto anICDKMolecule.- Parameters:
imol- the inputIMoleculethat needs casting or converting- Returns:
- the molecule as
ICDKMolecule - Throws:
net.bioclipse.core.business.BioclipseException
-
createMoleculeList
Create a new JavaListfor storingICDKMolecule.- Returns:
- the created list
-
fromSMILES
public net.bioclipse.cdk.domain.ICDKMolecule fromSMILES(String smilesDescription) throws net.bioclipse.core.business.BioclipseException Creates a newICDKMoleculefrom 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-Stringwith 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-Stringwith the chemical file- Returns:
- an
IChemFormatrepresenting the format - Throws:
IOException
-
fromString
public net.bioclipse.cdk.domain.ICDKMolecule fromString(String molstring) throws net.bioclipse.core.business.BioclipseException, IOException Creates a newICDKMoleculefrom 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.BioclipseExceptionIOException
-
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
IMolecularFormulaobject
-
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
Setwith 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
Setwith 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-IMoleculeto 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-IMoleculeto 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- anListofIMolecule- 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
ICDKMoleculecreated using the CDKSilentChemObjectBuilder.
-
newMolecule
public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IChemObjectBuilder builder) Creates a newCDKMolecule.- Parameters:
builder- theIChemObjectBuilderto use to create a CDKIAtomContainer- Returns:
- an
ICDKMoleculecreated using the givenIChemObjectBuilder
-
newMolecule
public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IAtomContainer atomContainer) Creates a newCDKMoleculefrom the givenIAtomContainer.- Parameters:
atomContainer- theIAtomContainer- Returns:
- an
ICDKMoleculefor the givenIAtomContainer
-
getManagerName
- Specified by:
getManagerNamein interfacenet.bioclipse.managers.business.IBioclipseManager
-
doi
Description copied from interface:IBactingManagerLists the DOIs of the articles associated to this manager.- Specified by:
doiin interfaceIBactingManager- Returns:
- a
Listof String with DOIs
-
newMolecule(IChemObjectBuilder)ornewMolecule(IAtomContainer)instead