Пример #1
0
        public override string SignatureStringForVertex(int vertexIndex, int height)
        {
            AtomSignature atomSignature =
                new AtomSignature(molecule, vertexIndex, height, invariantType);

            return(atomSignature.ToCanonicalString());
        }
Пример #2
0
        public void TestRoundtrip()
        {
            Molecule molecule = new Molecule();

            molecule.AddAtom("C");
            molecule.AddAtom("C");
            molecule.AddAtom("C");
            molecule.AddAtom("C");
            molecule.AddSingleBond(0, 1);
            molecule.AddSingleBond(0, 3);
            molecule.AddSingleBond(1, 2);
            molecule.AddSingleBond(2, 3);

            AtomSignature atomSignature   = new AtomSignature(molecule, 0);
            string        signatureString = atomSignature.ToCanonicalString();

            ColoredTree     tree          = AtomSignature.Parse(signatureString);
            MoleculeBuilder builder       = new MoleculeBuilder();
            Molecule        builtMolecule = builder.FromTree(tree);

            Assert.AreEqual(molecule.ToString(), builtMolecule.ToString());

            // test that this can be done more than once
            builtMolecule = builder.FromTree(tree);
            Assert.AreEqual(molecule.ToString(), builtMolecule.ToString());
        }
Пример #3
0
        public void TestColoredTreeCreation()
        {
            string      signatureString = "[C]([C]([C,1])[C]([C,1]))";
            ColoredTree tree            = AtomSignature.Parse(signatureString);

            Assert.AreEqual(signatureString, tree.ToString());
        }
Пример #4
0
        public void TestFiveCycle()
        {
            Molecule      molecule      = MoleculeFactory.FiveCycle();
            AtomSignature atomSignature = new AtomSignature(molecule, 0);

            Console.Out.WriteLine(atomSignature.ToCanonicalString());
            //        Console.Out.WriteLine(atomSignature);
        }
Пример #5
0
        public void TestOddCycleReadin()
        {
            string      signatureString = "[C]([C]([C,2]([C,1]))[C]([C,1]))";
            ColoredTree tree            = AtomSignature.Parse(signatureString);

            Assert.AreEqual(signatureString, tree.ToString());
            Molecule molecule = new MoleculeBuilder().FromTree(tree);

            Assert.AreEqual(5, molecule.GetAtomCount());
            Assert.AreEqual(5, molecule.GetBondCount());
        }
Пример #6
0
        public void TestCage()
        {
            string signatureString = "[C]([C]([C,2]([C]([C,3][C,4]))[C]([C,5]" +
                                     "[C,3]([C,6]([C,1]))))[C]([C]([C,7][C]" +
                                     "([C,1][C,8]))[C,5]([C,8]([C,6])))[C]([C,2]" +
                                     "[C,7]([C,4]([C,1]))))";
            ColoredTree tree = AtomSignature.Parse(signatureString);

            Assert.AreEqual(signatureString, tree.ToString());
            Molecule molecule = new MoleculeBuilder().FromTree(tree);

            Assert.AreEqual(16, molecule.GetAtomCount());
            Assert.AreEqual(24, molecule.GetBondCount());
        }