Esempio n. 1
0
        private DeconvolutedSpectrum GetDeconvolutedSpectrum(int scan, PbfLcMsRun pbfLcMsRun)
        {
            var spectrum = pbfLcMsRun.GetSpectrum(scan) as ProductSpectrum;

            if (spectrum == null)
            {
                return(null);
            }

            return(Deconvoluter.GetCombinedDeconvolutedSpectrum(spectrum, 1, 20, 2, new Tolerance(10, ToleranceUnit.Ppm), 0.7));
        }
Esempio n. 2
0
        public void TestReadingPbfFile()
        {
            var methodName = MethodBase.GetCurrentMethod().Name;

            TestUtils.ShowStarting(methodName);

            const string pbfFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\ProductionQCShew\QC_Shew_13_04_A_17Feb14_Samwise_13-07-28.pbf";

            if (!File.Exists(pbfFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, pbfFilePath);
            }

            var pbfRun = new PbfLcMsRun(pbfFilePath);

            var specFilePath = Path.ChangeExtension(pbfFilePath, "raw");

            if (!File.Exists(specFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath);
            }

            Console.WriteLine(@"Loading .pbf into memory");

            var run = InMemoryLcMsRun.GetLcMsRun(specFilePath);

            Console.WriteLine(@"Comparing spectra between .pbf and in-memory spectra");

            // spectrum comparison
            for (var scanNum = run.MinLcScan; scanNum <= run.MaxLcScan; scanNum++)
            {
                var spec1 = run.GetSpectrum(scanNum);
                var spec2 = pbfRun.GetSpectrum(scanNum);

                Assert.IsTrue(spec1.Peaks.Length == spec2.Peaks.Length);
                for (var i = 0; i < spec1.Peaks.Length; i++)
                {
                    var p1 = spec1.Peaks[i];
                    var p2 = spec2.Peaks[i];

                    Assert.True(p1.Equals(p2));

                    Assert.True(Math.Abs(p1.Mz - p2.Mz) < 1e-8);
                    Assert.True(Math.Abs(p1.Intensity - p2.Intensity) < 0.001);
                }
            }

            Console.WriteLine(@"Comparing XICs");
            // chromatogram comparison
            const double targetMz  = 655.01;
            var          tolerance = new Tolerance(10);
            var          xic1      = run.GetFullPrecursorIonExtractedIonChromatogram(targetMz, tolerance);
            var          xic2      = pbfRun.GetFullPrecursorIonExtractedIonChromatogram(targetMz, tolerance);

            Assert.True(xic1.Count == xic2.Count);

            for (var i = 0; i < xic1.Count; i++)
            {
                if (!xic1[i].Equals(xic2[i]))
                {
                    Console.WriteLine(@"{0} {1} {2}", i, xic1[i], xic2[i]);
                }
                Assert.True(xic1[i].Equals(xic2[i]));
            }
            Console.WriteLine(@"Done");
        }
Esempio n. 3
0
        public void TestReadingPbfFile()
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            TestUtils.ShowStarting(methodName);

            const string pbfFilePath = @"\\proto-2\UnitTest_Files\InformedProteomics_TestFiles\TopDown\ProductionQCShew\QC_Shew_13_04_A_17Feb14_Samwise_13-07-28.pbf";
            if (!File.Exists(pbfFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, pbfFilePath);
            }

            var pbfRun = new PbfLcMsRun(pbfFilePath);

            var specFilePath = Path.ChangeExtension(pbfFilePath, "raw");
            if (!File.Exists(specFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath);
            }

            Console.WriteLine(@"Loading .pbf into memory");

            var run = InMemoryLcMsRun.GetLcMsRun(specFilePath);

            Console.WriteLine(@"Comparing spectra between .pbf and in-memory spectra");

            // spectrum comparison
            for (var scanNum = run.MinLcScan; scanNum <= run.MaxLcScan; scanNum++)
            {
                var spec1 = run.GetSpectrum(scanNum);
                var spec2 = pbfRun.GetSpectrum(scanNum);

                Assert.IsTrue(spec1.Peaks.Length == spec2.Peaks.Length);
                for (var i = 0; i < spec1.Peaks.Length; i++)
                {
                    var p1 = spec1.Peaks[i];
                    var p2 = spec2.Peaks[i];

                    Assert.True(p1.Equals(p2));

                    Assert.True(Math.Abs(p1.Mz - p2.Mz) < 1e-8);
                    Assert.True(Math.Abs(p1.Intensity - p2.Intensity) < 0.001);
                }
            }

            Console.WriteLine(@"Comparing XICs");
            // chromatogram comparison
            const double targetMz = 655.01;
            var tolerance = new Tolerance(10);
            var xic1 = run.GetFullPrecursorIonExtractedIonChromatogram(targetMz, tolerance);
            var xic2 = pbfRun.GetFullPrecursorIonExtractedIonChromatogram(targetMz, tolerance);
            Assert.True(xic1.Count == xic2.Count);

            for (var i = 0; i < xic1.Count; i++)
            {
                if (!xic1[i].Equals(xic2[i]))
                {
                    Console.WriteLine(@"{0} {1} {2}", i, xic1[i], xic2[i]);
                }
                Assert.True(xic1[i].Equals(xic2[i]));
            }
            Console.WriteLine(@"Done");
        }