calling chemaxon.jep.Evaluator

User 92a07cc890

01-09-2014 10:15:18

Hello,


I'm trying to evaluate the following with evaluator:


Molecule mol = MolImporter.importMol(smi);
Evaluator evaluator = new Evaluator();
MolContext context = new MolContext();
String acid_smarts="filter(atoms(),\"match('[$([O-][C,P,S]=O),$([n-]1nnnc1),$(n1[n-]nnc1)]',1)\")";


ChemJEP acid_eval=evaluator.compile(acid_smarts);
Molecule mol = MolImporter.importMol("Nc1nc(nc2n(cnc12)C1OC(COP([O-])(=O)OP([O-])(=O)OP([O-])([O-])=O)[C@@H](O)[C@H]1O)C#Cc1ccccc1");
context.setMolecule(mol);


how to evaluate this? If I call


acid_eval.evaluate_doubles(context),  I get chemaxon.nfunk.jep.ParseException: could not convert to double[]


AFAIK the smarts should return int[] of atomic numbers, but I don't know, how to call evaluator to get that type of return values.


Thanks,


Istvan

ChemAxon 5fc3e8d7d0

01-09-2014 12:50:02

Dear Istvan,


In the current version of Marvin there is not evaluator API function which has int[] return type. Use the Evaluator.evaluate() method and then you could cast the result to int[].
Example code:


String expression = "filter(atoms(),\"match('[$([O-][C,P,S]=O),$([n-]1nnnc1),$(n1[n-]nnc1)]',1)\")";        
Molecule mol = MolImporter.importMol("Nc1nc(nc2n(cnc12)C1OC(COP([O-])(=O)OP([O-])(=O)OP([O-])([O-])=O)[C@@H](O)[C@H]1O)C#Cc1ccccc1");
        
Evaluator evaluator = new Evaluator();
ChemJEP chemJEP = evaluator.compile(expression);
MolContext context = new MolContext(mol);
        
Object result = chemJEP.evaluate(context);        
int[] array = (int[]) result;

System.err.println(Arrays.toString(array));

Best regards,
Laszlo