Permalink
Browse files

Updated Murcko code so that we save the appropriatley cloned framewor…

…k. Also updated unit tests

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
1 parent 6c86f91 commit 013342fa823325e1fcecca741376a8cae07d0d3c @rajarshi rajarshi committed with egonw Oct 16, 2010
View
8 src/main/org/openscience/cdk/fragment/MurckoFragmenter.java
@@ -149,14 +149,16 @@ private void run(IAtomContainer atomContainer) throws CDKException {
// only add this in if there is actually a framework
// in some cases we might just have rings and sidechains
if (hasframework(currentFramework)) {
- smiles = smilesGenerator.createSMILES(clone);
+ smiles = smilesGenerator.createSMILES(currentFramework);
// if we only want the single framework according to Murcko, then
// it was the first framework that is added, since subsequent recursive
// calls will work on substructures of the original framework
if (singleFrameworkOnly) {
- if (frameMap.size() == 0) frameMap.put(smiles, clone);
- } else frameMap.put(smiles, clone);
+ if (frameMap.size() == 0) {
+ frameMap.put(smiles, currentFramework);
+ }
+ } else frameMap.put(smiles, currentFramework);
}
// extract ring systems - we also delete pseudo linker bonds as described by
View
10 src/test/org/openscience/cdk/fragment/MurckoFragmenterTest.java
@@ -200,7 +200,7 @@ public void testCarbinoxamine_Bug3088164() throws Exception {
fragmenter.generateFragments(mol);
String[] f = fragmenter.getFrameworks();
- IAtomContainer[] fc = fragmenter.getFragmentsAsContainers();
+ IAtomContainer[] fc = fragmenter.getFrameworksAsContainers();
Assert.assertEquals(1, f.length);
Assert.assertEquals(f.length, fc.length);
Assert.assertEquals("c1ccc(cc1)Cc2ncccc2", f[0]);
@@ -219,17 +219,17 @@ public void testCarbinoxamine_Bug3088164() throws Exception {
public void testPirenperone_Bug3088164() throws Exception {
SmilesGenerator sg = new SmilesGenerator(true);
- IAtomContainer mol = smilesParser.parseSmiles("Fc1ccc(cc1)C(=O)C4CCN(CCC\\3=C(\\N=C2\\C=C/C=C\\N2C/3=O");
+ IAtomContainer mol = smilesParser.parseSmiles("Fc1ccc(cc1)C(=O)C4CCN(CCC\\3=C(\\N=C2\\C=C/C=C\\N2C/3=O)C)CC4");
CDKHueckelAromaticityDetector.detectAromaticity(mol);
MurckoFragmenter fragmenter = new MurckoFragmenter(true, 6);
fragmenter.generateFragments(mol);
String[] f = fragmenter.getFrameworks();
- IAtomContainer[] fc = fragmenter.getFragmentsAsContainers();
+ IAtomContainer[] fc = fragmenter.getFrameworksAsContainers();
Assert.assertEquals(1, f.length);
Assert.assertEquals(f.length, fc.length);
- Assert.assertEquals("N=1C=C(CN2C=CC=CC=12)CCN4CCC(Cc3ccccc3)CC4", f[0]);
+ Assert.assertEquals("C=1N=C4C=CC=CN4(CC=1CCN3CCC(Cc2ccccc2)CC3)", f[0]);
for (int i = 0; i < f.length; i++) {
String newsmiles = sg.createSMILES(fc[i]);
@@ -250,7 +250,7 @@ public void testIsomoltane_Bug3088164() throws Exception {
fragmenter.generateFragments(mol);
String[] f = fragmenter.getFrameworks();
- IAtomContainer[] fc = fragmenter.getFragmentsAsContainers();
+ IAtomContainer[] fc = fragmenter.getFrameworksAsContainers();
Assert.assertEquals(1, f.length);
Assert.assertEquals(f.length, fc.length);
Assert.assertEquals("c1ccccc1n2cccc2", f[0]);

0 comments on commit 013342f

Please sign in to comment.