Class InChIGeneratorFactory
- java.lang.Object
-
- org.openscience.cdk.inchi.InChIGeneratorFactory
-
public class InChIGeneratorFactory extends Object
Factory providing access to
InChIGenerator
andInChIToStructure
. See those classes for examples of use. These methods make use of the JNI-InChI library.The
InChIGeneratorFactory
is a singleton class, which means that there exists only one instance of the class. An instance of this class is obtained with:InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
InChI/Structure interconversion is implemented in this way so that we can check whether or not the native code required is available. If the native code cannot be loaded during the first call to
getInstance
method (when the instance is created) aCDKException
will be thrown. The most common problem is that the native code is not in the * the correct location. Java searches the locations in the PATH environmental variable, under Windows, and LD_LIBRARY_PATH under Linux, so the JNI-InChI native libraries must be in one of these locations. If the JNI-InChI jar file is being used and either the current working directory, or '.' are contained in PATH of LD_LIBRARY_PATH then the native code should be placed automatically. If the native files are in the correct location but fail to load, then they may need to be recompiled for your system. See:- http://sourceforge.net/projects/jni-inchi
- http://www.iupac.org/inchi/
- Author:
- Sam Adams
- Source code:
- main
- Belongs to CDK module:
- inchi
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
getIgnoreAromaticBonds()
Deprecated.InChIGenerator
getInChIGenerator(IAtomContainer container)
Gets an Standard InChI generator for aIAtomContainer
.InChIGenerator
getInChIGenerator(IAtomContainer container, io.github.dan2097.jnainchi.InchiFlag... flags)
Get an InChI generator providing flags to customise the generation.InChIGenerator
getInChIGenerator(IAtomContainer container, io.github.dan2097.jnainchi.InchiOptions options)
Get an InChI generator providing flags to customise the generation.InChIGenerator
getInChIGenerator(IAtomContainer container, String options)
Gets InChI generator for CDK IAtomContainer.InChIGenerator
getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options)
InChIToStructure
getInChIToStructure(String inchi, IChemObjectBuilder builder)
Gets structure generator for an InChI string.InChIToStructure
getInChIToStructure(String inchi, IChemObjectBuilder builder, String options)
Gets structure generator for an InChI string.InChIToStructure
getInChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options)
Gets structure generator for an InChI string.static InChIGeneratorFactory
getInstance()
Gives the oneInChIGeneratorFactory
instance, if needed also creates it.void
setIgnoreAromaticBonds(boolean ignore)
Deprecated."the use of aromatic bonds is strongly discouraged" - InChI FAQ, the InChI will fail for many compounds if ignore aromatic bonds is not enabled and the compound have aromatic flags.
-
-
-
Method Detail
-
getInstance
public static InChIGeneratorFactory getInstance() throws CDKException
Gives the oneInChIGeneratorFactory
instance, if needed also creates it.- Returns:
- the one
InChIGeneratorFactory
instance - Throws:
CDKException
- if unable to load native code when attempting to create the factory
-
setIgnoreAromaticBonds
@Deprecated public void setIgnoreAromaticBonds(boolean ignore)
Deprecated."the use of aromatic bonds is strongly discouraged" - InChI FAQ, the InChI will fail for many compounds if ignore aromatic bonds is not enabled and the compound have aromatic flags.Sets whether aromatic bonds should be treated as single and double bonds for the InChI generation. The bond type INCHI_BOND_TYPE.ALTERN is considered special in contrast to single, double, and triple bonds, and is not bulletproof. If the molecule has clearly defined single and double bonds, the option can be used to force the class not to use the alternating bond type.http://www.inchi-trust.org/fileadmin/user_upload/html/inchifaq/inchi-faq.html#16.3
- Parameters:
ignore
- if aromatic bonds should be treated as bonds of type single and double
-
getIgnoreAromaticBonds
@Deprecated public boolean getIgnoreAromaticBonds()
Deprecated.Returns whether aromatic bonds are treated as single and double bonds for the InChI generation.- Returns:
- if aromatic bonds are treated as bonds of type single and double
-
getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container) throws CDKException
Gets an Standard InChI generator for aIAtomContainer
. AuxInfo is not generated by this method, please usegetInChIGenerator(IAtomContainer, List)
with no options specified if you would like to generate AuxInfo.- Parameters:
container
- AtomContainer to generate InChI for.- Returns:
- the InChI generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, String options) throws CDKException
Gets InChI generator for CDK IAtomContainer.- Parameters:
container
- AtomContainer to generate InChI for.options
- Space or comma delimited string of options for InChI generation.- Returns:
- the InChI generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
getInChIGenerator
@Deprecated public InChIGenerator getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options) throws CDKException
Deprecated.Gets InChI generator for CDK IAtomContainer.- Parameters:
container
- AtomContainer to generate InChI for.options
- List of options (net.sf.jniinchi.INCHI_OPTION) for InChI generation.- Returns:
- the InChI generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, io.github.dan2097.jnainchi.InchiFlag... flags) throws CDKException
Get an InChI generator providing flags to customise the generation. If you need to provide a timeout the method that accepts anInchiOptions
should be used.- Parameters:
container
- the moleculeflags
- the option flags- Returns:
- the InChI generator
- Throws:
CDKException
- something went wrong- See Also:
getInChIGenerator(org.openscience.cdk.interfaces.IAtomContainer, io.github.dan2097.jnainchi.InchiOptions)
-
getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, io.github.dan2097.jnainchi.InchiOptions options) throws CDKException
Get an InChI generator providing flags to customise the generation.- Parameters:
container
- the moleculeoptions
- the inchi option flags- Returns:
- the InChI generator
- Throws:
CDKException
- something went wrong
-
getInChIToStructure
public InChIToStructure getInChIToStructure(String inchi, IChemObjectBuilder builder) throws CDKException
Gets structure generator for an InChI string.- Parameters:
inchi
- InChI to generate structure from.builder
- the builder to use- Returns:
- the InChI structure generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
getInChIToStructure
public InChIToStructure getInChIToStructure(String inchi, IChemObjectBuilder builder, String options) throws CDKException
Gets structure generator for an InChI string.
- Parameters:
inchi
- InChI to generate structure from.builder
- the builder to employoptions
- String of options for structure generation.- Returns:
- the InChI structure generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
getInChIToStructure
public InChIToStructure getInChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options) throws CDKException
Gets structure generator for an InChI string.
- Parameters:
inchi
- InChI to generate structure from.options
- List of options (net.sf.jniinchi.INCHI_OPTION) for structure generation.builder
- the builder to employ- Returns:
- the InChI structure generator object
- Throws:
CDKException
- if the generator cannot be instantiated
-
-