예제 #1
0
        public void Mercury_HexNAc()
        {
            IIsotopeDistGenerator gen = new Mercury7();

            IsotopicDistribution hexnac_mercury = gen.GenerateIsotopicDistribution(hexnac_form);

            for (int i = 0; i < hexnac_ref.Length; i++)
            {
                Assert.AreEqual(hexnac_ref.Masses[i], hexnac_mercury.Masses[i], 0.0001);
                Assert.AreEqual(hexnac_ref.Intensities[i], hexnac_mercury.Intensities[i], 0.0001);
            }
        }
예제 #2
0
        public void Mercury_Carbonic()
        {
            IIsotopeDistGenerator gen = new Mercury7();

            IsotopicDistribution ca_mercury = gen.GenerateIsotopicDistribution(ca_form);

            for (int i = 0; i < ca_ref.Length; i++)
            {
                // mMass doesn't calculate the intensity of the monoisotopic mass peak so need to offset by 4
                Assert.AreEqual(ca_ref.Masses[i], ca_mercury.Masses[i + 4], 0.01);
                Assert.AreEqual(ca_ref.Intensities[i], ca_mercury.Intensities[i + 4], 0.01);
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: zrolfs/sdk
        private static void BenchmarkIsotopicEvelopeGeneration()
        {
            // Generate the formulas
            var random = new Random(1);

            var chemicalFormulas             = new IChemicalFormula[MaxRunValue];
            IElementProvider elementProvider = new MockElementProvider();

            for (int i = 2; i < MaxRunValue; i++)
            {
                var elements = new[]
                {
                    new EntityCardinality <IElement>(elementProvider.GetElement("H"), (int)(random.Next(i) * 7.7583)),
                    new EntityCardinality <IElement>(elementProvider.GetElement("C"), (int)(random.Next(i) * 4.9384)),
                    new EntityCardinality <IElement>(elementProvider.GetElement("N"), (int)(random.Next(i) * 1.3577)),
                    new EntityCardinality <IElement>(elementProvider.GetElement("O"), (int)(random.Next(i) * 1.4773)),
                    new EntityCardinality <IElement>(elementProvider.GetElement("S"), (int)(random.Next(i) * 0.0417)),
                };

                chemicalFormulas[i] = new ChemicalFormula(elements);
            }

            var stopwatch = new Stopwatch();

            // Time UW Madison (port)
            var fineGrain = new FineStructureIsotopicGenerator();

            stopwatch.Reset();
            stopwatch.Start();
            for (int i = 2; i < MaxRunValue; i++)
            {
                var nice = fineGrain.GenerateIsotopicDistribution(chemicalFormulas[i], 0.2, 1E-26);
            }
            stopwatch.Stop();

            Console.WriteLine("Elapsed time for UofW Madison Port: " + stopwatch.Elapsed);

            // Time Northwestern (port)
            var mercury7 = new Mercury7();

            stopwatch.Reset();
            stopwatch.Start();
            for (int i = 2; i < MaxRunValue; i++)
            {
                MassSpectrometry.IIsotopicDistribution nice = mercury7.GenerateIsotopicDistribution(chemicalFormulas[i]);
            }
            stopwatch.Stop();

            Console.WriteLine("Elapsed time for Northwestern Port: " + stopwatch.Elapsed);
        }