FMFDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor { @Override public DescriptorValue calculate(IAtomContainer container) { container = clone(container); MurckoFragmenter fragmenter = new MurckoFragmenter(true, 3); DoubleResult result; try { fragmenter.generateFragments(container); IAtomContainer[] framework = fragmenter.getFrameworksAsContainers(); IAtomContainer[] ringSystems = fragmenter.getRingSystemsAsContainers(); if (framework.length == 1) { result = new DoubleResult(framework[0].getAtomCount() / (double) container.getAtomCount()); } else if (framework.length == 0 && ringSystems.length == 1) { result = new DoubleResult(ringSystems[0].getAtomCount() / (double) container.getAtomCount()); } else result = new DoubleResult(0.0); } catch (CDKException e) { result = new DoubleResult(Double.NaN); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result, getDescriptorNames()); } FMFDescriptor(); @Override DescriptorValue calculate(IAtomContainer container); @Override IDescriptorResult getDescriptorResultType(); @Override DescriptorSpecification getSpecification(); @Override String[] getParameterNames(); @Override Object getParameterType(String name); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames();  }
@Test public void testClenbuterol() throws Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("Clc1cc(cc(Cl)c1N)C(O)CNC(C)(C)C"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); Aromaticity.cdkLegacy().apply(mol); DoubleResult result = (DoubleResult) descriptor.calculate(mol).getValue(); Assert.assertEquals(0.353, result.doubleValue(), 0.01); }
@Test public void testCarbinoxamine() throws Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CN(C)CCOC(C1=CC=C(Cl)C=C1)C1=CC=CC=N1"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); Aromaticity.cdkLegacy().apply(mol); DoubleResult result = (DoubleResult) descriptor.calculate(mol).getValue(); Assert.assertEquals(0.65, result.doubleValue(), 0.01); }
@Test public void testIsamoltane() throws CDKException { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CC(C)NCC(O)COC1=C(C=CC=C1)N1C=CC=C1"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); Aromaticity.cdkLegacy().apply(mol); DoubleResult result = (DoubleResult) descriptor.calculate(mol).getValue(); Assert.assertEquals(0.55, result.doubleValue(), 0.01); }
@Test public void testPirenperone() throws CDKException { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("Fc1ccc(cc1)C(=O)C4CCN(CCC\\3=C(\\N=C2\\C=C/C=C\\N2C/3=O)C)CC4"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); Aromaticity.cdkLegacy().apply(mol); DoubleResult result = (DoubleResult) descriptor.calculate(mol).getValue(); Assert.assertEquals(0.862, result.doubleValue(), 0.001); }