Exemplo n.º 1
0
        public XicSelectionView(IXYData xyData)
        {
            InitializeComponent();

            graphView.LoadGraph("Time", "XIC", xyData.XValues, xyData.YValues);
            listView.ItemsSource = xyData.GetXYPairs();
        }
        public SpectrumSelectionView(IXYData xyData)
        {
            InitializeComponent();

            graphView.LoadGraph("m/z", "Spectrum", xyData.XValues, xyData.YValues);
            listView.ItemsSource = xyData.GetXYPairs();
        }
Exemplo n.º 3
0
 public static void AssertChromatogram(IXYData tic, int expectedDataPoints, Stopwatch timer, int minimumMillisecondsGenerationShouldTake, int maximumMillisecondsGenerationShouldTake)
 {
     Assert.AreEqual(expectedDataPoints, tic.XValues.Count);
     Assert.IsTrue(
         timer.ElapsedMilliseconds >= minimumMillisecondsGenerationShouldTake &&
         timer.ElapsedMilliseconds <= maximumMillisecondsGenerationShouldTake,
         "The TIC took " + timer.ElapsedMilliseconds + " which is outside of the acceptable performance range of (" + minimumMillisecondsGenerationShouldTake + " - " + maximumMillisecondsGenerationShouldTake + ")");
 }
Exemplo n.º 4
0
        public static void AssertXYData(IXYData xyData, double[] expectedXValues, double[] expectedYValues)
        {
            Assert.AreEqual(expectedXValues.Length, xyData.XValues.Count);
            Assert.AreEqual(expectedYValues.Length, xyData.YValues.Count);

            for (int i = 0; i < xyData.XValues.Count; i++)
            {
                Assert.AreEqual(expectedXValues[i], xyData.XValues[i]);
                Assert.AreEqual(expectedYValues[i], xyData.YValues[i]);
            }
        }
Exemplo n.º 5
0
 private void OnViewXIC(IXYData value)
 {
     ManagedContent view = _regionManager.FindExistingView("DocumentRegion", typeof(XicSelectionView), value.Title);
     if (view == null)
     {
         view = new XicSelectionView(value);
         view.Title = value.Title;
         _regionManager.AddToRegion("DocumentRegion", view);
     }
     view.Show();
     view.Activate();
 }
        public IList<ChromatographicPeak> Execute(IXYData xyData)
        {
            _output.Publish("     Chromatographic Peak Detection Started (PeakToBackgroundRatio=" + PeakToBackgroundRatio + ", SignalToNoiseThreshold=" + SignalToNoiseThreshold + ")");
            Decon2LS.Peaks.clsPeak[] peakList = GetDeconToolsPeaks(xyData);

            IList<ChromatographicPeak> peaks = new List<ChromatographicPeak>();
            foreach (Decon2LS.Peaks.clsPeak peak in peakList)
            {
                peaks.Add(ConvertDeconPeakToChromatographicPeak(peak));
                _output.Publish("     Peak Found: RT=" + peak.mdbl_mz + ", PeakHeight=" + peak.mdbl_intensity + ", PeakWidth=" + peak.mdbl_FWHM + ")");
            }
            _output.Publish("     " + peaks.Count + " peaks found.");
            return peaks;
        }
Exemplo n.º 7
0
        protected Decon2LS.Peaks.clsPeak[] GetDeconToolsPeaks(IXYData xyData)
        {
            float[] xData = ConvertDoubleArrayToFloat(xyData.XValues);
            float[] yData = ConvertDoubleArrayToFloat(xyData.YValues);

            Decon2LS.Peaks.clsPeakProcessor peakProcessor = new Decon2LS.Peaks.clsPeakProcessor();
            Decon2LS.Peaks.clsPeakProcessorParameters parameters = new Decon2LS.Peaks.clsPeakProcessorParameters();

            parameters.PeakBackgroundRatio = PeakToBackgroundRatio;
            parameters.SignalToNoiseThreshold = SignalToNoiseThreshold;
            parameters.PeakFitType = Decon2LS.Peaks.PEAK_FIT_TYPE.QUADRATIC;

            peakProcessor.SetOptions(parameters);
            Decon2LS.Peaks.clsPeak[] peakList = new Decon2LS.Peaks.clsPeak[1];
            peakProcessor.DiscoverPeaks(ref xData, ref yData, ref peakList, 0, float.MaxValue);
            return peakList;
        }
Exemplo n.º 8
0
        private void OnViewXIC(IXYData value)
        {
            if (value.Title.ToLower().Contains(" xic"))
            {
                XicSelectionView view = new XicSelectionView(value);
                view.Title = value.Title;

                _regionManager.AddToRegion("DocumentRegion", view);
                view.Activate();
            }
            else
            {
                SpectrumSelectionView view = new SpectrumSelectionView(value);
                view.Title = value.Title;

                _regionManager.AddToRegion("DocumentRegion", view);
                view.Activate();
            }
        }
Exemplo n.º 9
0
        public IXYData Execute(IXYData xyData)
        {
            if (Enabled && !executeDisabled)
            {
                _output.Publish("     Savitzky Golay Smoothing Started (LeftParam=" + LeftParam + ", RightParam=" + RightParam + ", Order=" + order + ")");
                float[] xvals = new float[xyData.XValues.Count];
                float[] yvals = new float[xyData.YValues.Count];

                xvals = xyData.XValues.Select(item => (float)item).ToArray();
                yvals = xyData.YValues.Select(item => (float)item).ToArray();

                DeconEngine.Utils.SavitzkyGolaySmooth(this.leftParam, this.rightParam, this.order, ref xvals, ref yvals);

                IXYData smoothedXYData = new XYData(xvals.Select(item => (double)item).ToList(), yvals.Select(item => (double)item).ToList());
                smoothedXYData.Title = "Smoothed " + xyData.Title;

                _clickableOutput.Publish(new ClickableOutputEvent()
                    {
                        Parameter = smoothedXYData,
                        Text = "     Smoothing completed",
                        Click = new DelegateCommand<IXYData>(OnViewXIC)
                    });
                return smoothedXYData;
            }
            return xyData;
        }
Exemplo n.º 10
0
 public static void AssertValue(IXYData xyData, int index, double expectedXValue, double expectedYValue)
 {
     Assert.AreEqual(expectedXValue, Math.Round(xyData.XValues[index], 10));
     Assert.AreEqual(expectedYValue, Math.Round(xyData.YValues[index], 10));
 }
Exemplo n.º 11
0
        public void Constructor()
        {
            xyData = new XYData(XYDataHelper.XValueTestSet2, XYDataHelper.YValueTestSet2);

            XYDataHelper.AssertXYData(xyData, XYDataHelper.XValueTestSet2, XYDataHelper.YValueTestSet2);
        }
Exemplo n.º 12
0
        public void Execute(RunResult result, IXYData msmsSpectrum)
        {
            output.Publish("     MSMS Fragment Analyzer");

            PeptideUtility pu = new PeptideUtility();

            if (result.IsResultBasedOnFragment)
            {
                pu.GetIsotopicProfileForFragmentIon(result, 20);
            }
            else
            {
                result.TheoreticalIsotopicPeakList = pu.GetIsotopicProfile(result.Peptide.Sequence, result.Peptide.ChargeState, true, 20, true, true, string.Empty);
            }

            Peptide peptide = new Peptide(result.FragmentIon.Sequence);
            peptide.MonoIsotopicMass = result.FragmentIon.MZ;
            peptide.ChargeState = result.FragmentIon.ChargeState;
            peptide.PeaksInCalculation = result.FragmentIon.PeaksInCalculation;
            peptide.MsThreshold = result.FragmentIon.MsThreshold;
            peptide.DeuteriumDistributionRightPadding = result.FragmentIon.DeutDistRightPadding;
            peptide.DeuteriumDistributionThreshold = result.FragmentIon.DeutDistThreshold;

            RunResult rr = new RunResult(peptide, result.Run);
            rr.IsResultBasedOnFragment = true;
            rr.FragmentIon = result.FragmentIon;
            rr.TheoreticalIsotopicPeakList = result.TheoreticalIsotopicPeakList;

            try
            {
                output.Publish("     Executing Spectral Peak Detection");
                SpectralPeakDetection mspeakDetector = new SpectralPeakDetection(eventAggregator);
                mspeakDetector.PeakToBackgroundRatio = _peakToBackgroundRatio;
                mspeakDetector.SignalToNoiseThreshold = _signalToNoiseThreshold;
                IList<MSPeak> peakList = mspeakDetector.Execute(msmsSpectrum);

                output.Publish("     Executing Isotopic Profile Finder");
                IsotopicProfileFinder profileFinder = new IsotopicProfileFinder(eventAggregator);
                profileFinder.IntensityThreshold = intensityThreshold;
                profileFinder.MassVariability = massVariability;
                profileFinder.MSPeakSelectionOption = _msPeakSelectionOption;
                profileFinder.PeakNumberMaximum = peakNumberMaximum;
                profileFinder.PeakWidthMaximum = peakWidthMaximum;
                profileFinder.PeakWidthMinimum = peakWidthMinimum;
                profileFinder.Execute(rr, peakList);

                output.Publish("     Executing Label Amount Calculator");
                LabelAmountCalculator labelAmountCalc = new LabelAmountCalculator(eventAggregator);
                labelAmountCalc.PeaksInCalcMode = PeaksInLabelCalculationMode.Manual;
                labelAmountCalc.Mode = Mode.CalculatedMassAndExperimentalIntensity;
                labelAmountCalc.Execute(rr);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            result.IsotopicPeakList = rr.IsotopicPeakList;
            output.Publish("     IsotopicPeakList Count=" + result.IsotopicPeakList.Count);
            result.AverageMass = rr.AverageMass;
            output.Publish("     AverageMass=" + result.AverageMass);
            result.TheoreticalAverageMass = MSUtility.GetAverageMassFromPeakList(result.TheoreticalIsotopicPeakList, result.ActualPeaksInCalculation);  // TODO: this is a bandaid solution
            output.Publish("     TheoreticalAverageMass=" + result.TheoreticalAverageMass);
            result.AmountDeut = rr.AmountDeut;
            output.Publish("     AmountDeut=" + result.AmountDeut);
            result.IsUsedInCalculations = rr.IsUsedInCalculations;
            output.Publish("     IsUsedInCalculations=" + result.IsUsedInCalculations);
            result.AmountDeutFromDeutDist = rr.AmountDeutFromDeutDist;
            output.Publish("     AmountDeutFromDeutDist=" + result.AmountDeutFromDeutDist);
        }
Exemplo n.º 13
0
 private void LoadXic()
 {
     _xyData = _run.GetExtractedIonChromatogram(_xicMass, _xicMass, _mzTolerance, TimeUnit.Seconds);
     _xyData.Title = "XIC (" + _xicMass.ToString("N4") + " mzTol=" + _mzTolerance + ") - " + Path.GetFileName(_run.FileName);
 }
Exemplo n.º 14
0
 private void LoadTic()
 {
     _xyData = _run.GetTotalIonChromatogram();
     _xyData.Title = "TIC - " + Path.GetFileName(_run.FileName);
 }
Exemplo n.º 15
0
 private void LoadSpectrum()
 {
     _xyData = _run.GetSpectrum(_startTime, _stopTime, _monoIsotopicMass - _mzLowerOffset, _monoIsotopicMass + _mzUpperOffset, 0);
     _xyData.Title = "MS (RT=" + _startTime.ToString("N2") + "-" + _stopTime.ToString("N2") + " Mass=" + _monoIsotopicMass.ToString("N4") + ") - " + Path.GetFileName(_run.FileName);
 }
Exemplo n.º 16
0
 public void MyTestInitialize()
 {
     xyData = new XYData(XYDataHelper.XValueTestSet1, XYDataHelper.YValueTestSet1);
 }
Exemplo n.º 17
0
 private void OnViewXIC(IXYData value)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 18
0
 public void Set(IXYData tic)
 {
     cache = tic;
 }