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