Reactor API only generating one product

User 8c93b1d06c

10-09-2009 05:20:33

I am developing an application using the Reactor API.   When I use the Reactor GUI or
command line interface with the amide bond fragmentation reaction detailed
below on a substrate that has four amides in the peptoid backbone I get the
four products I would expect as follows:


Platform (JChem version: 5.2.4   Mac OSX 10.6)



 


./react
"CCCCN(CC(=O)N(CC(=O)N(CC1CCCCC1)CC(=O)NCC1=CC(Cl)=CC(Cl)=C1)CC1=CC=CC=C1)C(=O)CNCC1=CN=CC=C1"
-r
"[*:5][N:3]([*,#1:4])[C:2]([*,#1])=[O:1]>>[*:5][N+:3][*,#1:4]"


CCCC[NH2+]CC(=O)N(CC(=O)N(CC1CCCCC1)CC(=O)NCC1=CC(Cl)=CC(Cl)=C1)CC1=CC=CC=C1


ClC1=CC(CNC(=O)CN(CC2CCCCC2)C(=O)C[NH2+]CC2=CC=CC=C2)=CC(Cl)=C1


ClC1=CC(CNC(=O)C[NH2+]CC2CCCCC2)=CC(Cl)=C1


[NH3+]CC1=CC(Cl)=CC(Cl)=C1


 


However, when I use the API (code as follows).  I only get one product.  What am I doing wrong?


 


 


import chemaxon.struc.Molecule;


import chemaxon.util.MolHandler;


import chemaxon.formats.MolFormatException;


import chemaxon.reaction.ReactionException;


import chemaxon.reaction.Reactor;


 


 


public class PeptoidFragmentIons {


    


 


     /**


      * @param args


      * @throws ReactionException


      * @throws MolFormatException


      */


     public static void main(String[] args) throws ReactionException,
MolFormatException {


         


           Reactor reactor = new Reactor();


           


           // set the reaction = amide fragmentation
reaction in SMARTS string format


           // 


           


           reactor.setReactionString("[*:5][N:3]([*,#1:4])[C:2]([*,#1])=[O:1]>>[*:5][N+:3][*,#1:4]");


 


           // set the reactant  using the single reactant format as smiles string


           MolHandler molhandler1 = new MolHandler();


           molhandler1.setMolecule("CCCCN(CC(=O)N(CC(=O)N(CC1CCCCC1)CC(=O)NCC1=CC(Cl)=CC(Cl)=C1)CC1=CC=CC=C1)C(=O)CNCC1=CN=CC=C1");


 


           Molecule reactant =
molhandler1.getMolecule();


           reactor.setReactant(reactant);


           


 


           // get the result


           Molecule[] products = reactor.react();


           


           // Print the Molecule array as smiles strings


 


           for (int i = 0; i < products.length; i = i + 1) { // Test and Loop


                


                 
System.
out.print(products.toFormat("smiles"));


                 
System.
out.println();


           }


           


           // Print the number of products


                 System.out.print("The number of
Products is: "
+ reactor.getProductCount());


                 System.out.println();


         


            }


           


     }


 


 


Obtained Output from code above:


CCCC[NH2+]CC(=O)N(CC(=O)N(CC1CCCCC1)CC(=O)NCC1=CC(Cl)=CC(Cl)=C1)CC1=CC=CC=C1


The
number of Products is: 1


 


 




ChemAxon e08c317633

10-09-2009 09:54:36

Hi,


Reactor.react() method should be called in a while loop.  It will return the next product list, while there are more product list, and null at the end (if there are no more product lists).


See the Java AP documentation: http://www.chemaxon.com/jchem/doc/api/chemaxon/reaction/Reactor.html#react()


I modified your code, it will return exactly the same as the Reactor command line, or GUI application:


import chemaxon.struc.Molecule;
import chemaxon.util.MolHandler;
import chemaxon.formats.MolFormatException;
import chemaxon.reaction.ReactionException;
import chemaxon.reaction.Reactor;

public class PeptoidFragmentIons {

/**
* @param args
* @throws ReactionException
* @throws MolFormatException
*/
public static void main(String[] args) throws ReactionException, MolFormatException {

Reactor reactor = new Reactor();

// set the reaction = amide fragmentation reaction in SMARTS string format
reactor.setReactionString("[*:5][N:3]([*,#1:4])[C:2]([*,#1])=[O:1]>>[*:5][N+:3][*,#1:4]");

// set the reactant using the single reactant format as smiles string
MolHandler molhandler1 = new MolHandler();
molhandler1.setMolecule("CCCCN(CC(=O)N(CC(=O)N(CC1CCCCC1)CC(=O)NCC1=CC(Cl)=CC(Cl)=C1)CC1=CC=CC=C1)C(=O)CNCC1=CN=CC=C1");

Molecule reactant = molhandler1.getMolecule();
reactor.setReactant(reactant);

// get the result
Molecule[] products = null;
while ((products = reactor.react()) != null) {

// Print the Molecule array as smiles strings
for (int i = 0; i < products.length; i = i + 1) { // Test and Loop
System.out.print(products.toFormat("smiles"));
System.out.println();
}
}
}
}

The Reactor.getProductCount() method returns the number of products in the reaction set by setReaction(Molecule) or setReactionString(String) method. It cannot be used to determine how many product lists will be returned by the react() method.


I hope this helps,


Zsolt

User 8c93b1d06c

10-09-2009 18:11:01

Thanks for the API clarification.  This resolves my problem.


Thanks again for the rapid response.


 


--Michael