|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.reaction.Reactor
public class Reactor
Executes a chemical reaction: creates products from reactants with reaction center data. If the reaction centers have not yet been searched for, uses substructure search to find and (optionally) store them. Provides API to single reaction processing.
See the documentation for details.
An example usage of the API:
// create Reactor
Reactor reactor = new Reactor();
// set the reaction ('rxmol' is the reaction molecule)
// reaction rules are read from RDF/MRV tags
reactor.setReaction(rxmol);
// set the reactants
reactor.setReactants(reactants);
// get the results
Molecule[] products;
while ((products = reactor.react()) != null) {
// export result molecules
for (Molecule product : products) {
exporter.write(product);
}
}
Another example with reaction rules and reaction output:
// create Reactor
Reactor reactor = new Reactor();
// set the reaction
// ('rxmol' is the reaction molecule,
// 'rid' is the reaction ID
// 'reactivity' is the reactivity rule,
// 'selectivity' is the selectivity rule
// 'tolerances' is the tolerance string)
reactor.setReaction(rxmol, rid, reactivity, selectivity, tolerances);
// set Reactor options
reactor.setResultType(Reactor.REACTION_OUTPUT);
reactor.setRatio(new int[] { 1, 2 });
// set the reactants
reactor.setReactants(reactants);
// get the results
Molecule[] result;
while ((result = reactor.react()) != null) {
// export result (reaction molecule)
for (Molecule rxn : result) {
exporter.write(rxn);
}
};
ConcurrentReactorProcessor,
Serialized Form| Field Summary | |
|---|---|
static int |
DEF_MAX_TRANSFORM_COUNT
Deprecated. Not used. Will be removed. |
static double |
DEF_TOLERANCE
The default tolerance. |
static int |
FUSED_REACTION_OUTPUT
Output type: fused reaction output. |
static int |
IGNORE_REACTIVITY
No-rule type: ignore reactivity rule. |
static int |
IGNORE_SELECTIVITY
No-rule type: ignore selectivity rule. |
static int |
IGNORE_TOLERANCE
No-rule type: ignore selectivity tolerance. |
static int |
MAPPING_STYLE_CHANGING
Output reaction mapping style: changing (ChemAxon). |
static int |
MAPPING_STYLE_COMPLETE
Output reaction mapping style: complete. |
static int |
MAPPING_STYLE_MATCHING
Output reaction mapping style: matching (Daylight). |
static int |
MAPPING_STYLE_NONE
Output reaction mapping style: none. |
static int |
NO_DUPLICATE_FILTERING
No duplicate product list filtering |
static int |
ORDER_INSENSITIVE_DUPLICATE_FILTERING
Order insensitive duplicate product list filtering |
static int |
ORDER_SENSITIVE_DUPLICATE_FILTERING
Order sensitive duplicate product list filtering |
static int |
PRODUCT_OUTPUT
Output type: products. |
static int |
REACTION_OUTPUT
Output type: reaction. |
| Constructor Summary | |
|---|---|
Reactor()
Default constructor. |
|
| Method Summary | |
|---|---|
Reaction |
createReactionObject(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
double[] tolerances)
Deprecated. Will be removed from the public API. |
Reaction |
createReactionObject(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
java.lang.String tolerances)
Deprecated. Will be removed from the public API. |
int |
getProductCount()
Returns the number of products. |
Standardizer |
getProductStandardizer()
Deprecated. Will be removed. Use Standardizer to standardize products. |
int |
getReactantCount()
Returns the number of reactants. |
Molecule[] |
getReactants()
Returns the input reactants. |
RxnMolecule |
getReaction()
Returns the reaction. |
java.lang.String |
getReactionID()
Returns the reaction ID. |
java.lang.String |
getReactionIDPropertyName()
Returns the reaction ID property (RDF/MRV tag) name. |
Molecule |
getReactionProduct(int i)
Returns a reaction product. |
Molecule |
getReactionReactant(int i)
Returns a reaction reactant. |
Standardizer |
getStandardizer()
Deprecated. Will be removed. Use Standardizer to standardize reactants. |
boolean |
isCached()
Returns the "cached" property: true if search and calculation results are to be cached and reused. |
boolean |
isLicensed()
|
boolean |
isReverse()
Returns true if the reaction is to be processed in reversed direction. |
boolean |
isSingle()
Returns true if single mode. |
static void |
main(java.lang.String[] args)
Deprecated. ConcurrentReactorProcessor provides command line interface for Reactor command line application. |
Molecule[] |
react()
Performs the reaction. |
void |
restart()
Restarts the reactor: the following call to react()
will return the first product set. |
void |
setCached(boolean cached)
Sets the "cached" property: true if search and calculation results are to be cached and reused. |
void |
setComponentIDPropertyNames(java.lang.String[] reactantIDProps,
java.lang.String[] productIDProps)
Sets reactant/product ID property (SDF/MRV tag) names. |
void |
setComponentIDPropertyNames(java.lang.String reactantIDProp,
java.lang.String productIDProp)
Sets reactant/product ID property (SDF/MRV tag) names. |
void |
setCopyAllReactantProperties(boolean c)
Sets to copy all reactant properties to output products/reactions. |
void |
setCopyReactantProperties(java.util.Map<java.lang.String,java.lang.String> patternBasedProperties)
Sets the reactant properties which should created in output products/reactions, based on a pattern. |
void |
setCopyReactantProperties(java.lang.String[][] reactantPropertiesToCopy)
Sets the reactant properties which should be copied to output products/reactions. |
void |
setCopyReactantProperties(java.lang.String[][] sourceProperties,
java.lang.String[][] targetProperties)
Sets the reactant properties which should be copied to output products/reactions. |
void |
setDuplicateFiltering(int duplicateFilteringMethod)
Sets duplicate product list filtering. |
void |
setIgnoreReactionDefinedStandardizer(boolean ignore)
Deprecated. Will be removed. |
void |
setIgnoreRules(int type)
Ignore reaction rules: 0: apply both rules (default)
IGNORE_REACTIVITY: ignore reactivity rule
IGNORE_SELECTIVITY: ignore selectivity rule
IGNORE_TOLERANCE: ignore selectivity tolerance
IGNORE_REACTIVITY | IGNORE_SELECTIVITY:
ignore both rules
IGNORE_REACTIVITY | IGNORE_TOLERANCE:
ignore reactivity rule and selectivity tolerance
|
void |
setLicenseEnvironment(java.lang.String env)
For internal use only. |
void |
setMaxNumberOfProductSets(int pieces)
Deprecated. Not used. |
void |
setOutputReactionMappingStyle(int style)
Sets the output reaction's mapping style. |
void |
setProductIndexes(int[] inds)
Sets the product indexes (1-based) to be returned (default: null - all products). |
void |
setProductStandardizer(Standardizer productStandardizer)
Deprecated. Will be removed. Use Standardizer to standardize products. |
void |
setRatio(int[] ratio)
Sets the ratio of the reactants. |
void |
setReactant(Molecule mol)
Sets single reactant. |
void |
setReactants(Molecule[] mols)
Sets the reactants. |
void |
setReactants(java.lang.String molstr)
Sets the reactants from a multi-fragment SMILES string: fragments separated by '.' are taken as separate reactants, therefore it is not possible to set a multi-fragment reactant with this method (use setReactants(Molecule[] mols)
for this purpose). |
void |
setReaction(Molecule rxmol)
Sets the reaction with reaction rules set in RDF/MRV tags REACTIVITY, EXCLUDE, SELECTIVITY, TOLERANCE. |
void |
setReaction(Molecule rxmol,
java.lang.String rid)
Sets the reaction with reaction rules set in RDF/MRV tags REACTIVITY, EXCLUDE, SELECTIVITY, TOLERANCE. |
void |
setReaction(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
double[] tolerances)
Sets the reaction and the reaction rules. |
void |
setReaction(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
java.lang.String tolerances)
Sets the reaction and the reaction rules. |
void |
setReaction(Reaction reaction)
Deprecated. Will be removed from the public API. |
void |
setReactionIDPropertyName(java.lang.String reactionIDProp)
Sets the reaction ID property (RDF/MRV tag) name. |
void |
setReactionString(java.lang.String str)
Sets the reaction and optionally the reaction rules specified in a string. |
void |
setReactionString(java.lang.String str,
java.lang.String rid)
Sets the reaction and optionally the reaction rules specified in a string. |
void |
setRemoveDuplicateProductReferences(boolean rmduprefs)
Sets to remove product reference repetitions from the generated product array. |
void |
setResultType(int type)
Sets the result type. |
void |
setReverse(boolean reverse)
Sets the "reverse" property: true if the reaction is to be
processed in reversed direction, that is, the product and reactant sides
are swapped. |
void |
setSearchOptions(java.lang.String searchOptions)
Modifies the default search options used by the Reactor engine. |
void |
setShowUnsuccessfulReactions(boolean showUnsuccessfulReactions)
Sets if unsuccessful reactions (reactions which do not result products) should be shown in output. |
void |
setSingle(boolean single)
Sets single mode. |
void |
setSkipReactionMappingCheck(boolean skip)
Sets to skip reaction mapping check. |
void |
setStandardizer(Standardizer standardizer)
Deprecated. Will be removed. Use Standardizer to standardize reactants. |
void |
setTransform(boolean transform)
Deprecated. Use Standardizer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PRODUCT_OUTPUT
public static final int REACTION_OUTPUT
public static final int FUSED_REACTION_OUTPUT
public static final int NO_DUPLICATE_FILTERING
public static final int ORDER_SENSITIVE_DUPLICATE_FILTERING
public static final int ORDER_INSENSITIVE_DUPLICATE_FILTERING
public static final int MAPPING_STYLE_NONE
public static final int MAPPING_STYLE_CHANGING
public static final int MAPPING_STYLE_COMPLETE
public static final int MAPPING_STYLE_MATCHING
public static final int IGNORE_REACTIVITY
public static final int IGNORE_SELECTIVITY
public static final int IGNORE_TOLERANCE
public static final double DEF_TOLERANCE
public static final int DEF_MAX_TRANSFORM_COUNT
| Constructor Detail |
|---|
public Reactor()
| Method Detail |
|---|
public void setLicenseEnvironment(java.lang.String env)
setLicenseEnvironment in interface chemaxon.license.Licensableenv - the license environmentpublic void setTransform(boolean transform)
Standardizer.
true if the original reactant
should be transformed instead of creating new product molecules.
Used from Standardizer and in transform mode.
The default is false.
transform - is true if transform modepublic java.lang.String getReactionID()
public void setIgnoreRules(int type)
0: apply both rules (default)
IGNORE_REACTIVITY: ignore reactivity rule
IGNORE_SELECTIVITY: ignore selectivity rule
IGNORE_TOLERANCE: ignore selectivity tolerance
IGNORE_REACTIVITY | IGNORE_SELECTIVITY:
ignore both rules
IGNORE_REACTIVITY | IGNORE_TOLERANCE:
ignore reactivity rule and selectivity tolerance
type - is the rule type(s) to be ignored (see above)public void setSkipReactionMappingCheck(boolean skip)
false.
skip - if true then reaction mapping will not be checkedpublic void setSingle(boolean single)
react() returns null.
The default is false (non-single mode).
single - is true if single modepublic boolean isSingle()
true if single mode.
In single mode only single product lists are returned,
that is, if there are more than one product lists for a given reactant
list then react() retruns null.
The default is false (non-single mode).
true if single modepublic void setShowUnsuccessfulReactions(boolean showUnsuccessfulReactions)
REACTION_OUTPUT.
showUnsuccessfulReactions - if true, then unsuccessful reactions will be shown with empty products side in the outputsetResultType(int)public void setDuplicateFiltering(int duplicateFilteringMethod)
NO_DUPLICATE_FILTERING: no duplicate filtering
ORDER_SENSITIVE_DUPLICATE_FILTERING: order sensitive duplicate filtering
ORDER_INSENSITIVE_DUPLICATE_FILTERING: order insensitive duplicate filtering
The default is ORDER_SENSITIVE_DUPLICATE_FILTERING.
Note that skipping duplicate product list filtering increases efficiency
therefore it is wise to set this parameter to NO_DUPLICATE_FILTERING
if duplicates do not matter (e.g. if only the first product list
is queried by calling react() only once).
duplicateFilteringMethod - is the filtering methodpublic void setMaxNumberOfProductSets(int pieces)
-1 to return all product sets.
(default: return all product sets)
pieces - is the maximum number of products set to be returned for one reactant setpublic void setProductIndexes(int[] inds)
null - all products).
inds - is the 1-based product index array, null for all productspublic void setResultType(int type)
Available types:
PRODUCT_OUTPUT: products molecules are returned. Each call to react() method returns the next product
set.
REACTION_OUTPUT: reactants -> products reaction is returned. Each call to react() method returns a
reaction containing the next product set.
FUSED_REACTION_OUTPUT: reactants -> products reaction is returned, with all possible products on the right side.
react() method should only be called once; further react() calls will return null.
In case of REACTION_OUTPUT and FUSED_REACTION_OUTPUT the Molecule[]
array returned by react() method will contain the reactants -> products reaction as
RxnMolecule.
Setting the result type restarts processing of the current reactant set - next call to react() will return the first
product set.
Default: PRODUCT_OUTPUT
type - is the result typepublic void setOutputReactionMappingStyle(int style)
MAPPING_STYLE_NONE
style - is the output reaction's mapping stylepublic void setStandardizer(Standardizer standardizer)
Standardizer to standardize reactants.
standardizer - is the reactant standardizer objectpublic Standardizer getStandardizer()
Standardizer to standardize reactants.
public void setIgnoreReactionDefinedStandardizer(boolean ignore)
STANDARDIZATION RDF/MRV tag of the reaction molecule.
ignore - if true reaction defined standardization is ignoredpublic void setProductStandardizer(Standardizer productStandardizer)
Standardizer to standardize products.
productStandardizer - is the product standardizer objectpublic Standardizer getProductStandardizer()
Standardizer to standardize products.
public void setReverse(boolean reverse)
true if the reaction is to be
processed in reversed direction, that is, the product and reactant sides
are swapped. Default: false.
Should be called before calling setReactants(Molecule[]).
reverse - is true if reversed reactionpublic boolean isReverse()
true if the reaction is to be processed in reversed direction.
public void setSearchOptions(java.lang.String searchOptions)
searchOptions - is the search options stringSearchOptions.setOptions(String)public void setCached(boolean cached)
true if search and calculation results are to be cached and reused.
cached - is the true if search results are to be cached and reusedpublic boolean isCached()
true if search and calculation results are to be cached and reused.
public void setReactionIDPropertyName(java.lang.String reactionIDProp)
reactionIDProp - is the reaction ID property namepublic java.lang.String getReactionIDPropertyName()
public void setComponentIDPropertyNames(java.lang.String reactantIDProp,
java.lang.String productIDProp)
reactantIDProp - is the reactant ID property nameproductIDProp - is the product ID property name
public void setComponentIDPropertyNames(java.lang.String[] reactantIDProps,
java.lang.String[] productIDProps)
reactantIDProps - is the reactant ID property name arrayproductIDProps - is the product ID property name arraypublic void setCopyAllReactantProperties(boolean c)
c - if true then all properties will be copiedpublic void setCopyReactantProperties(java.lang.String[][] reactantPropertiesToCopy)
reactantPropertiesToCopy - the properties to be copiedpublic void setCopyReactantProperties(java.util.Map<java.lang.String,java.lang.String> patternBasedProperties)
patternBasedProperties -
public void setCopyReactantProperties(java.lang.String[][] sourceProperties,
java.lang.String[][] targetProperties)
sourceProperties - the properties to be copiedtargetProperties - the target propertiespublic void setRatio(int[] ratio)
Sets the ratio of the reactants. The length of the ratio array should be equal with the number of reactants in the reaction. If there are more than one reactants in the reaction, then one of the reactant ratios should be 1.
Setting the ratio restarts processing of the current reactant set - next call to react() will return the first product set.
ratio - is the ratio arraypublic void setReaction(Reaction reaction)
setReactants(Molecule[]).
reaction - is the reaction object
public void setReaction(Molecule rxmol)
throws ReactionException
REACTIVITY, EXCLUDE, SELECTIVITY, TOLERANCE.
Also sets the reactant standardizer defined in the STANDARDIZATION RDF/MRV tag.
rxmol - is the reaction molecule
ReactionException - on errorsetIgnoreReactionDefinedStandardizer(boolean)
public void setReaction(Molecule rxmol,
java.lang.String rid)
throws ReactionException
REACTIVITY, EXCLUDE, SELECTIVITY, TOLERANCE.
Also sets the reactant standardizer defined in the STANDARDIZATION RDF/MRV tag.
rxmol - is the reaction moleculerid - is the reaction ID
ReactionException - on errorsetIgnoreReactionDefinedStandardizer(boolean)
public void setReaction(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
java.lang.String tolerances)
throws ReactionException
null which means that the rule is not set.
Selectivity tolerance is set to the default value: DEF_TOLERANCE
if not specified in the Tolerance property.
Also sets the reactant standardizer defined in the STANDARDIZATION
RDF/MRV tag of the reaction molecule.
rxmol - is the reaction moleculerid - is the reaction IDreactivity - is the reactivity ruleselectivity - is the selectivity ruletolerances - is the tolerance string
ReactionException - on errorsetIgnoreReactionDefinedStandardizer(boolean)
public void setReaction(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
double[] tolerances)
throws ReactionException
null which means that the rule is not set.
Also sets the reactant standardizer defined in the STANDARDIZATION
RDF/MRV tag of the reaction molecule.
rxmol - is the reaction moleculerid - is the reaction IDreactivity - is the reactivity ruleselectivity - is the selectivity ruletolerances - is the selectivity tolerance array (one for each selectivity rule,
null for taking the default tolerance DEF_TOLERANCE
for each rule)
ReactionException - on errorsetIgnoreReactionDefinedStandardizer(boolean)public RxnMolecule getReaction()
public Reaction createReactionObject(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
java.lang.String tolerances)
throws ReactionException
null which means that the rule is not set.
rxmol - is the reaction moleculerid - is the reaction IDreactivity - is the reactivity ruleselectivity - is the selectivity ruletolerances - is the selectivity tolerance array (one for each selectivity rule,
null for taking the default tolerance DEF_TOLERANCE
for each rule)
ReactionException - on error
public Reaction createReactionObject(Molecule rxmol,
java.lang.String rid,
java.lang.String reactivity,
java.lang.String selectivity,
double[] tolerances)
throws ReactionException
null which means that the rule is not set.
rxmol - is the reaction moleculerid - is the reaction IDreactivity - is the reactivity ruleselectivity - is the selectivity ruletolerances - is the selectivity tolerance array (one for each selectivity rule,
null for taking the default tolerance DEF_TOLERANCE
for each rule)
ReactionException - on error
public void setReactionString(java.lang.String str)
throws ReactionException
r: denotes the reactivity rule
s: denotes the selectivity rule(s) separated by ";"
t: denotes the selectivity tolerance(s) separated by ";"
[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]Rules can be added with the type prefixes described above, items separated by "..". Example:
[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]..r:charge(ratom(4)) > 1.2..s:tpsa(product(0))..t:0.5
str - is the reaction configuration string described above
ReactionException - on configuration error
public void setReactionString(java.lang.String str,
java.lang.String rid)
throws ReactionException
r: denotes the reactivity rule
s: denotes the selectivity rule(s) separated by ";"
t: denotes the selectivity tolerance(s) separated by ";"
[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]Rules can be added with the type prefixes described above, items separated by "..". Example:
[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]..r:charge(ratom(4)) > 1.2..s:tpsa(product(0))..t:0.5
str - is the reaction configuration string described aboverid - is the reaction ID
ReactionException - on configuration errorpublic int getReactantCount()
public int getProductCount()
public Molecule getReactionReactant(int i)
i - is the reactant index
public Molecule getReactionProduct(int i)
i - is the reactant index
public Molecule[] getReactants()
public void restart()
react()
will return the first product set.
public void setReactant(Molecule mol)
throws ReactionException
mol - the reactant molecule
ReactionException - if setting the reactant fails
public void setReactants(java.lang.String molstr)
throws ReactionException
setReactants(Molecule[] mols)
for this purpose).
The reaction should be set beforehand.
molstr - is the reactant molecule string, reactants separated by '.'
ReactionException - if setting the reactants fails
public void setReactants(Molecule[] mols)
throws ReactionException
mols - is the reactant array
ReactionException - if setting the reactants fails
public Molecule[] react()
throws ReactionException
null if there are no more
product lists. Product lists are ordered according to priority if a
selectivity rule is specified.
In single mode, returns only single results, that is,
returns null if here are more than one product lists
(see setSingle(boolean)).
In transform mode, returns the transformed input molecule, in this case the output is always non-null and there is one output per input molecule, repeated calls return the same.
The reaction should be set beforehand.
The reactants should be set beforehand by setReactants(Molecule[])
or setReactant(Molecule).
ReactionException - on reaction processing errorpublic void setRemoveDuplicateProductReferences(boolean rmduprefs)
react() will return an array with unique product references
(the order of the molecule objects in the return product array is preserved).
Default: false
rmduprefs - is true if duplicate product references should be
removed from the product array returned by react()public boolean isLicensed()
isLicensed in interface chemaxon.license.Licensable
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - is the command line argument array
java.lang.Exception - on error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||