Class RInChIGenerator
In this implementation, generation of the RInChI is based on generating InChIs and associated auxiliary information (auxinfo) for the individual reaction components using the JNA wrapper for the InChI C++ library. The pieces are then assembled into a RInChI string and reaction auxiliary information (rauxinfo) string. Computation of the three different RInChI keys Long-RInChIKey, Short-RInChIKey and Web-RInChIKey are implemented in Java.
Consequently, any limitation of the InChIGenerator also impacts on the computation of the RInChI. In
addition, this RInChI implementation has the following limitations:
- The RAuxInfo may differ in the /rA layers, as the CDK interprets the mol-file differently than the command line interface of the RInChI.
- If the Rxnfile contains additional structures other than those specified in the ‘count line’, these are interpreted by the CDK as products. The RInChI software strictly adheres to the ‘count line’.
Please note that there are no exceptions thrown if an issue is encountered during processing. Instead,
a StatusMessagesOutput.Status can be retrieved with StatusMessagesOutput.getStatus() that should be assessed. If the status is
not StatusMessagesOutput.Status.SUCCESS emitted messages can be accessed with StatusMessagesOutput.getMessages(). These
messages should capture relevant information about what exactly went wrong.
Given an IReaction, RInChI, RAuxInfo, Long-RInChIKey, Short-RInChIKey and Web-RInChIKey can be generated using default options:
// All that's needed is an IReaction object, e.g., by loading an RXN file.
IReaction reaction = ....;
RInChIGenerator generator = new RInChIGenerator().generate(reaction);
if (generator.getStatus() == Status.SUCCESS) {
String rinchi = generator.getRInChI();
String rAuxInfo = generator.getAuxInfo();
String longKey = generator.getLongRInChIKey();
String shortKey = generator.getShortRInChIKey();
String webKey = generator.getWebRInChIKey();*
} else {
System.out.printf("RInChIGenerator came back with status %s: %s",
generator.getStatus(), String.join("; ", generator.getMessages()));
}
Alternatively, a customized set of options can be used:
IReaction reaction = ....;
RInChIOptions rinchiOptions = RInChIOptions.RInChIOptions.builder().forceEquilibrium().build();
RInChIGenerator generator = new RInChIGenerator(rinchiOptions).generate(reaction);
See:
- Author:
- Felix Bänsch, Uli Fechner
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openscience.cdk.rinchi.StatusMessagesOutput
StatusMessagesOutput.Status -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of RInChIGenerator using thedefault RInChIOptions.RInChIGenerator(RInChIOptions options) Generates RInChI from a CDK Reaction. -
Method Summary
Modifier and TypeMethodDescriptionGenerates RInChI and related keys for the provided chemical reaction.Gets auxiliary information.Returns Long-RInChIKey.Gets generated RInChI string.Returns Short-RInChIKey.Returns Web-RInChIKey.Methods inherited from class org.openscience.cdk.rinchi.StatusMessagesOutput
addMessage, clearStatusAndMessages, getMessages, getStatus
-
Constructor Details
-
RInChIGenerator
public RInChIGenerator()Constructs a new instance of RInChIGenerator using thedefault RInChIOptions. -
RInChIGenerator
Generates RInChI from a CDK Reaction.- Parameters:
options- zero or more options
-
-
Method Details
-
generate
Generates RInChI and related keys for the provided chemical reaction.- Parameters:
reaction- the chemical reaction to be converted into the RInChI format;- Returns:
- the current instance of RInChIGenerator with generated RInChI and keys,
-
getRInChI
Gets generated RInChI string.- Returns:
- generated RInChI
-
getAuxInfo
Gets auxiliary information.- Returns:
- RInChI AuxInfo
-
getShortRInChIKey
Returns Short-RInChIKey.- Returns:
- Short-RInChIKey
-
getLongRInChIKey
Returns Long-RInChIKey.- Returns:
- Long-RInChIKey
-
getWebRInChIKey
Returns Web-RInChIKey.- Returns:
- Web-RInChIKey
-