Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable AuxInfo generation in InChIFactory by default. This can be as…
… much as 20% of the compute time and is largely ignored. If the AuxInfo is wanted it can be generated by explicitly passing in an empty set of options.
- Loading branch information
Showing
3 changed files
with
18 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Collections; | ||
|
||
import javax.vecmath.Point2d; | ||
import javax.vecmath.Point3d; | ||
|
@@ -56,6 +57,8 @@ | |
import org.openscience.cdk.interfaces.ITetrahedralChirality; | ||
import org.openscience.cdk.interfaces.ITetrahedralChirality.Stereo; | ||
import org.openscience.cdk.stereo.ExtendedTetrahedral; | ||
import org.openscience.cdk.tools.ILoggingTool; | ||
import org.openscience.cdk.tools.LoggingToolFactory; | ||
|
||
/** | ||
* <p>This class generates the IUPAC International Chemical Identifier (InChI) for | ||
|
@@ -99,10 +102,14 @@ | |
*/ | ||
public class InChIGenerator { | ||
|
||
protected JniInchiInput input; | ||
protected JniInchiInput input; | ||
|
||
protected JniInchiOutput output; | ||
|
||
private final boolean auxNone; | ||
|
||
private static final ILoggingTool LOGGER = LoggingToolFactory.createLoggingTool(InChIGenerator.class); | ||
|
||
/** | ||
* AtomContainer instance refers to. | ||
*/ | ||
|
@@ -120,12 +127,7 @@ public class InChIGenerator { | |
* error during InChI generation | ||
*/ | ||
protected InChIGenerator(IAtomContainer atomContainer, boolean ignoreAromaticBonds) throws CDKException { | ||
try { | ||
input = new JniInchiInput(""); | ||
generateInchiFromCDKAtomContainer(atomContainer, ignoreAromaticBonds); | ||
} catch (JniInchiException jie) { | ||
throw new CDKException("InChI generation failed: " + jie.getMessage(), jie); | ||
} | ||
this(atomContainer, Collections.singletonList(INCHI_OPTION.AuxNone), ignoreAromaticBonds); | ||
} | ||
|
||
/** | ||
|
@@ -146,6 +148,7 @@ protected InChIGenerator(IAtomContainer atomContainer, String options, boolean i | |
try { | ||
input = new JniInchiInput(options); | ||
generateInchiFromCDKAtomContainer(atomContainer, ignoreAromaticBonds); | ||
auxNone = input.getOptions() != null && input.getOptions().contains("AuxNone"); | ||
} catch (JniInchiException jie) { | ||
throw new CDKException("InChI generation failed: " + jie.getMessage(), jie); | ||
} | ||
|
@@ -167,6 +170,7 @@ protected InChIGenerator(IAtomContainer atomContainer, List<INCHI_OPTION> option | |
try { | ||
input = new JniInchiInput(options); | ||
generateInchiFromCDKAtomContainer(atomContainer, ignoreAromaticBonds); | ||
auxNone = input.getOptions() != null && input.getOptions().contains("AuxNone"); | ||
} catch (JniInchiException jie) { | ||
throw new CDKException("InChI generation failed: " + jie.getMessage(), jie); | ||
} | ||
|
@@ -551,6 +555,9 @@ public String getInchiKey() throws CDKException { | |
* Gets auxillary information. | ||
*/ | ||
public String getAuxInfo() { | ||
if (auxNone) { | ||
LOGGER.warn("AuxInfo requested but AuxNone option is set (default)."); | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
johnmay
Author
Member
|
||
return (output.getAuxInfo()); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should it not better throw an error? the warning will get lost... I mean, really throw... logger messages are for debugging purposes, right? Not for operational behavior...