예제 #1
0
        public void GetAtomContainerTest()
        {
            MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder);

            builder.MakeGraph();
            Assert.IsNotNull(builder.GetAtomContainer());
        }
예제 #2
0
        public IAtomContainer Reconstruct(string signature)
        {
            ColoredTree tree = AbstractVertexSignature.Parse(signature);
            MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder);

            builder.MakeFromColoredTree(tree);
            return(builder.GetAtomContainer());
        }
예제 #3
0
        /// <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());
        }
예제 #4
0
        public void MakeVertexTest()
        {
            MoleculeFromSignatureBuilder builder = new MoleculeFromSignatureBuilder(CDK.Builder);

            builder.MakeGraph();
            builder.MakeVertex("C");
            IAtomContainer product = builder.GetAtomContainer();

            Assert.AreEqual(1, product.Atoms.Count);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }