@TestClass(value="org.openscience.cdk.inchi.InChIToStructureTest") 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.
// 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();
Modifier and Type | Method and Description |
---|---|
IAtomContainer |
getAtomContainer()
Returns generated molecule.
|
String |
getLog()
Gets generated log.
|
String |
getMessage()
Gets generated (error/warning) messages.
|
net.sf.jniinchi.INCHI_RET |
getReturnStatus()
Gets return status from InChI process.
|
long[][] |
getWarningFlags()
Returns warning flags, see INCHIDIFF in inchicmp.h.
|
@TestMethod(value="testGetAtomContainer") public IAtomContainer getAtomContainer()
@TestMethod(value="testGetReturnStatus_EOF") public net.sf.jniinchi.INCHI_RET getReturnStatus()
@TestMethod(value="testGetMessage") public String getMessage()
@TestMethod(value="testGetLog") public String getLog()
@TestMethod(value="testGetWarningFlags") 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