示例#1
0
        public void TestRingFlags2()
        {
            var sp       = CDK.SmilesParser;
            var molecule = sp.ParseSmiles("C1CCCC1CC");

            foreach (var a in molecule.Atoms)
            {
                a.IsInRing = false;
            }

            AllRingsFinder arf = new AllRingsFinder();

            arf.FindAllRings(molecule);

            int count = 0;

            foreach (var atom in molecule.Atoms)
            {
                if (atom.IsInRing)
                {
                    count++;
                }
            }
            Assert.AreEqual(5, count, "All atoms in 1-ethyl-cyclopentane were not marked as being in a ring");
        }
示例#2
0
        public void TestFindAllRings_IAtomContainer_bool()
        {
            AllRingsFinder arf      = new AllRingsFinder();
            IAtomContainer molecule = TestMoleculeFactory.MakeEthylPropylPhenantren();

            arf.FindAllRings(molecule);
        }
示例#3
0
        public void TestFindAllRings_IAtomContainer()
        {
            IRingSet       ringSet  = null;
            AllRingsFinder arf      = new AllRingsFinder();
            IAtomContainer molecule = TestMoleculeFactory.MakeEthylPropylPhenantren();

            ringSet = arf.FindAllRings(molecule);

            Assert.AreEqual(6, ringSet.Count);
        }
示例#4
0
        public void TestBigRingSystem_MaxRingSize6_03419()
        {
            IRingSet       ringSet  = null;
            AllRingsFinder arf      = new AllRingsFinder();
            var            filename = "NCDK.Data.MDL.ring_03419.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer molecule = model.MoleculeSet[0];

            ringSet = arf.FindAllRings(molecule, 6);
            Assert.AreEqual(12, ringSet.Count);
        }
示例#5
0
        public void TestBigRingSystem_MaxRingSize4_fourRing5x10()
        {
            IRingSet       ringSet  = null;
            AllRingsFinder arf      = new AllRingsFinder();
            var            filename = "NCDK.Data.MDL.four-ring-5x10.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer molecule = model.MoleculeSet[0];

            // there are 5x10 squares (four-rings) in the 5x10 molecule
            ringSet = arf.FindAllRings(molecule, 4);
            Assert.AreEqual(50, ringSet.Count);
        }
示例#6
0
        public void TestCholoylCoA()
        {
            IRingSet       ringSet = null;
            AllRingsFinder arf     = new AllRingsFinder();

            var            filename = "NCDK.Data.MDL.choloylcoa.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer molecule = model.MoleculeSet[0];

            ringSet = arf.FindAllRings(molecule);
            Assert.AreEqual(14, ringSet.Count);
        }
示例#7
0
        public void TestBigRingSystem()
        {
            IRingSet       ringSet = null;
            AllRingsFinder arf     = AllRingsFinder.UsingThreshold(Threshold.PubChem994);

            var            filename = "NCDK.Data.MDL.ring_03419.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer molecule = model.MoleculeSet[0];

            ringSet = arf.FindAllRings(molecule);
            // the 1976 value was empirically derived, and might not be accurate
            Assert.AreEqual(1976, ringSet.Count);
        }
示例#8
0
        public void TestBondsWithinRing()
        {
            IRingSet       ringSet  = null;
            AllRingsFinder arf      = new AllRingsFinder();
            IAtomContainer molecule = TestMoleculeFactory.MakeEthylPropylPhenantren();

            ringSet = arf.FindAllRings(molecule);
            foreach (var ring in ringSet)
            {
                foreach (var ec in ring.Bonds)
                {
                    var atom1 = ec.Begin;
                    var atom2 = ec.End;
                    Assert.IsTrue(ring.Contains(atom1));
                    Assert.IsTrue(ring.Contains(atom2));
                }
            }
        }
示例#9
0
        public void TestBigRingSystem_MaxRingSize6_fourRing5x10()
        {
            IRingSet       ringSet  = null;
            AllRingsFinder arf      = new AllRingsFinder();
            var            filename = "NCDK.Data.MDL.four-ring-5x10.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer molecule = model.MoleculeSet[0];

            // there are 5x10 four-rings (squares ) = 50
            // there are (9x5) + (4x10) six-rings   = 85
            // combined 135
            ringSet = arf.FindAllRings(molecule, 6);
            Assert.AreEqual(135, ringSet.Count);
        }