public void GetAtomContainerTest() { MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder); builder.MakeGraph(); Assert.IsNotNull(builder.GetAtomContainer()); }
public IAtomContainer Reconstruct(string signature) { ColoredTree tree = AbstractVertexSignature.Parse(signature); MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder); builder.MakeFromColoredTree(tree); return(builder.GetAtomContainer()); }
/// <summary> /// Builder for molecules (rather, for atom containers) from signature /// strings. /// </summary> /// <param name="signatureString">the signature string to use</param> /// <param name="coBuilder"><see cref="IChemObjectBuilder"/> to build the returned atom container from</param> /// <returns>an atom container</returns> public static IAtomContainer FromSignatureString(string signatureString, IChemObjectBuilder coBuilder) { ColoredTree tree = AtomSignature.Parse(signatureString); MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(coBuilder); builder.MakeFromColoredTree(tree); return(builder.GetAtomContainer()); }
public void MakeVertexTest() { MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder); builder.MakeGraph(); builder.MakeVertex("C"); IAtomContainer product = builder.GetAtomContainer(); Assert.AreEqual(1, product.Atoms.Count); }
public void MakeEdgeTest_tripleBond() { MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder); builder.MakeGraph(); builder.MakeVertex("C"); builder.MakeVertex("C"); builder.MakeEdge(0, 1, "C", "C", "#"); IAtomContainer product = builder.GetAtomContainer(); Assert.AreEqual(2, product.Atoms.Count); Assert.AreEqual(1, product.Bonds.Count); Assert.AreEqual(BondOrder.Triple, product.Bonds[0].Order); }
public void MakeEdgeTest_aromaticBond() { MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder); builder.MakeGraph(); builder.MakeVertex("C"); builder.MakeVertex("C"); builder.MakeEdge(0, 1, "C", "C", "p"); IAtomContainer product = builder.GetAtomContainer(); Assert.AreEqual(2, product.Atoms.Count); Assert.AreEqual(1, product.Bonds.Count); IBond bond = product.Bonds[0]; Assert.AreEqual(BondOrder.Single, bond.Order); Assert.IsTrue(bond.IsAromatic); }