#1172 Strange bug parsing SDF file and SMARTS matching

cdk-1.4.x
open
7
2012-11-03
2011-08-30
Rajarshi Guha
No

If I try and match [NH2]c1ncncc1 against the molecule read in from the attached SDF file, I get no hits. But if I convert the file to SMILES and then match it works. Hereis example code:

    String filename = "/Users/guhar/src/cdkpcore/ligand3BIY.sdf";
    InputStream ins = new FileInputStream(new File(filename));
    DefaultChemObjectReader reader = new MDLV2000Reader(ins);
    ChemFile content;
    content = (ChemFile) reader.read((ChemObject) new ChemFile());
    List<IAtomContainer> cList = ChemFileManipulator.getAllAtomContainers(content);
    IAtomContainer atomContainer = cList.get(0);

    CDKHydrogenAdder.getInstance(DefaultChemObjectBuilder.getInstance()).addImplicitHydrogens(atomContainer);
    AtomContainerManipulator.convertImplicitToExplicitHydrogens(atomContainer);

// SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
// IAtomContainer atomContainer = sp.parseSmiles("O=P(=O)(OP(=O)(=O)OCC(C)(C)C(O)C(=O)NCCC(=O)NCCSCC(=O)NCCCCC(NC(=O)C)C(=O)N)OCC1C(C(C(O1)n2c3c(nc2)c(ncn3)N)O)OP(=O)(=O)=O");
SMARTSQueryTool sqt = new SMARTSQueryTool("[NH2]c1ncncc1");
boolean status = sqt.matches(atomContainer);
Assert.assertEquals(true, status);

    int nmatch = sqt.countMatches();
    int nqmatch = sqt.getUniqueMatchingAtoms().size();

    Assert.assertEquals(1, nmatch);
    Assert.assertEquals(1, nqmatch);

Discussion

  • Rajarshi Guha
    Rajarshi Guha
    2011-08-30

     
    Attachments