about reaction questions.

User 05309f4af8

22-06-2009 03:33:46

Hi,


   I have a quick question about reaction library.  i used ConcurrentReactorProcessor api to get all products from reaction iterators.  please see code as below:



 public static void reactorTest() throws MolFormatException, IOException,
   ReactionException {


  MolImporter mol = new MolImporter(new File("D:\\JChem\\reactor\\test.rxn"), "");
  MoleculeIterator a = new MolImporter(new File("D:\\JChem\\reactor\\A.sd"), "").getMoleculeIterator();
  MoleculeIterator b = new MolImporter(new File("D:\\JChem\\reactor\\B.sd"), "").getMoleculeIterator();

  List<Molecule> testa = new ArrayList<Molecule>();
  List<Molecule> testb = new ArrayList<Molecule>();
  List<List<Molecule>> list = new ArrayList<List<Molecule>>();
  
  while (a.hasNext()) {
   testa.add(a.next());
  }
  while (b.hasNext()) {
   testb.add(b.next());
  }
  
  list.add(testa);
  list.add(testb);


  List<MoleculeIterator> molIteratorList = new ArrayList<MoleculeIterator>();
  for (List<Molecule> molList : list) {
   molIteratorList.add(MoleculeIteratorFactory.createMoleculeIterator(molList));
  }


  RxnMolecule r = (RxnMolecule) mol.read();
  // create Reactor
  Reactor reactor = new Reactor();
  
  // set properties (reverse mode)
  // reactor.setReverse(true);
  reactor.setIgnoreRules(Reactor.IGNORE_REACTIVITY| Reactor.IGNORE_SELECTIVITY);
  Reaction reaction = new Reaction();
  reaction.setReaction(r);
   
  // set the reaction ('rxmol' is the reaction molecule)
  // reaction rules are read from RDF/MRV tags
  reactor.setReaction(reaction);


  // create ConcurrentReactorProcessor
  ConcurrentReactorProcessor crp = new ConcurrentReactorProcessor();
  // set the reactor for ConcurrentReactorProcessor
  crp.setReactor(reactor);
  // set the reactant iterators and the processing mode for
  crp.setReactantIterators(molIteratorList.toArray(new MoleculeIterator[0]),ConcurrentReactorProcessor.MODE_COMBINATORIAL);
  // react the reactants and export the output (reactions are performed in concurrent mode)
  Molecule[] products = null;
  while ((products = crp.react()) != null) {
   for (Molecule product : products) {
    System.out.println("get product: " + product.toFormat("smiles"));
   }
  }
 }


How do i  know which several reactants reaction to each product.



Thank you in advance!


andy

ChemAxon a3d59b832c

22-06-2009 08:12:12

Hi, 

I moved the topic to the appropriate forum, my colleagues will answer you soon.

Best regards,

Szabolcs

ChemAxon e08c317633

22-06-2009 09:01:38

Hi,


If I understand you well, you need these methods:


Reactor.getReactantCount()


Reactor.getProductCount()


Call these after


reactor.setReaction(reaction);


Zsolt

User 05309f4af8

23-06-2009 01:34:47










Zsolt wrote:

Hi,


If I understand you well, you need these methods:


Reactor.getReactantCount()


Reactor.getProductCount()


Call these after


reactor.setReaction(reaction);


Zsolt



Hi, Zsolt


thanks for you reply, but i want to know how can i get detail information about this reaction, for example, i'd like to get the reactants id for each product.


A1 + B1 -> P1  here i want to get A1 id and B1 id


A2 + B1 -> P2  here i want to get A2 id and B1 id
...


 


 


 

ChemAxon e08c317633

01-07-2009 18:31:37











andyyao wrote:







Hi, Zsolt


thanks for you reply, but i want to know how can i get detail information about this reaction, for example, i'd like to get the reactants id for each product.


A1 + B1 -> P1  here i want to get A1 id and B1 id


A2 + B1 -> P2  here i want to get A2 id and B1 id
...


 




Hi,


To get a product ID for each product, the following steps should be made:


1.) Assign ID-s to the reaction, and to all reactants. The ID should be stored in a molecule property.


See Molecule.setProperty(java.lang.String, java.lang.String) 


If the ID is stored in the molecule file (e.g. in SDFile tag), than it will be read automatically during the import process.


2.) Use the following methods to set the reaction, reactant, and product ID property names


Reactor.setReactionIDPropertyName(java.lang.String) 


Reactor.setComponentIDPropertyNames(java.lang.String[], java.lang.String[])


The reaction and reactant ID property names should be the property names described in 1.), the product ID properties will be filled by Reactor during reaction processing.


3.) Perform the reaction.


Reactor.react() ...


4. After the reaction is performed the product ID-s can be read from the previously specified product ID properties.


See Molecule.getProperty(java.lang.String) 


I hope this helps. Aplogies for the late answer.


Zsolt