Class InChIToStructure
This class generates a CDK IAtomContainer from an InChI string or an AuxInfo string. It places calls to a JNI wrapper for the InChI C library.
It acts as a wrapper around the JNI-InChI library functions, parsing the InChI or AuxInfo string to regenerate the molecular structure.
The generated IAtomContainer will have all 2D and 3D coordinates set to 0.0,
in case an InChI string was parsed. If an AuxInfo string was parsed the resulting IAtomContainer
will have the same 2D or 3D coordinates as given in the AuxInfo string. If there are no coordinates
given they are also set to 0.0. If only 2D coordinates are provided the Z-coordinate is 0.0.
but may have atom parities set. Double bond and allene stereochemistry are
not currently recorded.
In some cases are no implicit hydrogens returned by the InChI API, if an AuxInfo string is parsed.
To set hydrogens the CDKAtomTypeMatcher is intended.
Example usage
String inchi = "InChI=1S/CH4/h1H4";
InChIToStructure parser = InInChIToStructure.fromInChI(inchi, SilentChemObjectBuilder.getInstance);
if (InChIStatus.SUCCESS.equals(parser.getStatus())
IAtomContainer structure = parser.getAtomContainer();
else
System.err.println("Error parsing InChI: " + parser.getMessage());
--------
String auxInfo = "AuxInfo=1/0/N:1/rA:1nC/rB:/rC:10.425,-3.075,0;";
InChIToStructure parser = InInChIToStructure.fromAuxInfo(auxInfo, SilentChemObjectBuilder.getInstance);
if (InChIStatus.SUCCESS.equals(parser.getStatus())
IAtomContainer structure = parser.getAtomContainer();
else
System.err.println("Error parsing AuxInfo: " + parser.getMessage());
- Author:
- Sam Adams, Felix Bänsch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.github.dan2097.jnainchi.InchiInputFromAuxinfoOutputprotected io.github.dan2097.jnainchi.InchiInputFromInchiOutputprotected IAtomContainerprotected io.github.dan2097.jnainchi.InchiOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic InChIToStructurefromAuxInfo(String auxInfo, IChemObjectBuilder builder) Generates IAtomContainer from AuxInfo string.static InChIToStructurefromInChI(String inchi, IChemObjectBuilder builder) Generates IAtomContainer from InChI string with default options.static InChIToStructurefromInChI(String inchi, IChemObjectBuilder builder, io.github.dan2097.jnainchi.InchiOptions opts) Generates IAtomContainer from InChI string.static InChIToStructurefromInChI(String inchi, IChemObjectBuilder builder, String options) Generates IAtomContainer from InChi string.static InChIToStructurefromInChI(String inchi, IChemObjectBuilder builder, List<String> options) Generates IAtomContainer from InChi string.Returns generated molecule.Returns chiral flag, whether input structure is chiral or not.getLog()Gets generated log.Gets generated (error/warning) messages.Deprecated.use getStatusio.github.dan2097.jnainchi.InchiStatusAccess the status of the InChI output.long[][]Returns warning flags, see INCHIDIFF in inchicmp.h.
-
Field Details
-
inchiOutput
protected io.github.dan2097.jnainchi.InchiInputFromInchiOutput inchiOutput -
auxinfoOutput
protected io.github.dan2097.jnainchi.InchiInputFromAuxinfoOutput auxinfoOutput -
options
protected io.github.dan2097.jnainchi.InchiOptions options -
molecule
-
-
Method Details
-
fromInChI
public static InChIToStructure fromInChI(String inchi, IChemObjectBuilder builder, io.github.dan2097.jnainchi.InchiOptions opts) throws CDKException Generates IAtomContainer from InChI string.- Parameters:
inchi- Stringbuilder-IChemObjectBuilderopts- InChIOptions- Returns:
- InChIToStructure object
- Throws:
CDKException- if parsing the InChI fails.
-
fromInChI
public static InChIToStructure fromInChI(String inchi, IChemObjectBuilder builder) throws CDKException Generates IAtomContainer from InChI string with default options.- Parameters:
inchi- Stringbuilder-IChemObjectBuilder- Returns:
- InChIToStructure object
- Throws:
CDKException- if parsing InChI fails.
-
fromInChI
public static InChIToStructure fromInChI(String inchi, IChemObjectBuilder builder, String options) throws CDKException Generates IAtomContainer from InChi string.- Parameters:
inchi- Stringbuilder-IChemObjectBuilderoptions- String- Returns:
- InChIToStructure object
- Throws:
CDKException- if parsing InChI fails.
-
fromInChI
public static InChIToStructure fromInChI(String inchi, IChemObjectBuilder builder, List<String> options) throws CDKException Generates IAtomContainer from InChi string.- Parameters:
inchi- Stringbuilder-IChemObjectBuilderoptions- List- Returns:
- InChIToStructure object
- Throws:
CDKException- if parsing InChI fails.
-
fromAuxInfo
public static InChIToStructure fromAuxInfo(String auxInfo, IChemObjectBuilder builder) throws CDKException Generates IAtomContainer from AuxInfo string.It should be noted that issues such as the potential absence of hydrogen atoms may arise during the process of reconversion within the InChI API. It is important to note that the result should be checked.
- Parameters:
auxInfo- Stringbuilder-IChemObjectBuilder- Returns:
- InChIToStructure object
- Throws:
CDKException- if parsing AuxInfo fails.
-
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.For InChI input only.
-
getWarningFlags
public long[][] getWarningFlags()Returns warning flags, see INCHIDIFF in inchicmp.h.For InChI input only.
[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 -
getChiralFlag
Returns chiral flag, whether input structure is chiral or not.For AuxInfo input only.
-