예제 #1
0
        public void TestDefault()
        {
            var rule    = new IsotopePatternRule();
            var objects = rule.Parameters;

            Assert.IsNull(objects[0]);
        }
예제 #2
0
        public override void TestValidate_IMolecularFormula()
        {
            var formula = new MolecularFormula();

            formula.Add(ifac.GetMajorIsotope("C"), 5);
            formula.Add(ifac.GetMajorIsotope("H"), 13);
            formula.Add(ifac.GetMajorIsotope("N"), 2);
            formula.Add(ifac.GetMajorIsotope("O"), 2);
            formula.Charge = 0;

            // experimental results

            var spectrum = new List <double[]>
            {
                new double[] { 133.0977, 100.00 },
                new double[] { 134.09475, 0.6 },
                new double[] { 134.1010, 5.4 }
            };

            var rule       = new IsotopePatternRule();
            var parameters = new object[2];

            parameters[0]   = spectrum;
            parameters[1]   = 0.001;
            rule.Parameters = parameters;

            Assert.AreEqual(0.9433, rule.Validate(formula), 0.001);
        }
예제 #3
0
        public void TestSetParameters()
        {
            var rule = new IsotopePatternRule();

            var parameters = new object[2];

            parameters[0]   = new List <double[]>();
            parameters[1]   = 0.0001;
            rule.Parameters = parameters;

            var objects = rule.Parameters;

            Assert.IsNotNull(objects[0]);
            Assert.AreEqual(2, objects.Count);
        }
예제 #4
0
        protected override IRule GetRule()
        {
            var spectrum = new List <double[]>
            {
                new double[] { 133.0977, 100.00 },
                new double[] { 134.09475, 0.6 },
                new double[] { 134.1010, 5.4 }
            };
            var parameters = new object[2];

            parameters[0] = spectrum;
            parameters[1] = 0.001;
            var rule = new IsotopePatternRule {
                Parameters = parameters
            };

            return(rule);
        }
예제 #5
0
        public void TestValidBromine()
        {
            var spectrum = new List <double[]>
            {
                new double[] { 157.8367, 51.399 },
                new double[] { 159.8346, 100.00 },
                new double[] { 161.8326, 48.639 }
            };

            var rule       = new IsotopePatternRule();
            var parameters = new object[2];

            parameters[0]   = spectrum;
            parameters[1]   = 0.001;
            rule.Parameters = parameters;

            var formula = new MolecularFormula();

            formula.Add(ifac.GetMajorIsotope("C"), 2);
            formula.Add(ifac.GetMajorIsotope("Br"), 2);
            formula.Charge = 0;

            Assert.AreEqual(0.0, rule.Validate(formula), 0.0001);
        }
예제 #6
0
        public void TestIsotopePatternRule()
        {
            var rule = new IsotopePatternRule();

            Assert.IsNotNull(rule);
        }