Search in sources :

Example 1 with InChIToStructure

use of org.openscience.cdk.inchi.InChIToStructure in project MassBank-web by MassBank.

the class StructureToSvgStringGenerator method structureFromInChI.

public static IAtomContainer structureFromInChI(String inchi) {
    IAtomContainer mol = null;
    try {
        // get atom container
        InChIGeneratorFactory inchiFactory = InChIGeneratorFactory.getInstance();
        InChIToStructure inchi2structure = inchiFactory.getInChIToStructure(inchi, DefaultChemObjectBuilder.getInstance());
        mol = inchi2structure.getAtomContainer();
    } catch (CDKException e) {
        System.out.println("Warning: " + e.getLocalizedMessage());
    }
    return mol;
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) CDKException(org.openscience.cdk.exception.CDKException) InChIToStructure(org.openscience.cdk.inchi.InChIToStructure) InChIGeneratorFactory(org.openscience.cdk.inchi.InChIGeneratorFactory)

Aggregations

CDKException (org.openscience.cdk.exception.CDKException)1 InChIGeneratorFactory (org.openscience.cdk.inchi.InChIGeneratorFactory)1 InChIToStructure (org.openscience.cdk.inchi.InChIToStructure)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1