Ejemplo n.º 1
0
        public void TestMakeBremserCompliant()
        {
            string[] startData = { "O-1;=C(//)",  "C-3;=OCC(//)", "C-2;CC(//)",  "C-2;CC(//)",  "C-3;CCC(//)", "C-2;CC(//)",
                                   "C-2;CC(//)",  "C-3;CCC(//)",  "C-3;CCC(//)", "C-2;CC(//)",  "C-2;CC(//)",  "C-2;CC(//)","C-2;CC(//)",
                                   "C-3;CCO(//)", "O-2;CC(//)",   "C-3;CCO(//)", "C-3;CCO(//)", "O-2;CC(//)",  "C-1;O(//)", "C-2;CC(//)",
                                   "C-3;CCC(//)", "C-3;CCC(//)",  "C-3;CCC(//)" };

            string[] result = { "=C(//)",  "=OCC(//)", "CC(//)",  "CC(//)",  "CCC(//)", "CC(//)",  "CC(//)", "CCC(//)",
                                "CCC(//)", "CC(//)",   "CC(//)",  "CC(//)",  "CC(//)",  "CCO(//)", "CC(//)", "CCO(//)","CCO(//)","CC(//)",
                                "O(//)",   "CC(//)",   "CCC(//)", "CCC(//)", "CCC(//)" };

            string s = null;

            for (int f = 0; f < startData.Length; f++)
            {
                s = HOSECodeGenerator.MakeBremserCompliant(startData[f]);
                if (standAlone)
                {
                    Console.Out.Write("|" + s + "| -> " + result[f]);
                }
                Assert.AreEqual(result[f], s);
                if (standAlone)
                {
                    Console.Out.WriteLine("  OK");
                }
            }
        }
Ejemplo n.º 2
0
        public void TestGetConfidenceLimit()
        {
            var result = new double[]
            {
                28.5, 25.7, 28.5, 34.9, 28.5, 25.7, 25.4, 28.5, 28.5, 14.8, 13.3, 23.0, 34.9, 25.7, 25.7,
                28.5, 25.7, 25.7, 13.3, 14.4, 14.4, 8.9, 14.8, 14.8, 13.3, 13.3, 13.3, 14.4, 14.4, 13.3, 14.4, 14.4,
                8.9, 14.8, 14.8, 13.3, 13.3, 13.3, 14.4, 14.4, 13.3,
            };
            IAtomContainer molecule = null;
            var            filename = "NCDK.Data.MDL.BremserPredictionTest.mol";
            var            ins      = ResourceLoader.GetAsStream(filename);
            var            reader   = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);

            molecule = reader.Read(builder.NewAtomContainer());
            double prediction;
            var    bp  = new BremserOneSphereHOSECodePredictor();
            var    hcg = new HOSECodeGenerator();
            string s   = null;

            RemoveHydrogens(molecule);
            for (int f = 0; f < molecule.Atoms.Count; f++)
            {
                s          = hcg.GetHOSECode(molecule, molecule.Atoms[f], 1);
                prediction = bp.GetConfidenceLimit(HOSECodeGenerator.MakeBremserCompliant(s));
                Assert.AreEqual(result[f], prediction, 0.001);
            }
        }