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();
Modifier and Type | Field and Description |
---|---|
protected IAtomContainer |
molecule |
protected io.github.dan2097.jnainchi.InchiOptions |
options |
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput |
output |
Modifier | Constructor and 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,
List<String> options)
Constructor.
|
protected |
InChIToStructure(String inchi,
IChemObjectBuilder builder,
String options)
Constructor.
|
Modifier and Type | Method and 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 getStatus
|
io.github.dan2097.jnainchi.InchiStatus |
getStatus()
Access the status of the InChI output.
|
long[][] |
getWarningFlags()
Returns warning flags, see INCHIDIFF in inchicmp.h.
|
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput output
protected io.github.dan2097.jnainchi.InchiOptions options
protected IAtomContainer molecule
protected InChIToStructure(String inchi, IChemObjectBuilder builder, io.github.dan2097.jnainchi.InchiOptions options) throws CDKException
inchi
- CDKException
protected InChIToStructure(String inchi, IChemObjectBuilder builder) throws CDKException
inchi
- CDKException
protected InChIToStructure(String inchi, IChemObjectBuilder builder, String options) throws CDKException
inchi
- options
- CDKException
protected InChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options) throws CDKException
inchi
- options
- CDKException
protected void generateAtomContainerFromInchi(IChemObjectBuilder builder) throws CDKException
CDKException
public IAtomContainer getAtomContainer()
@Deprecated public INCHI_RET getReturnStatus()
public io.github.dan2097.jnainchi.InchiStatus getStatus()
public String getMessage()
public String getLog()
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
Copyright © 2022. All rights reserved.