public class InChIGenerator extends Object
This class generates the IUPAC International Chemical Identifier (InChI) for a CDK IAtomContainer. It places calls to a JNI wrapper for the InChI C++ library.
If the atom container has 3D coordinates for all of its atoms then they will be used, otherwise 2D coordinates will be used if available.
Spin multiplicities and some aspects of stereochemistry are not
currently handled completely.
Example usage
// Generate factory - throws CDKException if native code does not load
InChIGeneratorFactory factory = new InChIGeneratorFactory();
// Get InChIGenerator
InChIGenerator gen = factory.getInChIGenerator(container);
INCHI_RET ret = gen.getReturnStatus();
if (ret == INCHI_RET.WARNING) {
// InChI generated, but with warning message
System.out.println("InChI warning: " + gen.getMessage());
} else if (ret != INCHI_RET.OKAY) {
// InChI generation failed
throw new CDKException("InChI failed: " + ret.toString()
+ " [" + gen.getMessage() + "]");
}
String inchi = gen.getInchi();
String auxinfo = gen.getAuxInfo();
TODO: distinguish between singlet and undefined spin multiplicity
TODO: double bond and allene parities
TODO: problem recognising bond stereochemistry
Modifier and Type | Field and Description |
---|---|
protected IAtomContainer |
atomContainer
AtomContainer instance refers to.
|
protected io.github.dan2097.jnainchi.InchiInput |
input |
protected io.github.dan2097.jnainchi.InchiOptions |
options |
protected io.github.dan2097.jnainchi.InchiOutput |
output |
Modifier | Constructor and Description |
---|---|
protected |
InChIGenerator(IAtomContainer atomContainer,
boolean ignoreAromaticBonds)
Constructor.
|
protected |
InChIGenerator(IAtomContainer atomContainer,
io.github.dan2097.jnainchi.InchiOptions options,
boolean ignoreAromaticBonds) |
protected |
InChIGenerator(IAtomContainer atomContainer,
List<INCHI_OPTION> opts,
boolean ignoreAromaticBonds)
Deprecated.
|
protected |
InChIGenerator(IAtomContainer atomContainer,
String optStr,
boolean ignoreAromaticBonds)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getAuxInfo()
Gets auxillary information.
|
String |
getInchi()
Gets generated InChI string.
|
String |
getInchiKey()
Gets generated InChIKey string.
|
String |
getLog()
Gets generated log.
|
String |
getMessage()
Gets generated (error/warning) messages.
|
INCHI_RET |
getReturnStatus()
Deprecated.
use getStatus
|
io.github.dan2097.jnainchi.InchiStatus |
getStatus()
Access the status of the InChI output.
|
protected io.github.dan2097.jnainchi.InchiOptions options
protected io.github.dan2097.jnainchi.InchiInput input
protected io.github.dan2097.jnainchi.InchiOutput output
protected IAtomContainer atomContainer
protected InChIGenerator(IAtomContainer atomContainer, io.github.dan2097.jnainchi.InchiOptions options, boolean ignoreAromaticBonds) throws CDKException
CDKException
protected InChIGenerator(IAtomContainer atomContainer, boolean ignoreAromaticBonds) throws CDKException
Constructor. Generates InChI from CDK AtomContainer.
Reads atoms, bonds etc from atom container and converts to format InChI library requires, then calls the library.
atomContainer
- AtomContainer to generate InChI for.ignoreAromaticBonds
- if aromatic bonds should be treated as bonds of type single and doubleCDKException
- if there is an
error during InChI generationprotected InChIGenerator(IAtomContainer atomContainer, String optStr, boolean ignoreAromaticBonds) throws CDKException
Constructor. Generates InChI from CDK AtomContainer.
Reads atoms, bonds etc from atom container and converts to format InChI library requires, then calls the library.
atomContainer
- AtomContainer to generate InChI for.optStr
- Space delimited string of options to pass to InChI library.
Each option may optionally be preceded by a command line
switch (/ or -).ignoreAromaticBonds
- if aromatic bonds should be treated as bonds of type single and doubleCDKException
@Deprecated protected InChIGenerator(IAtomContainer atomContainer, List<INCHI_OPTION> opts, boolean ignoreAromaticBonds) throws CDKException
Constructor. Generates InChI from CDK AtomContainer.
Reads atoms, bonds etc from atom container and converts to format InChI library requires, then calls the library.
atomContainer
- AtomContainer to generate InChI for.opts
- List of INCHI_OPTION.ignoreAromaticBonds
- if aromatic bonds should be treated as bonds of type single and doubleCDKException
@Deprecated public INCHI_RET getReturnStatus()
public io.github.dan2097.jnainchi.InchiStatus getStatus()
public String getInchi()
public String getInchiKey() throws CDKException
CDKException
public String getAuxInfo()
public String getMessage()
public String getLog()
Copyright © 2022. All rights reserved.