public void Initialize()
        {
            EmptyBasePeakRun = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                }
            };
            Basepeak1Run = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                }
            };

            var spectrumpoint1 = new SpectrumPoint(2000, 150, 2.58F);
            var spectrumpoint2 = new SpectrumPoint(3000, 150.01F, 3.00F);

            var basePeak1 = new BasePeak(150, 2.5, 150)
            {
                BpkRTs = new List <double>()
                {
                    2.5
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint1, spectrumpoint2
                }
            };
            var EmptyBasePeak = new BasePeak(1, 1, 1)
            {
                Spectrum = new List <SpectrumPoint>()
                {
                }
            };

            Basepeak1Run.BasePeaks = new ConcurrentBag <BasePeak>()
            {
                basePeak1
            };
            BasePeak1ChromatogramGenerator = new ChromatogramMetricGenerator();
            BasePeak1ChromatogramGenerator.GenerateChromatogram(Basepeak1Run);

            EmptyBasePeakRun.BasePeaks = new ConcurrentBag <BasePeak>()
            {
                EmptyBasePeak
            };
            EmptyCMG = new ChromatogramMetricGenerator();
            EmptyCMG.GenerateChromatogram(EmptyBasePeakRun);
        }
예제 #2
0
        public void Initialize()
        {
            ///<summary>The Metric Generator is the main tree from which the other metric calculatingfunction groups are run.
            ///Therefore most tests will not be run here, but in the function branches RTGrouper/SWATHGrouper etc. There are however a few
            ///functions that are run here and they are also tested here.</summary>

            Scan ms2scan1 = new Scan(false, 1, 1, 0, 2, 2, 1, 1000);
            Scan ms2scan2 = new Scan(false, 1, 1, 0, 2, 2, 1, 5000);
            Scan ms2scan3 = new Scan(false, 5, 5, 0, 2, 4, 1, 1000);
            Scan ms2scan4 = new Scan(false, 1, 1, 0, 2, 4, 2, 51000);
            Scan ms2scan5 = new Scan(false, 1, 1, 0, 2, 5, 2, 1000);
            Scan ms2scan6 = new Scan(false)
            {
                ScanStartTime = 0,
                MsLevel       = 2,
                Density       = 5
            };

            var spectrumpoint1 = new SpectrumPoint(2000, 150, 2.58F);
            var spectrumpoint2 = new SpectrumPoint(3000, 150.01F, 3.00F);

            var basePeak1 = new BasePeak(150, 2.5, 150)
            {
                BpkRTs = new List <double>()
                {
                    2.5
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint1, spectrumpoint2
                }
            };

            Contains5ms2ScansRun = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                },
                Ms2Scans = new ConcurrentBag <Scan>()
                {
                    ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan5
                },
                LastScanTime = 70,
                StartTime    = 2.5
            };


            Contains5ms2ScansRun.BasePeaks.Add(basePeak1);
            Contains5ms2ScansRun.SourceFileNames.Add(" ");
            Contains5ms2ScansRun.SourceFileChecksums.Add(" ");

            Emptyms2scansRun = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                },
                Ms2Scans = new ConcurrentBag <Scan>()
                {
                    ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan6
                },                                                                                        //6 does not have upper and lower offsets
                LastScanTime = 0,
                StartTime    = 1000000
            };

            Emptyms2scansRun.BasePeaks.Add(basePeak1);
            Emptyms2scansRun.SourceFileNames.Add(" ");
            Emptyms2scansRun.SourceFileChecksums.Add(" ");

            MetricGenerator = new MetricGenerator();
        }
예제 #3
0
        public void Initialize()
        {
            Scan ms2scan1 = new Scan(false, 1, 1, 0, 2, 2, 1, 100.00)
            {
            };
            Scan ms2scan2 = new Scan(false, 1, 1, 20, 2, 2, 1, 100000.02)
            {
            };
            Scan ms2scan3 = new Scan(false, 5, 5, 30, 2, 4, 2, 30)
            {
            };
            Scan ms2scan4 = new Scan(false, 5, 5, 32, 2, 4, 2, 20010.33)
            {
            };
            Scan ms2scan5 = new Scan(false, 5, 5, 34, 2, 4, 2, 50.33)
            {
            };
            Scan ms2scan6 = new Scan(false, 1, 1, 35, 2, 4, 2, 4000)
            {
            };
            Scan ms2scan7 = new Scan(false, 1, 1, 70, 2, 5, 3, 60000)
            {
            };
            Scan ms2scan8 = new Scan(false, 1, 1, 70, 2, 5, 3, 6000)
            {
            };
            Scan ms2scan9 = new Scan(false)
            {
                ScanStartTime   = 0,
                MsLevel         = 2,
                Density         = 5,
                TotalIonCurrent = 8000
            };
            //MS1scans
            Scan ms1scan1 = new Scan(false)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowUpperOffset = 1,
                ScanStartTime     = 0,
                MsLevel           = 1,
                Density           = 2,
                Cycle             = 1,
                TotalIonCurrent   = 1000,
                BasePeakIntensity = 1000,
                BasePeakMz        = 1058
            };
            Scan ms1scan2 = new Scan(false)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowUpperOffset = 5,
                ScanStartTime     = 30,
                MsLevel           = 1,
                Density           = 4,
                Cycle             = 2,
                TotalIonCurrent   = 3050,
                BasePeakIntensity = 1500,
                BasePeakMz        = 459
            };
            Scan ms1scan3 = new Scan(false)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowUpperOffset = 5,
                ScanStartTime     = 70,
                MsLevel           = 1,
                Density           = 4,
                Cycle             = 3,
                TotalIonCurrent   = 3050,
                BasePeakIntensity = 5000,
                BasePeakMz        = 150
            };



            //BasePeaks:
            var spectrumpoint1 = new SpectrumPoint(2000, 150, 2.58F)
            {
            };
            var spectrumpoint2 = new SpectrumPoint(3000, 150.01F, 3.00F)
            {
            };
            var spectrumpoint3 = new SpectrumPoint(3000, 150.01F, 60F)
            {
            };
            var basePeak1 = new BasePeak(150, 2.5, 150)
            {
                BpkRTs = new List <double>()
                {
                    2.5
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint1, spectrumpoint2
                },
                Mz = 150
            };

            basePeak1.FWHMs.Add(1);
            basePeak1.FWHMs.Add(2);
            basePeak1.Peaksyms.Add(1);
            basePeak1.Peaksyms.Add(2);
            basePeak1.Intensities.Add(1);
            basePeak1.Intensities.Add(2);
            basePeak1.FullWidthBaselines.Add(1);
            basePeak1.FullWidthBaselines.Add(2);

            var basePeak2 = new BasePeak(300, 60, 150)
            {
                BpkRTs = new List <double>()
                {
                    60
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint3
                }
            };

            basePeak2.FWHMs.Add(2);
            basePeak2.Peaksyms.Add(1);
            basePeak2.Intensities.Add(2);
            basePeak2.FullWidthBaselines.Add(1);

            //Runs:
            Ms2andms1Run = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                },
                Ms2Scans = new ConcurrentBag <Scan>()
                {
                    ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan5, ms2scan6, ms2scan7, ms2scan8
                },
                Ms1Scans = new List <Scan>()
                {
                    ms1scan1, ms1scan2, ms1scan3
                },
                LastScanTime = 100,
                StartTime    = 0
            };


            Ms2andms1Run.BasePeaks.Add(basePeak1);
            Ms2andms1Run.BasePeaks.Add(basePeak2);
            Ms2andms1Run.SourceFileNames.Add(" ");
            Ms2andms1Run.SourceFileChecksums.Add(" ");

            Emptyms2scansRun = new Run
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                },
                Ms2Scans = new ConcurrentBag <Scan>()
                {
                    ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan9
                },                                                                                        //9 does not have upper and lower offsets
                LastScanTime = 0,
                StartTime    = 1000000
            };

            Emptyms2scansRun.BasePeaks.Add(basePeak1);
            Emptyms2scansRun.SourceFileNames.Add(" ");
            Emptyms2scansRun.SourceFileChecksums.Add(" ");

            RTGrouper = new RTGrouper();
            Result    = RTGrouper.DivideByRT(Ms2andms1Run, 2, 100);
        }
예제 #4
0
        public void Initialize()
        {
            var spectrumpoint1A = new SpectrumPoint(2000, 550, 2.58F)
            {
            };
            var spectrumpoint2A = new SpectrumPoint(3000, 551F, 3.00F)
            {
            };

            List <SpectrumPoint> spectrum = new List <SpectrumPoint>()
            {
                spectrumpoint1A, spectrumpoint2A
            };
            string tempPath = Path.GetTempPath();

            Scan ms2scan1 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 550,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 0,
                MsLevel         = 2,
                Density         = 2,
                Cycle           = 1,
                TotalIonCurrent = 1000
            };


            Scan ms2scan2 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowTargetMz    = 550,
                IsolationWindowUpperOffset = 5,
                ScanStartTime   = 30,
                MsLevel         = 2,
                Density         = 4,
                Cycle           = 2,
                TotalIonCurrent = 3050
            };


            Scan ms2scan3 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 550,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 35,
                MsLevel         = 2,
                Density         = 4,
                Cycle           = 3,
                TotalIonCurrent = 4000
            };
            Scan ms2scan4 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 550,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 70,
                MsLevel         = 2,
                Density         = 5,
                Cycle           = 4,
                TotalIonCurrent = 6000
            };
            Scan ms2scan5 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 550,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 70.002,
                MsLevel         = 2,
                Density         = 5,
                Cycle           = 5,
                TotalIonCurrent = 6000
            };
            Scan ms2scan6 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 1050,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 0,
                MsLevel         = 2,
                Density         = 2,
                Cycle           = 1,
                TotalIonCurrent = 1000
            };


            Scan ms2scan7 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowTargetMz    = 1050,
                IsolationWindowUpperOffset = 5,
                ScanStartTime   = 30,
                MsLevel         = 2,
                Density         = 4,
                Cycle           = 2,
                TotalIonCurrent = 3050
            };


            Scan ms2scan8 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 1050,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 35,
                MsLevel         = 2,
                Density         = 40,
                Cycle           = 3,
                TotalIonCurrent = 4000
            };
            Scan ms2scan9 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 1050,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 70,
                MsLevel         = 2,
                Density         = 20,
                Cycle           = 4,
                TotalIonCurrent = 20000
            };
            Scan ms2scan10 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowTargetMz    = 1050,
                IsolationWindowUpperOffset = 1,
                ScanStartTime   = 70.002,
                MsLevel         = 2,
                Density         = 18,
                Cycle           = 5,
                TotalIonCurrent = 10000
            };
            //MS1scans
            Scan ms1scan1 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 1,
                IsolationWindowUpperOffset = 1,
                ScanStartTime     = 0,
                MsLevel           = 1,
                Density           = 2,
                Cycle             = 1,
                TotalIonCurrent   = 1000,
                BasePeakIntensity = 1000,
                BasePeakMz        = 1058
            };
            Scan ms1scan2 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowUpperOffset = 5,
                ScanStartTime     = 30,
                MsLevel           = 1,
                Density           = 4,
                Cycle             = 2,
                TotalIonCurrent   = 3050,
                BasePeakIntensity = 1500,
                BasePeakMz        = 459
            };
            Scan ms1scan3 = new Scan(false, tempPath)
            {
                IsolationWindowLowerOffset = 5,
                IsolationWindowUpperOffset = 5,
                ScanStartTime     = 70,
                MsLevel           = 1,
                Density           = 4,
                Cycle             = 3,
                TotalIonCurrent   = 3050,
                BasePeakIntensity = 5000,
                BasePeakMz        = 150
            };



            //BasePeaks:
            var spectrumpoint1 = new SpectrumPoint(2000, 150, 2.58F)
            {
            };
            var spectrumpoint2 = new SpectrumPoint(3000, 150.01F, 3.00F)
            {
            };
            var spectrumpoint3 = new SpectrumPoint(3000, 150.01F, 60F)
            {
            };
            var basePeak1 = new BasePeak(150, 2.5, 150)
            {
                BpkRTs = new List <double>()
                {
                    2.5
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint1, spectrumpoint2
                },
                Mz = 150
            };

            basePeak1.FWHMs.Add(1);
            basePeak1.FWHMs.Add(2);
            basePeak1.Peaksyms.Add(1);
            basePeak1.Peaksyms.Add(2);
            basePeak1.Intensities.Add(1);
            basePeak1.Intensities.Add(2);
            basePeak1.FullWidthBaselines.Add(1);
            basePeak1.FullWidthBaselines.Add(2);

            var basePeak2 = new BasePeak(300, 60, 150)
            {
                BpkRTs = new List <double>()
                {
                    60
                },
                Spectrum = new List <SpectrumPoint>()
                {
                    spectrumpoint3
                }
            };

            basePeak2.FWHMs.Add(2);
            basePeak2.Peaksyms.Add(1);
            basePeak2.Intensities.Add(2);
            basePeak2.FullWidthBaselines.Add(1);

            //Runs:
            ms2andms1Run = new Run <Scan>
            {
                AnalysisSettings = new AnalysisSettings
                {
                    RtTolerance = 2.5
                },
                LastScanTime = 100,
                StartTime    = 0
            };
            ms2andms1Run.Ms2Scans.AddRange(new Scan[] { ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan5, ms2scan6, ms2scan7, ms2scan8, ms2scan9, ms2scan10 });
            ms2andms1Run.Ms1Scans.AddRange(new Scan[] { ms1scan1, ms1scan2, ms1scan3 });

            ms2andms1Run.BasePeaks.Add(basePeak1);
            ms2andms1Run.BasePeaks.Add(basePeak2);
            ms2andms1Run.SourceFileNames.Add(" ");
            ms2andms1Run.SourceFileChecksums.Add(" ");

            /*
             * emptyms2scansRun = new Run
             * {
             *  AnalysisSettings = new AnalysisSettings
             *  {
             *      RtTolerance = 2.5
             *  },
             *  Ms2Scans = new ConcurrentBag<Scan>() { ms2scan1, ms2scan2, ms2scan3, ms2scan4, ms2scan6 },//9 does not have upper and lower offsets
             *  LastScanTime = 0,
             *  StartTime = 1000000
             * };
             *
             * emptyms2scansRun.BasePeaks.Add(basePeak1);
             * emptyms2scansRun.SourceFileNames.Add(" ");
             * emptyms2scansRun.SourceFileChecksums.Add(" ");*/

            swathGrouper = new SwathGrouper();
            result       = swathGrouper.GroupBySwath(ms2andms1Run);
        }