Ejemplo n.º 1
0
        public void TestFindAllRings_IAtomContainer_bool()
        {
            AllRingsFinder arf      = new AllRingsFinder();
            IAtomContainer molecule = TestMoleculeFactory.MakeEthylPropylPhenantren();

            arf.FindAllRings(molecule);
        }
Ejemplo n.º 2
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");
        }
Ejemplo n.º 3
0
        public void TestBug777488()
        {
            //var filename = "data/Bug646.cml";
            var filename = "NCDK.Data.CML.testBug777488-1-AllRingsFinder.cml";
            //var filename = "data/NCI_diversity_528.mol.cml";
            //var filename = "data/NCI_diversity_978.mol.cml";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new CMLReader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer mol      = model.MoleculeSet[0];

            if (standAlone)
            {
                Console.Out.WriteLine("Constructed Molecule");
            }
            if (standAlone)
            {
                Console.Out.WriteLine("Starting AllRingsFinder");
            }
            IRingSet ringSet = new AllRingsFinder().FindAllRings(mol);

            if (standAlone)
            {
                Console.Out.WriteLine("Finished AllRingsFinder");
            }
            if (standAlone)
            {
                Console.Out.WriteLine("Found " + ringSet.Count + " rings.");
            }

            //Display(mol);
        }
Ejemplo n.º 4
0
        public void TestBigMoleculeWithIsolatedRings()
        {
            IRingSet       ringSet = null;
            AllRingsFinder arf     = new AllRingsFinder();

            var filename = "NCDK.Data.CML.isolated_ringsystems.cml";
            var ins      = ResourceLoader.GetAsStream(filename);

            var            reader   = new CMLReader(ins);
            var            chemFile = reader.Read(builder.NewChemFile());
            var            seq      = chemFile[0];
            var            model    = seq[0];
            IAtomContainer mol      = model.MoleculeSet[0];

            //Debug.WriteLine("Constructed Molecule");
            //Debug.WriteLine("Starting AllRingsFinder");
            ringSet = new AllRingsFinder().FindAllRings(mol);
            //Debug.WriteLine("Finished AllRingsFinder");
            Assert.AreEqual(24, ringSet.Count);
            //Display(mol);

            // check sizes of rings
            int[] ringSize = new int[mol.Atoms.Count];
            foreach (var ring in ringSet)
            {
                ringSize[ring.Atoms.Count]++;
            }

            Assert.AreEqual(18, ringSize[6]);
            Assert.AreEqual(6, ringSize[10]);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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));
                }
            }
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        public void TestAllRingsFinder()
        {
            AllRingsFinder arf = new AllRingsFinder();

            Assert.IsNotNull(arf);
        }