Exemplo n.º 1
0
        public LabelAmountAlgorithm(
			IEventAggregator eventAggregator,
			IXicSelection xicSelection,
			IChromatographicPeakDetection chromatographicPeakDetection,
			XicPeakPicker xicPeakPicker,
			ISpectrumSelection spectrumSelection,
			ISpectralPeakDetection spectralPeakDetection,
			IsotopicProfileFinder isotopicProfileFinder,
			LabelAmountCalculator labelAmountCalculator,
			ISmoothing xicSmoothing,
			ISmoothing spectrumSmoothing,
			DeuterationResultGenerator deuterationResultGenerator,
			IServiceLocator serviceLocator)
            : base()
        {
            _eventAggregator = eventAggregator;
            _xicSelection = xicSelection;
            _chromatographicPeakDetection = chromatographicPeakDetection;
            _spectrumSelection = spectrumSelection;
            _spectralPeakDetection = spectralPeakDetection;
            _xicPeakPicker = xicPeakPicker;
            _isotopicProfileFinder = isotopicProfileFinder;
            _labelAmountCalculator = labelAmountCalculator;
            _xicSmoothing = xicSmoothing;
            _spectrumSmoothing = spectrumSmoothing;
            _deuterationResultGenerator = deuterationResultGenerator;
            _serviceLocator = serviceLocator;

            ProcessingSteps.Add(_xicSelection);
            ProcessingSteps.Add(_xicSmoothing);
            ProcessingSteps.Add(_chromatographicPeakDetection);
            ProcessingSteps.Add(_xicPeakPicker);
            ProcessingSteps.Add(_spectrumSelection);
            ProcessingSteps.Add(_spectrumSmoothing);
            ProcessingSteps.Add(_spectralPeakDetection);
            ProcessingSteps.Add(_isotopicProfileFinder);
            ProcessingSteps.Add(_labelAmountCalculator);
        }
        public void MyTestInitialize()
        {
            mockEventAggregator = new Mock<IEventAggregator>();

            outputEvent = new OutputEvent();
            mockEventAggregator.Setup(mock => mock.GetEvent<OutputEvent>()).Returns(outputEvent);
            isotopicProfileFinder = new IsotopicProfileFinder(mockEventAggregator.Object);
            isotopicProfileFinder.PeakWidthMaximum = 0.5;
            isotopicProfileFinder.MSPeakSelectionOption = Hydra.Core.MSPeakSelectionOption.MostIntenseWithinMzVariation;
        }
Exemplo n.º 3
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()
        {
            Initialize();

            IsotopicProfileFinder finder = new IsotopicProfileFinder(MockEventAggregator.Object);
            finder.PeakWidthMaximum = 0.5;
            finder.MSPeakSelectionOption = Hydra.Core.MSPeakSelectionOption.MostIntenseWithinMzVariation;

            labelAmountCalculator = new LabelAmountAlgorithm(
                MockEventAggregator.Object,
                new XicSelection(MockEventAggregator.Object, MockRegionManager.Object),
                new ChromatographicPeakDetection(MockEventAggregator.Object),
                new XicPeakPicker(MockEventAggregator.Object),
                new SpectrumSelection(MockEventAggregator.Object, MockRegionManager.Object),
                new SpectralPeakDetection(MockEventAggregator.Object),
                finder,
                new LabelAmountCalculator(MockEventAggregator.Object),
                new SavitzkyGolaySmoothing(MockEventAggregator.Object, MockRegionManager.Object),
                new SavitzkyGolaySmoothing(MockEventAggregator.Object, MockRegionManager.Object),
                new DeuterationResultGenerator(MockEventAggregator.Object),
                MockServiceLocator.Object);
        }