Exemple #1
0
        /// <summary>
        /// ChargeStateChildTopDownIqWorkflow
        /// Generates theoretical isotopic profile, XIC, and creates ChromPeakIqTargets based on peaks found
        /// </summary>
        /// <param name="result"></param>
        protected override void ExecuteWorkflow(IqResult result)
        {
            //Generate theoretical isotopic profile
            result.Target.TheorIsotopicProfile = TheorFeatureGen.GenerateTheorProfile(result.Target.EmpiricalFormula, result.Target.ChargeState);

            if (!Parser.CheckSequenceIntegrity(result.Target.Code))
            {
                ShiftIsotopicProfile(result.Target.TheorIsotopicProfile, result.Target.MonoMassTheor, result.Target.ChargeState);
            }

            //Generate XIC and smooth
            result.IqResultDetail.Chromatogram = ChromGen.GenerateChromatogram(Run, result.Target.TheorIsotopicProfile, result.Target.ElutionTimeTheor);
            result.IqResultDetail.Chromatogram = ChromSmoother.Smooth(result.IqResultDetail.Chromatogram);

            //Look for peaks in XIC
            result.ChromPeakList = ChromPeakDetector.FindPeaks(result.IqResultDetail.Chromatogram);
            ChromPeakDetector.CalculateElutionTimes(Run, result.ChromPeakList);
            ChromPeakDetector.FilterPeaksOnNET(WorkflowParameters.ChromNETTolerance, result.Target.ElutionTimeTheor, result.ChromPeakList);

            var tempMinScanWithinTol = (int)Run.NetAlignmentInfo.GetScanForNet(result.Target.ElutionTimeTheor - WorkflowParameters.ChromNETTolerance);
            var tempMaxScanWithinTol = (int)Run.NetAlignmentInfo.GetScanForNet(result.Target.ElutionTimeTheor + WorkflowParameters.ChromNETTolerance);
            var tempCenterTol        = (int)Run.NetAlignmentInfo.GetScanForNet(result.Target.ElutionTimeTheor);

            result.NumChromPeaksWithinTolerance = result.ChromPeakList.Count;

            //General peak information output written to console.
            Console.WriteLine("SmartPeakSelector --> NETTolerance= " + WorkflowParameters.ChromNETTolerance + ";  chromMinCenterMax= " +
                              tempMinScanWithinTol + "\t" + tempCenterTol + "" +
                              "\t" + tempMaxScanWithinTol);
            Console.WriteLine("MT= " + result.Target.ID + ";z= " + result.Target.ChargeState + "; mz= " + result.Target.MZTheor.ToString("0.000") +
                              ";  ------------------------- PeaksWithinTol = " + result.ChromPeakList.Count);

            //Creates a ChromPeakIqTarget for each peak found
            foreach (ChromPeak peak in result.ChromPeakList)
            {
                var target = new ChromPeakIqTarget(new ChromPeakAnalyzerIqWorkflow(Run, WorkflowParameters));
                TargetUtilities.CopyTargetProperties(result.Target, target, false);
                target.ChromPeak = peak;
                result.Target.AddTarget(target);
            }

            //Executes each grandchild ChromPeakAnalyzerIqWorkflow
            var children = result.Target.ChildTargets();

            foreach (var child in children)
            {
                child.DoWorkflow();
            }

            if (Utilities.SipperDataDump.OutputResults)
            {
                //Data Dump for use with Sipper
                children = result.Target.ChildTargets();
                foreach (var child in children)
                {
                    Utilities.SipperDataDump.DataDump(child, Run);
                }
            }
        }
        protected override void ExecuteWorkflow(IqResult result)
        {
            if (ChromPeakAnalyzerIqWorkflow == null)
            {
                InitializeChromPeakAnalyzerWorkflow();
            }

            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.NumChromPeaksWithinTolerance = result.ChromPeakList.Count;


            //Creates a ChromPeakIqTarget for each peak found
            foreach (ChromPeak peak in result.ChromPeakList)
            {
                var target = new ChromPeakIqTarget(ChromPeakAnalyzerIqWorkflow);
                TargetUtilities.CopyTargetProperties(result.Target, target, false);
                target.ChromPeak = peak;
                result.Target.AddTarget(target);
            }

            //Executes each grandchild ChromPeakAnalyzerIqWorkflow
            var children          = result.Target.ChildTargets();
            var targetRemovalList = new List <IqTarget>();

            foreach (var child in children)
            {
                child.DoWorkflow();

                /*
                 * //Selects grandchildren with extremely poor metric scores for removal
                 * IqResult childResult = child.GetResult();
                 * if ((childResult.FitScore >= .8) || (childResult.CorrelationData.RSquaredValsMedian <= .15))
                 * {
                 *  targetRemovalList.Add(child);
                 * }
                 */
            }

            /*
             * //Removes the poorly scoring grandchild ChromPeakIqTargets
             * foreach (IqTarget iqTarget in targetRemovalList)
             * {
             *  result.RemoveResult(iqTarget.GetResult());
             *  result.Target.RemoveTarget(iqTarget);
             * }
             */
        }
Exemple #3
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);
        }