MCS returns incorrect answer when MODE_EXACT

User 85a7d97b07

21-03-2008 00:51:50

JChem Version: 5.0.02.1





Dear sirs,





I have to perform a MCS search on two molecules and


write a simple code to check the API. The result is strange


because MODE_FAST returns correct answer but MODE_EXACT doese not.





How do I fix the code if any bugs there?





Thank you.


Code:



MolHandler m1 = new MolHandler();


m1.setMolecule("Nc1ccccc1"); // aniline


MolHandler m2 = new MolHandler();


m2.setMolecule("Oc1ccccc1"); // phenol





for(int size=5; size<7; size++){


  MCS mcsFast = new MCS();


  MCS mcsExact = new MCS();


  mcsFast.setMode(MCS.MODE_FAST);


  mcsExact.setMode(MCS.MODE_EXAT);





  mcsFast.setMolecules(m1.getMolecule(), m2.getMolecule());


  mcsExact.setMolecules(m1.getMolecule(), m2.getMolecule());


  mcsFast.setMinimumCommonSize(size);


  mcsExact.setMinimumCommonSize(size);





  if (mcsExact.search()){ // fail when minimum_common_size=6


    // "c:c:c:c:c" will be printed (correct answer would be "c1ccccc1")


    System.out.println("Match for MODE_EXACT, size=" + size +


                                ", " +


                                mcsExact.getResultAsMolecule().toFormat("smiles"));





  } else {


    System.out.println("Fail for MODE_EXACT, size=" + size);


  }





  if (mcsFast.search()) { // work properly


    // "c1ccccc1" will be printed


    System.out.println("Match for MODE_FAST, size=" + size +


                                ", " +


                                mcsFast.getResultAsMolecule().toFormat("smiles"));


  } else {


    System.out.println("Fail for MODE_FAST, size=" + size);


  }


}


ChemAxon efa1591b5a

21-03-2008 11:17:43

Dear Koichi Tazaki,





the rather strange behaviour that you experienced is apparently a bug in the MCS search. We have managed to reproduce it and many thanks for the valuable test code you attached. However, we have not yet managed to trace back the bug, thus right now I cannot estimate in which release this problem can be solved.





I will get back to this forum and let you know it asap.





Regards,


Miklos