Class CDKManager

java.lang.Object
net.bioclipse.managers.CDKManager
All Implemented Interfaces:
IBactingManager, net.bioclipse.managers.business.IBioclipseManager

public class CDKManager extends Object implements IBactingManager
Bioclipse manager that provides cheminformatics functionality using the Chemistry Development Kit database.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CDKManager(String workspaceRoot)
    Creates a new CDKManager.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendToSDF(String sdFile, net.bioclipse.cdk.domain.ICDKMolecule molecule)
    Extends the given SD file with an molfile entry for the given ICDKMolecule.
    net.bioclipse.cdk.domain.ICDKMolecule
    asCDKMolecule(net.bioclipse.core.domain.IMolecule imol)
    Helper function that casts or converts the input IMolecule to an ICDKMolecule.
    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 Java List for storing ICDKMolecule.
    org.openscience.cdk.io.formats.IChemFormat
    Determines the file format of the given input.
    org.openscience.cdk.io.formats.IChemFormat
    Determines the file format of the given input.
    doi()
    Lists the DOIs of the articles associated to this manager.
    net.bioclipse.cdk.domain.ICDKMolecule
    fromCml(String molstring)
    Creates a new ICDKMolecule from CML in the given String.
    net.bioclipse.cdk.domain.ICDKMolecule
    fromSMILES(String smilesDescription)
    Creates a new ICDKMolecule from the SMILES in the given String.
    net.bioclipse.cdk.domain.ICDKMolecule
    fromString(String molstring)
    Creates a new ICDKMolecule from the content of the given String, 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
    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 new ICDKMolecule from the content of the given InputStream, assuming it is in the format as given by the IChemFormat.
    net.bioclipse.cdk.domain.ICDKMolecule
    Loads a molecule from file using CDK.
    net.bioclipse.cdk.domain.ICDKMolecule
    mcss(List<net.bioclipse.core.domain.IMolecule> molecules)
    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
    net.bioclipse.cdk.domain.ICDKMolecule
    newMolecule(org.openscience.cdk.interfaces.IAtomContainer atomContainer)
    Creates a new CDKMolecule from the given IAtomContainer.
    net.bioclipse.cdk.domain.ICDKMolecule
    newMolecule(org.openscience.cdk.interfaces.IChemObjectBuilder builder)
    Creates a new CDKMolecule.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CDKManager

      public CDKManager(String workspaceRoot)
      Creates a new CDKManager.
      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 new ICDKMolecule from the content of the given InputStream, assuming it is in the format as given by the IChemFormat.
      Parameters:
      instream - the stream with content in the given format
      format - 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 new ICDKMolecule from CML in the given String.
      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 input IMolecule to an ICDKMolecule.
      Parameters:
      imol - the input IMolecule that needs casting or converting
      Returns:
      the molecule as ICDKMolecule
      Throws:
      net.bioclipse.core.business.BioclipseException
    • createMoleculeList

      public List<net.bioclipse.cdk.domain.ICDKMolecule> createMoleculeList()
      Create a new Java List for storing ICDKMolecule.
      Returns:
      the created list
    • fromSMILES

      public net.bioclipse.cdk.domain.ICDKMolecule fromSMILES(String smilesDescription) throws net.bioclipse.core.business.BioclipseException
      Creates a new ICDKMolecule from the SMILES in the given String.
      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 new ICDKMolecule from the content of the given String, 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 as ICDKMolecule
      Returns:
      a IMolecularFormula object
    • molecularFormula

      public String molecularFormula(net.bioclipse.cdk.domain.ICDKMolecule m)
      Calculates the molecular formula for the given molecule.
      Parameters:
      m - the molecule as ICDKMolecule
      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 given ICDKMolecule.
      Parameters:
      sdFile - the file to add the molecule too
      molecule - the molecule to add to the file
      Throws:
      net.bioclipse.core.business.BioclipseException
    • isValidCAS

      public boolean isValidCAS(String number)
      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

      public org.openscience.cdk.io.formats.IChemFormat getFormat(String type)
    • getFormats

      public String 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 - an List of IMolecule
      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()
      Creates a new CDKMolecule.
      Returns:
      an ICDKMolecule created using the CDK SilentChemObjectBuilder.
    • newMolecule

      public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IChemObjectBuilder builder)
      Creates a new CDKMolecule.
      Parameters:
      builder - the IChemObjectBuilder to use to create a CDK IAtomContainer
      Returns:
      an ICDKMolecule created using the given IChemObjectBuilder
    • newMolecule

      public net.bioclipse.cdk.domain.ICDKMolecule newMolecule(org.openscience.cdk.interfaces.IAtomContainer atomContainer)
      Creates a new CDKMolecule from the given IAtomContainer.
      Parameters:
      atomContainer - the IAtomContainer
      Returns:
      an ICDKMolecule for the given IAtomContainer
    • getManagerName

      public String getManagerName()
      Specified by:
      getManagerName in interface net.bioclipse.managers.business.IBioclipseManager
    • doi

      public List<String> doi()
      Description copied from interface: IBactingManager
      Lists the DOIs of the articles associated to this manager.
      Specified by:
      doi in interface IBactingManager
      Returns:
      a List of String with DOIs