percieveAtomTypesAndConfigureUnsetProperties(container); return container;
private static IAtomContainer parseSmiles(String smiles) throws CDKException { parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = parser.parseSmiles(smiles); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(molecule); AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Aromaticity.cdkLegacy().apply(molecule); return molecule; }
private static IAtomContainer parseSmiles(String smiles) throws CDKException { parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = parser.parseSmiles(smiles); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(molecule); AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Aromaticity.cdkLegacy().apply(molecule); return molecule; }
@Override public DescriptorValue calculate(IAtomContainer container) { IAtomContainer struct; try { struct = (IAtomContainer) container.clone(); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(struct); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(struct.getBuilder()); hAdder.addImplicitHydrogens(struct); AtomContainerManipulator.convertImplicitToExplicitHydrogens(struct); Aromaticity.cdkLegacy().apply(struct); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } catch (CDKException e) { return getDummyDescriptorValue(e); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(jplogp.calcLogP(struct)), getDescriptorNames()); }
try { ac = (IAtomContainer) atomContainer.clone(); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(ac); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(ac.getBuilder()); hAdder.addImplicitHydrogens(ac);
try { ac = (IAtomContainer) atomContainer.clone(); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(ac); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(ac.getBuilder()); hAdder.addImplicitHydrogens(ac);
@Test public void testADoubleRingWithANitrogenAtom() throws Exception { /* * Should have 4 double bonds and all three bonds to/from the nitrogen * should be single */ String smiles = "c1ccn2cccc2c1"; IAtomContainer mol = sp.parseSmiles(smiles); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(mol); IAtom nitrogen = mol.getAtom(3); atasc.decideBondOrder(mol, true); int doubleBondCount = 0, singleBondCount = 0; for (IBond bond : mol.bonds()) { if (bond.getOrder().equals(Order.DOUBLE)) doubleBondCount++; if (bond.contains(nitrogen)) if (bond.getOrder().equals(Order.SINGLE)) singleBondCount++; } Assert.assertEquals(4, doubleBondCount); Assert.assertEquals(3, singleBondCount); }
@Test public void testPerceiveAtomTypesAndConfigureUnsetProperties() throws Exception { IAtomContainer container = new AtomContainer(); IAtom atom = new Atom("C"); atom.setExactMass(13.0); container.addAtom(atom); IAtomType type = new AtomType("C"); type.setAtomTypeName("C.sp3"); type.setExactMass(12.0); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(container); Assert.assertNotNull(atom.getExactMass()); Assert.assertEquals(13.0, atom.getExactMass(), 0.1); Assert.assertNotNull(atom.getAtomTypeName()); Assert.assertEquals("C.sp3", atom.getAtomTypeName()); }