Menu

#1172 Strange bug parsing SDF file and SMARTS matching

cdk-1.4.x
closed
7
2016-08-11
2011-08-30
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);

Related

Bugs: #1172

Discussion

  • Rajarshi Guha

    Rajarshi Guha - 2011-08-30
     
  • Egon Willighagen

    • assigned_to: Egon Willighagen --> Rajarshi Guha
     
    • John May

      John May - 2016-08-11

      Probably an aromaticity problem.

      Regards,
      John W May
      john.wilkinsonmay@gmail.com

      On 11 August 2016 at 12:15, Egon Willighagen egonw@users.sf.net wrote:

      • assigned_to: Egon Willighagen --> Rajarshi Guha
      • Comment:

      Rajarshi, can you check if this bug still exists? It probably is fixed...

      Status: open
      Group: cdk-1.4.x
      Labels: cdk-smarts module
      Created: Tue Aug 30, 2011 10:47 PM UTC by Rajarshi Guha
      Last Updated: Sat Nov 03, 2012 07:32 AM UTC
      Owner: Rajarshi Guha

      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);
      

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/cdk/bugs/1172/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1172

    • Rajarshi Guha

      Rajarshi Guha - 2016-08-11

      The problem is resolved in master.

      Unfortunately I can't remember nmy sf.net login to go and close the bug.
      Can you close it for me?

      On Thu, Aug 11, 2016 at 7:15 AM, Egon Willighagen egonw@users.sf.net
      wrote:

      • assigned_to: Egon Willighagen --> Rajarshi Guha
      • Comment:

      Rajarshi, can you check if this bug still exists? It probably is fixed...

      Status: open
      Group: cdk-1.4.x
      Labels: cdk-smarts module
      Created: Tue Aug 30, 2011 10:47 PM UTC by Rajarshi Guha
      Last Updated: Sat Nov 03, 2012 07:32 AM UTC
      Owner: Rajarshi Guha

      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);
      

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/cdk/bugs/1172/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Rajarshi Guha | http://blog.rguha.net
      NIH Center for Advancing Translational Science

       

      Related

      Bugs: #1172

  • Egon Willighagen

    Rajarshi, can you check if this bug still exists? It probably is fixed...

     
  • John May

    John May - 2016-08-11
    • status: open --> closed