Class InChIToStructure
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
FieldsModifier and TypeFieldDescriptionprotected IAtomContainer
protected io.github.dan2097.jnainchi.InchiOptions
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionprotected void
Gets structure from InChI, and converts InChI library data structure into an IAtomContainer.Returns generated molecule.getLog()
Gets generated log.Gets generated (error/warning) messages.Deprecated.use getStatusio.github.dan2097.jnainchi.InchiStatus
Access the status of the InChI output.long[][]
Returns warning flags, see INCHIDIFF in inchicmp.h.
-
Field Details
-
output
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput output -
options
protected io.github.dan2097.jnainchi.InchiOptions options -
molecule
-
-
Constructor Details
-
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
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 Details
-
generateAtomContainerFromInchi
Gets structure from InChI, and converts InChI library data structure into an IAtomContainer.- Throws:
CDKException
-
getAtomContainer
Returns generated molecule.- Returns:
- An AtomContainer object
-
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
Gets generated (error/warning) messages. -
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
-