Skip to content

Commit

Permalink
Updated Murcko code so that we save the appropriatley cloned framewor…
Browse files Browse the repository at this point in the history
…k. Also updated unit tests

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
rajarshi authored and egonw committed Oct 17, 2010
1 parent 6c86f91 commit 013342f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/main/org/openscience/cdk/fragment/MurckoFragmenter.java
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/test/org/openscience/cdk/fragment/MurckoFragmenterTest.java
Expand Up @@ -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]);
Expand All @@ -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]);
Expand All @@ -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]);
Expand Down

0 comments on commit 013342f

Please sign in to comment.