|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.reaction.ConcurrentReactorProcessor
public class ConcurrentReactorProcessor
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 command line interface and API to concurrent reaction processing.
See the documentation for details.
An example usage of the API:
MolExporter exporter = new MolExporter(System.out, "smiles");
Molecule rxnmol = new MolImporter("reaction.rxn").read();
MolImporter[] importers = new MolImporter[] { new MolImporter("reactants1.smiles"), new MolImporter("reactants2.smiles") };
// create Reactor
Reactor reactor = new Reactor();
// set reactor properties
reactor.setIgnoreRules(Reactor.IGNORE_REACTIVITY | Reactor.IGNORE_SELECTIVITY);
// set the reaction ('rxnmol' is the reaction molecule)
// reaction rules are read from RDF/MRV tags
reactor.setReaction(rxnmol);
// create ConcurrentReactorProcessor
ConcurrentReactorProcessor crp = new ConcurrentReactorProcessor();
// set the reactor for ConcurrentReactorProcessor
crp.setReactor(reactor);
// set the reactant iterators and the processing mode for ConcurrentReactorProcessor
crp.setReactantIterators(MoleculeIteratorFactory.getMoleculeIterators(importers), ConcurrentReactorProcessor.MODE_COMBINATORIAL);
// react the reactants and export the output (reactions are performed in concurrent mode)
Molecule[] products;
while ((products = crp.react()) != null) {
for (Molecule product : products) {
exporter.write(product);
}
}
| Field Summary | |
|---|---|
static int |
MODE_COMBINATORIAL
Mode constant: combinatorial mode. |
static int |
MODE_SEQUENTIAL
Mode constant: sequential mode. |
| Constructor Summary | |
|---|---|
ConcurrentReactorProcessor()
|
|
| Method Summary | |
|---|---|
double |
getProgress()
Estimates the progress. |
Molecule[] |
getReactants()
Returns the input reactants of the last processed reaction. |
void |
initialize()
For internal use only. |
static void |
main(java.lang.String[] args)
Command line entry point. |
Molecule[] |
react()
Generates the product list(s) for all reactant sets. |
java.util.List<Molecule[]> |
reactNext()
Reacts the next reactant set and returns all product sets in a list. |
void |
setReactantIterators(MoleculeIterator[] reactantIterators,
int mode)
Sets the reactant iterators. |
void |
setReactantIterators(MoleculeIterator[] reactantIterators,
int mode,
java.lang.String cacheFormat,
double reservedMemorySize,
boolean ignoreError)
Sets the reactant iterators. |
void |
setReactantSetEnumerator(ReactantSetEnumeration e)
Sets the reactant set enumerator. |
void |
setReactor(Reactor reactor)
Sets the Reactor object that will be used for reaction processing. |
void |
setWorkerThreadCount(int workerThreadCount)
Sets the number of worker threads. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MODE_SEQUENTIAL
public static final int MODE_COMBINATORIAL
| Constructor Detail |
|---|
public ConcurrentReactorProcessor()
| Method Detail |
|---|
public void setReactor(Reactor reactor)
reactor - is the reactor object
public void setReactantIterators(MoleculeIterator[] reactantIterators,
int mode)
throws ReactionException,
java.io.IOException
mode parameter.
reactantIterators - is the MoleculeIterator array from which the input molecules are readmode - is the enumeration mode: MODE_SEQUENTIAL or MODE_COMBINATORIAL
ReactionException - if read error occurred
java.io.IOException - in case of I/O error
public void setReactantIterators(MoleculeIterator[] reactantIterators,
int mode,
java.lang.String cacheFormat,
double reservedMemorySize,
boolean ignoreError)
throws ReactionException,
java.io.IOException
mode parameter.
reactantIterators - is the MoleculeIterator array from which the input molecules are readmode - is the enumeration mode: MODE_SEQUENTIAL or MODE_COMBINATORIALcacheFormat - the format for storing molecules in cachereservedMemorySize - the memory size in MB that should be reservedignoreError - is true if import errors should be ignored
ReactionException - if read error occurred
java.io.IOException - in case of I/O errorpublic void setReactantSetEnumerator(ReactantSetEnumeration e)
Molecule[] returned be ReactantSetEnumeration.next() will be used as
input reactant array for Reactor.
e - is the reactant enumerator which enumerates the input reactantsReactor.setReactants(Molecule[])
public void initialize()
throws ReactionException
ReactionException - on reaction processing error
public Molecule[] react()
throws ReactionException
Reactor.react() method for all reactant sets
and returns the next product list, or null if there are no more product lists.
The reactor and the reactant iterators or the reactant set enumerator should be set beforehand.
ReactionException - on reaction processing errorgetReactants()
public java.util.List<Molecule[]> reactNext()
throws ReactionException
null is returned if there are no more reactant sets to process.
ReactionException - on reaction processing errorgetReactants()public Molecule[] getReactants()
react() or
reactNext().
public void setWorkerThreadCount(int workerThreadCount)
0: worker thread count = number of available CPU cores
0)
workerThreadCount - number of worker threadspublic double getProgress()
0 and 1, or returns -1.
0: none of the input molecules are processed,
1: all of the input molecules are processed,
-1: information about progress can not be provided.
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - is the command line argument array
java.lang.Exception - in case of error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||