NullPointerException from PFGenerator

User 121285d3c7

15-09-2014 20:24:47

Code is basically the example in the PFGenerator javadoc. Any ideas please?


Exception in thread "main" java.lang.NullPointerException
at chemaxon.descriptors.PFGenerator.generate(PFGenerator.java:153)
at util.GeneratePF.main(GeneratePF.java:20)

public class GeneratePF {


public static void main(String[] args) throws Exception {
MolImporter mi = new MolImporter("C:/Program Files/ChemAxon/JChem/examples/screen/nci1000.sdf");
PMapper m = new PMapper(new File("C:/Program Files/ChemAxon/JChem/examples/screen/pharma-frag.xml"));
PFGenerator gen = new PFGenerator(m);
gen.setUsePMAP(false);
PharmacophoreFingerprint pfp = new PharmacophoreFingerprint();
Molecule mol;
while ((mol = mi.read()) != null) {
String[] newTags = gen.generate(mol, pfp);
}
mi.close();
}
}

ChemAxon 5fc3e8d7d0

29-09-2014 12:58:23

Dear Mark,

The setParameters() function is missing from the code example. Sorry for the inconvenience, we will correct it in the next release.

Try to use this example:


Molecule testMol = MolImporter.importMol("CC(=O)OC1=CC=CC=C1C(O)=O", "smiles");
PMapper m = new PMapper(new File("pharma-frag.xml"));
PFGenerator gen = new PFGenerator(m);
gen.setUsePMAP(false);
PharmacophoreFingerprint pfp = new PharmacophoreFingerprint();
pfp.setParameters(new PFParameters());
String[] newTags = gen.generate(testMol, pfp);

Best regards,
Laszlo