Ejemplo n.º 1
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);
        }
        public void MyTestInitialize()
        {
            mockDataProvider = new Mock<IDataProvider>();
            mockEventAggregator = new Mock<IEventAggregator>();

            outputEvent = new OutputEvent();
            mockEventAggregator.Setup(mock => mock.GetEvent<OutputEvent>()).Returns(outputEvent);
            spectralPeakDetection = new SpectralPeakDetection(mockEventAggregator.Object);
        }