コード例 #1
0
        public void TestNormalizeIsotopePattern()
        {
            var spExp = new IsotopePattern(new[]
            {
                new IsotopeContainer(156.07770, 2),
                new IsotopeContainer(157.08059, 0.0006),
                new IsotopeContainer(157.07503, 0.0002),
                new IsotopeContainer(158.08135, 0.004),
            });

            spExp.MonoIsotope = spExp.Isotopes[0];
            spExp.Charge      = 1;

            var isoNorma = IsotopePatternManipulator.Normalize(spExp);
            var listISO  = isoNorma.Isotopes;

            Assert.AreEqual(1, isoNorma.MonoIsotope.Intensity, 0.00001);
            Assert.AreEqual(1, listISO[0].Intensity, 0.00001);
            Assert.AreEqual(0.0003, listISO[1].Intensity, 0.00001);
            Assert.AreEqual(0.0001, listISO[2].Intensity, 0.00001);
            Assert.AreEqual(0.002, listISO[3].Intensity, 0.00001);

            Assert.AreEqual(156.07770, isoNorma.MonoIsotope.Mass, 0.00001);
            Assert.AreEqual(156.07770, listISO[0].Mass, 0.00001);
            Assert.AreEqual(157.08059, listISO[1].Mass, 0.00001);
            Assert.AreEqual(157.07503, listISO[2].Mass, 0.00001);
            Assert.AreEqual(158.08135, listISO[3].Mass, 0.00001);

            Assert.AreEqual(1, isoNorma.Charge, 0.00001);
        }
コード例 #2
0
        public void TestCompareIsotopePatternIsotopePattern()
        {
            var is_ = new IsotopePatternSimilarity();

            IsotopePattern spExp = new IsotopePattern(new[]
            {
                new IsotopeContainer(156.07770, 1),
                new IsotopeContainer(157.07503, 0.0004),
                new IsotopeContainer(157.08059, 0.0003),
                new IsotopeContainer(158.08135, 0.002),
            });

            spExp.MonoIsotope = spExp.Isotopes[0];

            var formula             = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula("C6H10N3O2", builder);
            var isotopeGe           = new IsotopePatternGenerator(0.1);
            var patternIsoPredicted = isotopeGe.GetIsotopes(formula);
            var patternIsoNormalize = IsotopePatternManipulator.Normalize(patternIsoPredicted);
            var score = is_.Compare(spExp, patternIsoNormalize);

            Assert.AreNotSame(0.0, score);
        }
コード例 #3
0
        public void TestSelectingMF()
        {
            var is_ = new IsotopePatternSimilarity();

            IsotopePattern spExp = new IsotopePattern(new[]
            {
                new IsotopeContainer(156.07770, 1),
                new IsotopeContainer(157.07503, 0.0101),
                new IsotopeContainer(157.08059, 0.074),
                new IsotopeContainer(158.08135, 0.0024),
            });

            spExp.MonoIsotope = spExp.Isotopes[0];
            spExp.Charge      = 1;

            double score    = 0;
            string mfString = "";

            string[] listMF = { "C4H8N6O", "C2H12N4O4", "C3H12N2O5", "C6H10N3O2", "CH10N5O4", "C4H14NO5" };

            for (int i = 0; i < listMF.Length; i++)
            {
                IMolecularFormula       formula             = MolecularFormulaManipulator.GetMajorIsotopeMolecularFormula(listMF[i], builder);
                IsotopePatternGenerator isotopeGe           = new IsotopePatternGenerator(0.01);
                IsotopePattern          patternIsoPredicted = isotopeGe.GetIsotopes(formula);

                IsotopePattern patternIsoNormalize = IsotopePatternManipulator.Normalize(patternIsoPredicted);
                double         tempScore           = is_.Compare(spExp, patternIsoNormalize);
                if (score < tempScore)
                {
                    mfString = MolecularFormulaManipulator.GetString(formula);
                    score    = tempScore;
                }
            }
            Assert.AreEqual("C6H10N3O2", mfString);
        }