Class InChIToStructure
- java.lang.Object
-
- org.openscience.cdk.inchi.InChIToStructure
-
public class InChIToStructure extends Object
This class generates a CDK IAtomContainer from an InChI string. It places calls to a JNI wrapper for the InChI C++ library.
The generated IAtomContainer will have all 2D and 3D coordinates set to 0.0, but may have atom parities set. Double bond and allene stereochemistry are not currently recorded.
Example usage// Generate factory - throws CDKException if native code does not load
InChIGeneratorFactory factory = new InChIGeneratorFactory();
// Get InChIToStructure
InChIToStructure intostruct = factory.getInChIToStructure(
inchi, DefaultChemObjectBuilder.getInstance()
);
INCHI_RET ret = intostruct.getReturnStatus();
if (ret == INCHI_RET.WARNING) {
// Structure generated, but with warning message
System.out.println("InChI warning: " + intostruct.getMessage());
} else if (ret != INCHI_RET.OKAY) {
// Structure generation failed
throw new CDKException("Structure generation failed failed: " + ret.toString()
+ " [" + intostruct.getMessage() + "]");
}
IAtomContainer container = intostruct.getAtomContainer();
- Author:
- Sam Adams
- Source code:
- main
- Belongs to CDK module:
- inchi
-
-
Field Summary
Fields Modifier and Type Field Description protected IAtomContainer
molecule
protected io.github.dan2097.jnainchi.InchiOptions
options
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput
output
-
Constructor Summary
Constructors Modifier Constructor Description protected
InChIToStructure(String inchi, IChemObjectBuilder builder)
Constructor.protected
InChIToStructure(String inchi, IChemObjectBuilder builder, io.github.dan2097.jnainchi.InchiOptions options)
Constructor.protected
InChIToStructure(String inchi, IChemObjectBuilder builder, String options)
Constructor.protected
InChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
generateAtomContainerFromInchi(IChemObjectBuilder builder)
Gets structure from InChI, and converts InChI library data structure into an IAtomContainer.IAtomContainer
getAtomContainer()
Returns generated molecule.String
getLog()
Gets generated log.String
getMessage()
Gets generated (error/warning) messages.INCHI_RET
getReturnStatus()
Deprecated.use getStatusio.github.dan2097.jnainchi.InchiStatus
getStatus()
Access the status of the InChI output.long[][]
getWarningFlags()
Returns warning flags, see INCHIDIFF in inchicmp.h.
-
-
-
Field Detail
-
output
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput output
-
options
protected io.github.dan2097.jnainchi.InchiOptions options
-
molecule
protected IAtomContainer molecule
-
-
Constructor Detail
-
InChIToStructure
protected InChIToStructure(String inchi, IChemObjectBuilder builder, io.github.dan2097.jnainchi.InchiOptions options) throws CDKException
Constructor. Generates CDK AtomContainer from InChI.- Parameters:
inchi
-- Throws:
CDKException
-
InChIToStructure
protected InChIToStructure(String inchi, IChemObjectBuilder builder) throws CDKException
Constructor. Generates CDK AtomContainer from InChI.- Parameters:
inchi
-- Throws:
CDKException
-
InChIToStructure
protected InChIToStructure(String inchi, IChemObjectBuilder builder, String options) throws CDKException
Constructor. Generates CMLMolecule from InChI.- Parameters:
inchi
-options
-- Throws:
CDKException
-
InChIToStructure
protected InChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options) throws CDKException
Constructor. Generates CMLMolecule from InChI.- Parameters:
inchi
-options
-- Throws:
CDKException
-
-
Method Detail
-
generateAtomContainerFromInchi
protected void generateAtomContainerFromInchi(IChemObjectBuilder builder) throws CDKException
Gets structure from InChI, and converts InChI library data structure into an IAtomContainer.- Throws:
CDKException
-
getAtomContainer
public IAtomContainer getAtomContainer()
Returns generated molecule.- Returns:
- An AtomContainer object
-
getReturnStatus
@Deprecated public INCHI_RET getReturnStatus()
Deprecated.use getStatusGets return status from InChI process. OKAY and WARNING indicate InChI has been generated, in all other cases InChI generation has failed. This returns the JNI INCHI enum and requires the optional "cdk-jniinchi-support" module to be loaded (or the full JNI InChI lib to be on the class path).
-
getStatus
public io.github.dan2097.jnainchi.InchiStatus getStatus()
Access the status of the InChI output.- Returns:
- the status
-
getMessage
public String getMessage()
Gets generated (error/warning) messages.
-
getLog
public String getLog()
Gets generated log.
-
getWarningFlags
public long[][] getWarningFlags()
Returns warning flags, see INCHIDIFF in inchicmp.h.
[x][y]:
x=0 => Reconnected if present in InChI otherwise Disconnected/Normal
x=1 => Disconnected layer if Reconnected layer is present
y=1 => Main layer or Mobile-H
y=0 => Fixed-H layer
-
-