protected XYData GetCorrelatedChromPeakXYData(Run run, int startScan, int stopScan, XYData basePeakChromXYData, double correlatedMZValue)
        {
            var xydata = PeakChromGen.GenerateChromatogram(run, startScan, stopScan, correlatedMZValue, ChromTolerance, ChromToleranceUnit);

            XYData chromPeakXYData;

            if (xydata == null || xydata.Xvalues.Length == 0)
            {
                chromPeakXYData         = new XYData();
                chromPeakXYData.Xvalues = basePeakChromXYData.Xvalues;
                chromPeakXYData.Yvalues = new double[basePeakChromXYData.Xvalues.Length];
            }
            else
            {
                chromPeakXYData = Smoother.Smooth(xydata);
            }


            var chromDataIsOK = chromPeakXYData != null && chromPeakXYData.Xvalues != null &&
                                chromPeakXYData.Xvalues.Length > 3;

            if (chromDataIsOK)
            {
                chromPeakXYData = chromPeakXYData.TrimData(startScan, stopScan);
            }
            return(chromPeakXYData);
        }
Exemplo n.º 2
0
        public void BadCorrelationTest1()
        {
            var dataset =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\RawData\Alz_P01_A01_097_26Apr12_Roc_12-03-15.RAW";

            var run = new RunFactory().CreateRun(dataset);

            var peaksDataFile = dataset.ToLower().Replace(".raw", "_peaks.txt");
            var peakImporter  = new PeakImporterFromText(peaksDataFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);


            double chromToleranceInPPM = 10;
            var    startScan           = 2340;
            var    stopScan            = 2440;

            var smoother = new SavitzkyGolaySmoother(9, 2);

            var testMZVal1 = 719.80349;

            var peakChromGen = new PeakChromatogramGenerator(chromToleranceInPPM);

            run.XYData = peakChromGen.GenerateChromatogram(run, startScan, stopScan, testMZVal1, chromToleranceInPPM);
            run.XYData = smoother.Smooth(run.XYData);

            var chromdata1 = run.XYData.TrimData(startScan, stopScan);

            var testMZVal2 = 722.325;

            run.XYData = peakChromGen.GenerateChromatogram(run, startScan, stopScan, testMZVal2, chromToleranceInPPM);
            run.XYData = smoother.Smooth(run.XYData);

            var chromdata2 = run.XYData.TrimData(startScan, stopScan);



            //chromdata1.Display();
            //Console.WriteLine();
            //chromdata2.Display();

            ChromatogramCorrelatorBase correlator = new ChromatogramCorrelator(3);
            double slope       = 0;
            double intercept   = 0;
            double rsquaredVal = 0;

            correlator.GetElutionCorrelationData(chromdata1, chromdata2, out slope, out intercept, out rsquaredVal);


            Console.WriteLine("slope = \t" + slope);
            Console.WriteLine("intercept = \t" + intercept);
            Console.WriteLine("rsquared = \t" + rsquaredVal);


            for (var i = 0; i < chromdata1.Xvalues.Length; i++)
            {
                Console.WriteLine(chromdata1.Xvalues[i] + "\t" + chromdata1.Yvalues[i] + "\t" + chromdata2.Yvalues[i]);
            }
        }
        public void SmoothWithOldDeconToolsSmootherTest1()
        {
            var sampleXYDataFile = Path.Combine(FileRefs.TestFileBasePath, "sampleXYData1.txt");

            Assert.IsTrue(File.Exists(sampleXYDataFile));

            var smoother = new SavitzkyGolaySmoother(3, 3, true);

            var xydata         = TestUtilities.LoadXYDataFromFile(sampleXYDataFile);
            var smoothedXYData = smoother.Smooth(xydata);


            Assert.AreEqual(xydata.Xvalues.Length, smoothedXYData.Xvalues.Length);


            var sb = new StringBuilder();

            sb.Append("xval\tnonSmoothed_Y\tsmoothed_Y\n");
            for (var i = 0; i < xydata.Xvalues.Length; i++)
            {
                sb.Append(xydata.Xvalues[i] + "\t" + xydata.Yvalues[i] + "\t" + smoothedXYData.Yvalues[i] + Environment.NewLine);
            }

            Console.WriteLine(sb.ToString());
        }
Exemplo n.º 4
0
        public void TestBuildWaterShedMap()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    targetMz     = 643.27094937;
            double ppmTolerance = 50;

            var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref intensityBlock);

            var pointList = WaterShedMapUtil.BuildWatershedMap(intensityBlock, 0, 0).ToList();

            Console.WriteLine(intensityBlock.Length);


            Assert.AreEqual(270000, intensityBlock.Length);
            Assert.AreEqual(12969, pointList.Count);

            Assert.AreEqual(pointList[1000].Intensity, 14.844082, 0.0001);
            Assert.AreEqual(pointList[5000].Intensity, 5.760, 0.0001);
        }
Exemplo n.º 5
0
        public void TestDoWaterShedAlgorithmByBin()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);
            var smoother     = new SavitzkyGolaySmoother(5, 2);

            var bin = 73009;
            var intensityPointList = uimfUtil.GetXic(bin, UIMFData.FrameType.MS1);

            var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList).ToList();

            var preSmoothedFeatureList = FeatureDetection.DoWatershedAlgorithm(pointList).ToList();

            Console.WriteLine(DateTime.Now + "\tBefore Smoothing:\tNumPoints = " + pointList.Count + "\tNumFeatures = " + preSmoothedFeatureList.Count);

            foreach (var featureBlob in preSmoothedFeatureList)
            {
                var mostIntensePoint = featureBlob.PointList.First();
                Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
            }
            Console.WriteLine("******************************************************");

            var newPointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList);

            smoother.Smooth(ref newPointList);
            var smoothedFeatureList = FeatureDetection.DoWatershedAlgorithm(newPointList).ToList();

            Console.WriteLine(DateTime.Now + "\tAfter Smoothing:\tNumPoints = " + newPointList.Count() + "\tNumFeatures = " + smoothedFeatureList.Count);
            foreach (var featureBlob in smoothedFeatureList)
            {
                var mostIntensePoint = featureBlob.PointList.First();
                Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get a smoothed XIC.
        /// </summary>
        /// <param name="smoother">Smoother to smooth XIC.</param>
        /// <param name="xic">XIC to smooth.</param>
        /// <returns>Array of smoothed XIC points.</returns>
        public static XicPoint[] SmoothXic(SavitzkyGolaySmoother smoother, IList <XicPoint> xic)
        {
            var xicP = new double[xic.Count];

            for (var i = 0; i < xic.Count; i++)
            {
                xicP[i] = xic[i].Intensity;
            }

            double[] smoothedPoints;
            try
            {
                smoothedPoints = smoother.Smooth(xicP);
            }
            catch (IndexOutOfRangeException)
            {
                smoothedPoints = xicP;
            }

            var smoothedXic = new XicPoint[xicP.Length];

            for (var i = 0; i < xicP.Length; i++)
            {
                smoothedXic[i] = new XicPoint(xic[i].ScanNum, xic[i].Mz, smoothedPoints[i]);
            }

            return(smoothedXic);
        }
Exemplo n.º 7
0
        private void FindPpmErrorAndWidth()
        {
            var histogramValues         = Array.ConvertAll(RawResults.Values.ToArray(), input => (double)input);
            var smoothedHistogramValues = _smoother.Smooth(histogramValues);

            var    indexOfMax = 0;
            double maxValue   = 0;

            for (var i = 0; i < smoothedHistogramValues.Length; i++)
            {
                var value = smoothedHistogramValues[i];

                if (value > maxValue)
                {
                    maxValue   = value;
                    indexOfMax = i;
                }
            }

            var leftIndex  = indexOfMax;
            var rightIndex = indexOfMax;

            // Move left
            for (var i = indexOfMax - 1; i >= 0; i--)
            {
                var previousValue = smoothedHistogramValues[i + 1];
                var value         = smoothedHistogramValues[i];

                if (value > previousValue)
                {
                    leftIndex = i + 1;
                    break;
                }
            }

            // Move right
            for (var i = indexOfMax + 1; i < smoothedHistogramValues.Length; i++)
            {
                var previousValue = smoothedHistogramValues[i - 1];
                var value         = smoothedHistogramValues[i];

                if (value > previousValue)
                {
                    rightIndex = i - 1;
                    break;
                }
            }

            var ppmHistogramKeys = RawResults.Keys.ToList();

            PpmError   = ppmHistogramKeys[indexOfMax];
            ErrorWidth = ppmHistogramKeys[rightIndex] - ppmHistogramKeys[leftIndex];

            SmoothedResults = new SortedDictionary <double, double>();
            for (var i = 0; i < ppmHistogramKeys.Count; i++)
            {
                SmoothedResults.Add(ppmHistogramKeys[i], smoothedHistogramValues[i]);
            }
        }
Exemplo n.º 8
0
        public void TestDoWaterShedAlgorithm()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    targetMz     = 582.32181703760114;
            double ppmTolerance = 25;

            var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(11, 2);

            smoother.Smooth(ref intensityBlock);

            var pointList   = WaterShedMapUtil.BuildWatershedMap(intensityBlock, 0, 0);
            var featureList = FeatureDetection.DoWatershedAlgorithm(pointList);

            foreach (var featureBlob in featureList)
            {
                var mostIntensePoint = featureBlob.PointList.First();
                Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
            }
            Console.WriteLine("******************************************************");

            var intensityPointList = uimfUtil.GetXic(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var newPointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList);

            smoother.Smooth(ref newPointList);
            var newFeatureList = FeatureDetection.DoWatershedAlgorithm(newPointList);

            foreach (var featureBlob in newFeatureList)
            {
                var mostIntensePoint = featureBlob.PointList.First();
                Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
            }
        }
        /// <summary>
        /// The find peak using watershed.
        /// </summary>
        /// <param name="intensityPoints">
        /// The intensity Points.
        /// </param>
        /// <param name="smoother">
        /// The smoother.
        /// </param>
        /// <param name="featureFilterLevel">
        /// The feature Filter Level.
        /// </param>
        /// <returns>
        /// The <see cref="IList"/>.
        /// </returns>
        public static List<FeatureBlob> FindPeakUsingWatershed(List<IntensityPoint> intensityPoints, SavitzkyGolaySmoother smoother, double featureFilterLevel)
        {
            IEnumerable<Point> pointList = WaterShedMapUtil.BuildWatershedMap(intensityPoints);

            // Ignore the smoother for now as it distort peak apexs arbitrarily.
            smoother.Smooth(ref pointList);

            // Peak Find Chromatogram
            List<FeatureBlob> featureBlobs = FeatureDetection.DoWatershedAlgorithm(pointList).ToList();

            // Preliminary filtering: reject small feature peaks.
            featureBlobs = FeatureDetection.FilterFeatureList(featureBlobs, featureFilterLevel).ToList();

            return featureBlobs;
        }
Exemplo n.º 10
0
        public void Test3DSmooth()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    targetMz     = 643.27094937;
            double ppmTolerance = 50;

            var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, DataReader.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref intensityBlock);

            Console.WriteLine(intensityBlock.Length);
        }
Exemplo n.º 11
0
        public void TestDoWaterShedAlgorithmAllBins()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            // ReSharper disable once UnusedVariable
            var numberOfBins = uimfUtil.GetNumberOfBins();

            var smoother = new SavitzkyGolaySmoother(5, 2);

            for (var i = 73009; i <= 84000; i++)
            {
                var mz = uimfUtil.GetMzFromBin(i);
                var intensityPointList = uimfUtil.GetXic(mz, 25, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);
                //List<IntensityPoint> intensityPointList = uimfUtil.GetXic(i, DataReader.FrameType.MS1);

                //SavitzkyGolaySmoother smoother = new SavitzkyGolaySmoother(9, 2);
                //smoother.Smooth(ref intensityBlock);

                //int boundX = intensityBlock.GetUpperBound(0);
                //int boundY = intensityBlock.GetUpperBound(1);

                //TextWriter smoothedWriter = new StreamWriter("smoothedRaw.csv");
                //for (int j = 0; j < boundX; j++)
                //{
                //    StringBuilder row = new StringBuilder();
                //    for (int k = 0; k < boundY; k++)
                //    {
                //        row.Append(intensityBlock[j, k] + ",");
                //    }
                //    smoothedWriter.WriteLine(row.ToString());
                //}

                //smoothedWriter.Close();

                var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList);
                smoother.Smooth(ref pointList);
                var featureList = FeatureDetection.DoWatershedAlgorithm(pointList);

                Console.WriteLine(DateTime.Now + "\tBin = " + i + "\tNumPoints = " + pointList.Count() + "\tNumFeatures = " + featureList.Count());
            }
        }
        public void SmoothWithNewDeconToolsSmootherTest1()
        {
            var sampleXYDataFile = Path.Combine(FileRefs.TestFileBasePath, "sampleXYData1.txt");

            Assert.IsTrue(File.Exists(sampleXYDataFile));

            var smoother = new SavitzkyGolaySmoother(7, 2);

            var xydata = TestUtilities.LoadXYDataFromFile(sampleXYDataFile);

            var numSmooths = 2000;

            var stopwatch = new Stopwatch();

            stopwatch.Start();


            var smoothedXYData = new XYData();

            for (var i = 0; i < numSmooths; i++)
            {
                smoothedXYData = smoother.Smooth(xydata);
            }

            stopwatch.Stop();


            Console.WriteLine("Average time for smoothing (milliseconds) = " + stopwatch.ElapsedMilliseconds / (double)numSmooths);

            Assert.AreEqual(xydata.Xvalues.Length, smoothedXYData.Xvalues.Length);


            var sb = new StringBuilder();

            sb.Append("xval\tnonSmoothed_Y\tsmoothed_Y\n");
            for (var i = 0; i < xydata.Xvalues.Length; i++)
            {
                sb.Append(xydata.Xvalues[i] + "\t" + xydata.Yvalues[i] + "\t" + smoothedXYData.Yvalues[i] + Environment.NewLine);
            }

            // Console.WriteLine(sb.ToString());
        }
Exemplo n.º 13
0
        public void CorrelationTest2_UsingExecutorMethod()
        {
            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var peakImporter = new PeakImporterFromText(FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);

            var mt = TestUtilities.GetMassTagStandard(1);

            run.CurrentMassTag = mt;

            var unlabelledTheorGenerator = new JoshTheorFeatureGenerator();

            unlabelledTheorGenerator.GenerateTheorFeature(mt);


            double chromToleranceInPPM = 10;
            var    startScan           = 5460;
            var    stopScan            = 5755;

            var smoother = new SavitzkyGolaySmoother(3, 2);

            var peakChromGen = new PeakChromatogramGenerator(chromToleranceInPPM);

            run.XYData = peakChromGen.GenerateChromatogram(run, startScan, stopScan, mt.IsotopicProfile.Peaklist[0].XValue, chromToleranceInPPM);
            run.XYData = smoother.Smooth(run.XYData);

            var result = run.ResultCollection.GetTargetedResult(mt);

            ChromatogramCorrelatorBase correlator = new ChromatogramCorrelator(3);
            var corrData = correlator.CorrelatePeaksWithinIsotopicProfile(run, mt.IsotopicProfile, startScan, stopScan);

            Debug.Assert(corrData.CorrelationDataItems != null, "corrData.CorrelationDataItems != null");
            Assert.AreEqual(0.98m, (decimal)Math.Round((double)corrData.CorrelationDataItems[1].CorrelationRSquaredVal, 2));

            foreach (var item in corrData.CorrelationDataItems)
            {
                Console.WriteLine(item.CorrelationRSquaredVal);
            }
        }
Exemplo n.º 14
0
        public void TestComputingApexProfiles()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);
            var smoother     = new SavitzkyGolaySmoother(5, 2);

            var    targetMz  = 964.40334;
            double tolerance = 20;

            var intensityPointList = uimfUtil.GetXic(targetMz, tolerance, UIMFData.FrameType.MS1,
                                                     DataReader.ToleranceType.PPM);
            var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList);

            smoother.Smooth(ref pointList);
            var featureBlobs = FeatureDetection.DoWatershedAlgorithm(pointList);
            IEnumerable <FeatureBlobStatistics> featureBlobStatList = featureBlobs.Select(featureBlob => featureBlob.Statistics).ToList();

            foreach (var f in featureBlobStatList)
            {
                Console.WriteLine(
                    "LC: [{0},{1}], IMS: [{2},{3}], Apex: [{4},{5}] SumIntensities: {6}, NumPoints: {7}",
                    f.ScanLcMin,
                    f.ScanLcMax,
                    f.ScanImsMin,
                    f.ScanImsMax,
                    f.ScanLcRep,
                    f.ScanImsRep,
                    f.SumIntensities,
                    f.NumPoints
                    );
                Console.WriteLine("LC Apex profile");
                Console.WriteLine(string.Join(",", f.LcApexPeakProfile));
                Console.WriteLine("IMS Apex profile");
                Console.WriteLine(string.Join(",", f.ImsApexPeakProfile));
            }
        }
Exemplo n.º 15
0
        public void CorrelationTest1()
        {
            //TODO: test something

            var run = new RunFactory().CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            var peakImporter = new PeakImporterFromText(FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);

            var mt = TestUtilities.GetMassTagStandard(1);

            run.CurrentMassTag = mt;

            var unlabelledTheorGenerator = new JoshTheorFeatureGenerator();

            unlabelledTheorGenerator.GenerateTheorFeature(mt);


            double chromToleranceInPPM = 10;
            var    startScan           = 5460;
            var    stopScan            = 5755;

            var smoother = new SavitzkyGolaySmoother(3, 2);

            var peakChromGen = new PeakChromatogramGenerator(chromToleranceInPPM);

            run.XYData = peakChromGen.GenerateChromatogram(run, startScan, stopScan, mt.IsotopicProfile.Peaklist[0].XValue, chromToleranceInPPM);
            run.XYData = smoother.Smooth(run.XYData);

            var chromdata1 = run.XYData.TrimData(startScan, stopScan);


            run.XYData = peakChromGen.GenerateChromatogram(run, startScan, stopScan, mt.IsotopicProfile.Peaklist[3].XValue, chromToleranceInPPM);
            run.XYData = smoother.Smooth(run.XYData);

            var chromdata2 = run.XYData.TrimData(startScan, stopScan);

            //chromdata1.Display();
            //Console.WriteLine();
            //chromdata2.Display();

            ChromatogramCorrelatorBase correlator = new ChromatogramCorrelator(3);
            double slope       = 0;
            double intercept   = 0;
            double rsquaredVal = 0;

            correlator.GetElutionCorrelationData(chromdata1, chromdata2, out slope, out intercept, out rsquaredVal);

            Console.WriteLine(mt);

            Console.WriteLine("slope = \t" + slope);
            Console.WriteLine("intercept = \t" + intercept);
            Console.WriteLine("rsquared = \t" + rsquaredVal);


            for (var i = 0; i < chromdata1.Xvalues.Length; i++)
            {
                Console.WriteLine(chromdata1.Xvalues[i].ToString("0") + "\t" + chromdata1.Yvalues[i].ToString("0") + "\t" + chromdata2.Yvalues[i]);
            }
        }
Exemplo n.º 16
0
        public void TestDoWaterShedAlgorithmPrecursorAndFragments()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    parentMz     = 643.27094937;
            double ppmTolerance = 50;

            var parentIntensityBlock = uimfUtil.GetXicAsArray(parentMz, ppmTolerance, DataReader.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref parentIntensityBlock);

            var parentPointList = WaterShedMapUtil.BuildWatershedMap(parentIntensityBlock, 0, 0);
            var parentFeature   = FeatureDetection.DoWatershedAlgorithm(parentPointList).First();

            var statistics = parentFeature.Statistics;
            var scanLcMin  = statistics.ScanLcMin;
            var scanLcMax  = statistics.ScanLcMax;
            var scanImsMin = statistics.ScanImsMin;
            var scanImsMax = statistics.ScanImsMax;

            using (TextReader fragmentReader = new StreamReader(@"..\..\..\testFiles\OneFragment.csv"))
            {
                var line = "";
                while ((line = fragmentReader.ReadLine()) != null)
                {
                    var mzString = line.Trim();
                    var targetMz = double.Parse(mzString);

                    TextWriter unsmoothedWriter = new StreamWriter("unsmoothedRaw" + targetMz + ".csv");

                    var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, DataReader.FrameType.MS2, scanLcMin, scanLcMax, scanImsMin, scanImsMax, DataReader.ToleranceType.PPM);

                    var boundX = intensityBlock.GetUpperBound(0);
                    var boundY = intensityBlock.GetUpperBound(1);

                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        unsmoothedWriter.WriteLine(row.ToString());
                    }

                    unsmoothedWriter.Close();

                    smoother.Smooth(ref intensityBlock);

                    TextWriter smoothedWriter = new StreamWriter("smoothedRaw" + targetMz + ".csv");
                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        smoothedWriter.WriteLine(row.ToString());
                    }

                    smoothedWriter.Close();

                    var pointList   = WaterShedMapUtil.BuildWatershedMap(intensityBlock, scanLcMin, scanImsMin);
                    var featureList = FeatureDetection.DoWatershedAlgorithm(pointList);

                    Console.WriteLine("******************************************************");
                    Console.WriteLine("targetMz = " + targetMz);

                    foreach (var featureBlob in featureList)
                    {
                        var mostIntensePoint = featureBlob.PointList.OrderByDescending(x => x.Intensity).First();
                        Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
                    }
                }
            }
        }
Exemplo n.º 17
0
        private IEnumerable <UMCLight> RefineFeatureXics(IList <UMCLight> features)
        {
            // Here we smooth the points...and remove any features with from and trailing zero points
            var numberOfPoints = NumberOfPoints;
            var smoother       = new SavitzkyGolaySmoother(numberOfPoints, CONST_POLYNOMIAL_ORDER, false);

            foreach (var feature in features)
            {
                var map = feature.CreateChargeMap();

                // Clear the MS Feature List
                // Because we're going to refine each charge state then fix the length of the feature
                // from it's known max abundance value.
                feature.MsFeatures.Clear();


                // Work on a single charge state since XIC's have different m/z values
                foreach (var chargeFeatures in map.Values)
                {
                    var xic        = new List <XYData>();
                    var msFeatures = chargeFeatures.Where(x => x.Abundance > 0).OrderBy(x => x.Scan).ToList();
                    msFeatures.ForEach(x => xic.Add(new XYData(x.Scan, x.Abundance)));

                    var points = smoother.Smooth(xic);
                    if (msFeatures.Count <= 0)
                    {
                        continue;
                    }

                    // Find the biggest peak...
                    var    maxScanIndex = 0;
                    double maxAbundance = 0;
                    for (var i = 0; i < msFeatures.Count; i++)
                    {
                        msFeatures[i].Abundance = Convert.ToInt64(points[i].Y);

                        if (maxAbundance < msFeatures[i].Abundance)
                        {
                            maxScanIndex = i;
                            maxAbundance = msFeatures[i].Abundance;
                        }
                    }

                    // Then find when the feature goes to zero
                    // Start from max to left
                    var startIndex = maxScanIndex;

                    // If we hit zero, then keep
                    for (; startIndex > 0; startIndex--)
                    {
                        if (msFeatures[startIndex].Abundance < 1)
                        {
                            break;
                        }
                    }

                    // Start from max to right
                    var stopIndex = maxScanIndex;
                    for (; stopIndex < msFeatures.Count - 1; stopIndex++)
                    {
                        if (msFeatures[stopIndex].Abundance < 1)
                        {
                            break;
                        }
                    }

                    // Add the features back
                    for (var i = startIndex; i <= stopIndex; i++)
                    {
                        msFeatures[i].Abundance = Convert.ToInt64(points[i].Y);
                        feature.AddChildFeature(msFeatures[i]);
                    }
                }

                // Clean up
            }
            return(features.Where(x => x.MsFeatures.Count > 0).ToList());
        }
Exemplo n.º 18
0
        public void TestFragmentCorrelation()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    parentMz     = 643.27094937;
            double ppmTolerance = 50;

            var parentIntensityBlock = uimfUtil.GetXicAsArray(parentMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref parentIntensityBlock);

            // ReSharper disable RedundantArgumentDefaultValue
            var parentPointList = WaterShedMapUtil.BuildWatershedMap(parentIntensityBlock, 0, 0);
            // ReSharper restore RedundantArgumentDefaultValue

            var parentFeature = FeatureDetection.DoWatershedAlgorithm(parentPointList).First();

            using (var fragmentReader = new StreamReader(@"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\testFiles\fragments.csv"))
            {
                while (!fragmentReader.EndOfStream)
                {
                    var dataLine = fragmentReader.ReadLine();
                    if (string.IsNullOrWhiteSpace(dataLine))
                    {
                        continue;
                    }

                    var mzString = dataLine.Trim();
                    var targetMz = double.Parse(mzString);

                    TextWriter unsmoothedWriter = new StreamWriter("unsmoothedRaw" + targetMz + ".csv");

                    var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS2, DataReader.ToleranceType.PPM);

                    var boundX = intensityBlock.GetUpperBound(0);
                    var boundY = intensityBlock.GetUpperBound(1);

                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        unsmoothedWriter.WriteLine(row.ToString());
                    }

                    unsmoothedWriter.Close();

                    smoother.Smooth(ref intensityBlock);

                    TextWriter smoothedWriter = new StreamWriter("smoothedRaw" + targetMz + ".csv");
                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        smoothedWriter.WriteLine(row.ToString());
                    }

                    smoothedWriter.Close();

                    // ReSharper disable RedundantArgumentDefaultValue
                    var pointList = WaterShedMapUtil.BuildWatershedMap(intensityBlock, 0, 0);
                    // ReSharper restore RedundantArgumentDefaultValue

                    var featureList = FeatureDetection.DoWatershedAlgorithm(pointList);

                    featureList = featureList.Where(x => x.PointList.Count > 50).OrderByDescending(x => x.PointList.Count);

                    Console.WriteLine("******************************************************");
                    Console.WriteLine("targetMz = " + targetMz);

                    foreach (var featureBlob in featureList)
                    {
                        // ReSharper disable once UnusedVariable
                        var rSquared = FeatureCorrelator.CorrelateFeatures(parentFeature, featureBlob);

                        //Point mostIntensePoint = featureBlob.PointList.OrderByDescending(x => x.Intensity).First();
                        //Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity + "\tRSquared = " + rSquared);
                    }
                }
            }
        }
Exemplo n.º 19
0
        public void TestDoWaterShedAlgorithmPrecursorAndFragments()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    parentMz     = 643.27094937;
            double ppmTolerance = 50;

            var parentIntensityBlock = uimfUtil.GetXicAsArray(parentMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref parentIntensityBlock);

            // ReSharper disable RedundantArgumentDefaultValue
            var parentPointList = WaterShedMapUtil.BuildWatershedMap(parentIntensityBlock, 0, 0);
            // ReSharper restore RedundantArgumentDefaultValue

            var parentFeature = FeatureDetection.DoWatershedAlgorithm(parentPointList).First();

            var statistics = parentFeature.Statistics;
            var scanLcMin  = statistics.ScanLcMin;
            var scanLcMax  = statistics.ScanLcMax;
            var scanImsMin = statistics.ScanImsMin;
            var scanImsMax = statistics.ScanImsMax;

            using (var fragmentReader = new StreamReader(@"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\testFiles\OneFragment.csv"))
            {
                while (!fragmentReader.EndOfStream)
                {
                    var dataLine = fragmentReader.ReadLine();
                    if (string.IsNullOrWhiteSpace(dataLine))
                    {
                        continue;
                    }

                    var mzString = dataLine.Trim();
                    var targetMz = double.Parse(mzString);

                    TextWriter unsmoothedWriter = new StreamWriter("unsmoothedRaw" + targetMz + ".csv");

                    var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS2, scanLcMin, scanLcMax, scanImsMin, scanImsMax, DataReader.ToleranceType.PPM);

                    var boundX = intensityBlock.GetUpperBound(0);
                    var boundY = intensityBlock.GetUpperBound(1);

                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        unsmoothedWriter.WriteLine(row.ToString());
                    }

                    unsmoothedWriter.Close();

                    smoother.Smooth(ref intensityBlock);

                    TextWriter smoothedWriter = new StreamWriter("smoothedRaw" + targetMz + ".csv");
                    for (var i = 0; i < boundX; i++)
                    {
                        var row = new StringBuilder();
                        for (var j = 0; j < boundY; j++)
                        {
                            row.Append(intensityBlock[i, j] + ",");
                        }
                        smoothedWriter.WriteLine(row.ToString());
                    }

                    smoothedWriter.Close();

                    var pointList   = WaterShedMapUtil.BuildWatershedMap(intensityBlock, scanLcMin, scanImsMin).ToList();
                    var featureList = FeatureDetection.DoWatershedAlgorithm(pointList).ToList();

                    Assert.AreEqual(430, pointList.Count);
                    Assert.AreEqual(37, featureList.Count);

                    Console.WriteLine("******************************************************");
                    Console.WriteLine("targetMz = " + targetMz);

                    for (var i = 0; i < featureList.Count; i++)
                    {
                        var featureBlob      = featureList[i];
                        var mostIntensePoint = featureBlob.PointList.OrderByDescending(x => x.Intensity).First();
                        Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
                        if (i != 1)
                        {
                            continue;
                        }

                        // Num Points = 34	LC = 138	IMS = 122	Intensity = 79.5697959183673
                        Assert.AreEqual(34, featureBlob.PointList.Count);
                        Assert.AreEqual(138, mostIntensePoint.ScanLc);
                        Assert.AreEqual(122, mostIntensePoint.ScanIms);
                        Assert.AreEqual(79.569796, mostIntensePoint.Intensity, 0.0001);
                    }
                }
            }
        }
Exemplo n.º 20
0
        public void TestDoWaterShedAlgorithmOutput()
        {
            var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF";
            var uimfUtil     = new UimfUtil(fileLocation);

            var    targetMz     = 643.27094937;
            double ppmTolerance = 50;

            TextWriter unsmoothedWriter = new StreamWriter("unsmoothedRaw.csv");

            var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);

            var boundX = intensityBlock.GetUpperBound(0);
            var boundY = intensityBlock.GetUpperBound(1);

            for (var i = 0; i < boundX; i++)
            {
                var row = new StringBuilder();
                for (var j = 0; j < boundY; j++)
                {
                    row.Append(intensityBlock[i, j] + ",");
                }
                unsmoothedWriter.WriteLine(row.ToString());
            }

            unsmoothedWriter.Close();

            var smoother = new SavitzkyGolaySmoother(5, 2);

            smoother.Smooth(ref intensityBlock);

            TextWriter smoothedWriter = new StreamWriter("smoothedRaw.csv");

            for (var i = 0; i < boundX; i++)
            {
                var row = new StringBuilder();
                for (var j = 0; j < boundY; j++)
                {
                    row.Append(intensityBlock[i, j] + ",");
                }
                smoothedWriter.WriteLine(row.ToString());
            }

            smoothedWriter.Close();

            var pointList   = WaterShedMapUtil.BuildWatershedMap(intensityBlock, 0, 0);
            var featureList = FeatureDetection.DoWatershedAlgorithm(pointList).ToList();

            Console.WriteLine(featureList.Count);

            var sortedFeatureList = featureList.OrderByDescending(x => x.PointList.Count);

            TextWriter intensityWriter = new StreamWriter("intensities.csv");

            foreach (var featureBlob in sortedFeatureList)
            {
                var mostIntensePoint = featureBlob.PointList.First();
                Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity);
                intensityWriter.WriteLine(mostIntensePoint.Intensity.ToString(CultureInfo.InvariantCulture));
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Get the nearest intensity peak to the provided scan number
        /// </summary>
        /// <param name="scanNumber"></param>
        /// <param name="performSmoothing"></param>
        /// <returns></returns>
        public int GetNearestApexScanNum(int scanNumber, bool performSmoothing = true)
        {
            // If there are not very many points, just return the global apex
            if (Count < 6)
            {
                return(GetApexScanNum());
            }

            var xicPointList = new List <XicPoint>();

            if (performSmoothing)
            {
                double[] intensityValues = this.Select(x => x.Intensity).ToArray();
                intensityValues = Smoother.Smooth(intensityValues);

                for (var i = 0; i < Count; i++)
                {
                    xicPointList.Add(new XicPoint(this[i].ScanNum, this[i].Mz, intensityValues[i]));
                }
            }
            else
            {
                xicPointList = this;
            }

            // Find the XIC Point that is closest to the input scan number
            var searchPoint        = new XicPoint(scanNumber, 0, 0);
            int indexOfClosestScan = xicPointList.BinarySearch(searchPoint, new AnonymousComparer <XicPoint>((x, y) => x.ScanNum.CompareTo(y.ScanNum)));

            indexOfClosestScan = indexOfClosestScan < 0 ? ~indexOfClosestScan : indexOfClosestScan;
            if (indexOfClosestScan >= xicPointList.Count)
            {
                indexOfClosestScan = xicPointList.Count - 1;
            }
            XicPoint closestXicPoint = xicPointList[indexOfClosestScan];

            // Figure out if we want to search for an apex by moving left or right
            bool moveRight;

            if (indexOfClosestScan <= 1)
            {
                moveRight = true;
            }
            else if (indexOfClosestScan >= xicPointList.Count - 2)
            {
                moveRight = false;
            }
            else if (xicPointList[indexOfClosestScan + 1].Intensity > closestXicPoint.Intensity)
            {
                moveRight = true;
            }
            else
            {
                moveRight = false;
            }

            // Check to the right
            if (moveRight)
            {
                if (indexOfClosestScan + 1 >= xicPointList.Count)
                {
                    return(GetApexScanNum());
                }
                double previousIntensity = xicPointList[indexOfClosestScan + 1].Intensity;

                for (int i = indexOfClosestScan + 2; i < xicPointList.Count; i++)
                {
                    double currentIntensity = xicPointList[i].Intensity;
                    if (currentIntensity < previousIntensity)
                    {
                        return(xicPointList[i - 1].ScanNum);
                    }
                    previousIntensity = currentIntensity;
                }
            }
            // Check to the left
            else
            {
                if (indexOfClosestScan - 1 < 0)
                {
                    return(GetApexScanNum());
                }
                double previousIntensity = this[indexOfClosestScan - 1].Intensity;

                for (int i = indexOfClosestScan - 2; i >= 0; i--)
                {
                    double currentIntensity = this[i].Intensity;
                    if (currentIntensity < previousIntensity)
                    {
                        return(this[i + 1].ScanNum);
                    }
                    previousIntensity = currentIntensity;
                }
            }

            // I don't think it is possible, but if we make it this far, then we should just return the apex of the whole XIC because a single peak was not discovered
            return(GetApexScanNum());
        }
        private void FindFeatures()
        {
            m_FeatureFinderBackgroundWorker.ReportProgress(0, "Finding 3-D Features for Precursor and Fragments");

            var seqGraph = SequenceGraph.CreateGraph(m_aminoAcidSet, CurrentPeptide);
            // var scoringGraph = seqGraph.GetScoringGraph(0);
            // var precursorIon = scoringGraph.GetPrecursorIon(this.CurrentChargeState);
            // var monoMz = precursorIon.GetMz();

            var sequence     = new Sequence(CurrentPeptide, m_aminoAcidSet);
            var precursorIon = sequence.GetPrecursorIon(CurrentChargeState);
            var monoMz       = precursorIon.GetMonoIsotopicMz();

            var uimfPointList      = UimfUtil.GetXic(monoMz, CurrentTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);
            var watershedPointList = WaterShedMapUtil.BuildWatershedMap(uimfPointList);

            var smoother = new SavitzkyGolaySmoother(11, 2);

            smoother.Smooth(ref watershedPointList);

            FeatureList = FeatureDetection.DoWatershedAlgorithm(watershedPointList).ToList();

            IsotopeFeaturesDictionary.Clear();
            var precursorTargetList = CurrentChargeState == 2 ? new List <string> {
                "-1", "0.5", "1", "1.5", "2", "3"
            } : new List <string> {
                "-1", "1", "2", "3"
            };

            foreach (var precursorTarget in precursorTargetList)
            {
                var targetMz = precursorIon.GetIsotopeMz(double.Parse(precursorTarget));

                var isotopeUimfPointList      = UimfUtil.GetXic(targetMz, CurrentTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM);
                var isotopeWatershedPointList = WaterShedMapUtil.BuildWatershedMap(isotopeUimfPointList);

                var isotopeFeatures = FeatureDetection.DoWatershedAlgorithm(isotopeWatershedPointList).ToList();
                IsotopeFeaturesDictionary.Add(precursorTarget, isotopeFeatures);
            }

            LcSlicePlot  = new PlotModel();
            ImsSlicePlot = new PlotModel();

            FragmentFeaturesDictionary.Clear();
            // var sequence = new Sequence(this.CurrentPeptide, m_aminoAcidSet);
            var ionTypeDictionary = sequence.GetProductIons(m_ionTypeFactory.GetAllKnownIonTypes());

            double fragmentCount = ionTypeDictionary.Count;
            var    index         = 0;

            foreach (var ionTypeKvp in ionTypeDictionary)
            {
                var ionTypeTuple = ionTypeKvp.Key;

                var ion        = ionTypeKvp.Value;
                var fragmentMz = ion.GetMonoIsotopicMz();

                uimfPointList      = UimfUtil.GetXic(fragmentMz, CurrentTolerance, UIMFData.FrameType.MS2, DataReader.ToleranceType.PPM);
                watershedPointList = WaterShedMapUtil.BuildWatershedMap(uimfPointList);
                smoother.Smooth(ref watershedPointList);

                var fragmentFeatureBlobList = FeatureDetection.DoWatershedAlgorithm(watershedPointList).ToList();
                FragmentFeaturesDictionary.Add(ionTypeTuple, fragmentFeatureBlobList);

                index++;
                var progress = (int)((index / fragmentCount) * 100);
                m_FeatureFinderBackgroundWorker.ReportProgress(progress);
            }

            OnPropertyChanged("FeatureList");
            OnPropertyChanged("LcSlicePlot");
            OnPropertyChanged("ImsSlicePlot");
        }
Exemplo n.º 23
0
        protected virtual void ExecuteWorkflow(IqResult result)
        {
            result.Target.TheorIsotopicProfile = TheorFeatureGen.GenerateTheorProfile(result.Target.EmpiricalFormula, result.Target.ChargeState);

            result.IqResultDetail.Chromatogram = ChromGen.GenerateChromatogram(Run, result.Target.TheorIsotopicProfile, result.Target.ElutionTimeTheor);

            result.IqResultDetail.Chromatogram = ChromSmoother.Smooth(result.IqResultDetail.Chromatogram);

            result.ChromPeakList = ChromPeakDetector.FindPeaks(result.IqResultDetail.Chromatogram);

            ChromPeakDetector.CalculateElutionTimes(Run, result.ChromPeakList);

            ChromPeakDetector.FilterPeaksOnNET(WorkflowParameters.ChromNETTolerance, result.Target.ElutionTimeTheor, result.ChromPeakList);

            result.IqResultDetail.ChromPeakQualityData = ChromPeakAnalyzer.GetChromPeakQualityData(Run, result.Target, result.ChromPeakList);

            var filterOutFlagged = result.Target.TheorIsotopicProfile.GetIndexOfMostIntensePeak() == 0;

            result.ChromPeakSelected = ChromPeakSelector.SelectBestPeak(result.IqResultDetail.ChromPeakQualityData, filterOutFlagged);


            result.LCScanSetSelected = ChromPeakUtilities.GetLCScanSetForChromPeak(result.ChromPeakSelected, Run,
                                                                                   WorkflowParameters.NumMSScansToSum);

            result.LcScanObs = result.LCScanSetSelected == null ? -1 : result.LCScanSetSelected.PrimaryScanNumber;

            result.IqResultDetail.MassSpectrum = MSGenerator.GenerateMS(Run, result.LCScanSetSelected);

            TrimData(result.IqResultDetail.MassSpectrum, result.Target.MZTheor, MsLeftTrimAmount, MsRightTrimAmount);

            List <Peak> mspeakList;

            result.ObservedIsotopicProfile = MsfeatureFinder.IterativelyFindMSFeature(result.IqResultDetail.MassSpectrum, result.Target.TheorIsotopicProfile, out mspeakList);


            result.FitScore = FitScoreCalc.CalculateFitScore(result.Target.TheorIsotopicProfile, result.ObservedIsotopicProfile,
                                                             result.IqResultDetail.MassSpectrum);

            result.InterferenceScore = InterferenceScorer.GetInterferenceScore(result.ObservedIsotopicProfile, mspeakList);

            //if (_workflowParameters.ChromatogramCorrelationIsPerformed)
            //{
            //    ExecuteTask(_chromatogramCorrelator);
            //}

            result.MonoMassObs = result.ObservedIsotopicProfile == null ? 0 : result.ObservedIsotopicProfile.MonoIsotopicMass;

            result.MZObs = result.ObservedIsotopicProfile == null ? 0 : result.ObservedIsotopicProfile.MonoPeakMZ;

            result.MZObsCalibrated       = result.ObservedIsotopicProfile == null ? 0 : Run.GetAlignedMZ(result.ObservedIsotopicProfile.MonoPeakMZ, result.LcScanObs);
            result.MonoMassObsCalibrated = result.ObservedIsotopicProfile == null
                                               ? 0
                                               : (result.MZObsCalibrated - DeconTools.Backend.Globals.PROTON_MASS) * result.Target.ChargeState;


            var elutionTime = result.ChromPeakSelected == null ? 0d : ((ChromPeak)result.ChromPeakSelected).NETValue;

            result.ElutionTimeObs = elutionTime;

            result.Abundance = GetAbundance(result);
        }