Example #1
0
        private void GenerateResults(
            IEnumerable <HornTransformResults> transformResults,
            ThrashV1Peak[] mspeakList,
            ResultCollection resultList,
            bool processingWasAborted,
            int maxProcessingTimeMinutes)
        {
            ScanSet currentScanset;
            var     currentRun = resultList.Run as UIMFRun;
            bool    processingUIMF;

            if (currentRun != null)
            {
                currentScanset = currentRun.CurrentIMSScanSet;
                processingUIMF = true;
            }
            else
            {
                currentScanset = resultList.Run.CurrentScanSet;
                processingUIMF = false;
            }

            currentScanset.NumIsotopicProfiles = 0; //reset to 0;

            foreach (var hornResult in transformResults)
            {
                var result  = resultList.CreateIsosResult();
                var profile = new IsotopicProfile
                {
                    AverageMass             = hornResult.AverageMw,
                    ChargeState             = hornResult.ChargeState,
                    MonoIsotopicMass        = hornResult.MonoMw,
                    Score                   = hornResult.Fit,
                    ScoreCountBasis         = hornResult.FitCountBasis,
                    MostAbundantIsotopeMass = hornResult.MostIntenseMw
                };

                GetIsotopicProfile(hornResult.IsotopePeakIndices, mspeakList, ref profile);

                profile.IntensityMostAbundant      = (float)hornResult.Abundance;
                profile.IntensityMostAbundantTheor = (float)hornResult.Abundance;

                if (NumPeaksUsedInAbundance == 1) // fyi... this is typical
                {
                    result.IntensityAggregate = profile.IntensityMostAbundant;
                }
                else
                {
                    result.IntensityAggregate = SumPeaks(profile, hornResult.Abundance);
                }

                profile.MonoPlusTwoAbundance = profile.GetMonoPlusTwoAbundance();
                profile.MonoPeakMZ           = profile.GetMZ();

                result.IsotopicProfile = profile;

                AddDeconResult(resultList, result, DeconResultComboMode.simplyAddIt);
                //resultList.ResultList.Add(result);
                currentScanset.NumIsotopicProfiles++;
            }


            if (!processingWasAborted)
            {
                return;
            }

            string messageBase;

            if (processingUIMF)
            {
                // LC-IMS-MS dataset
                if (currentScanset.GetScanCount() <= 1)
                {
                    messageBase = string.Format("Aborted processing of frame {0}, IMS scan {1}",
                                                currentScanset.PrimaryScanNumber,
                                                currentScanset.getLowestScanNumber());
                }
                else
                {
                    messageBase = string.Format("Aborted processing of frame {0}, IMS scans {1}-{2}",
                                                currentScanset.PrimaryScanNumber,
                                                currentScanset.getLowestScanNumber(),
                                                currentScanset.getHighestScanNumber());
                }
            }
            else
            {
                // LC-MS dataset
                if (currentScanset.GetScanCount() <= 1)
                {
                    messageBase = string.Format("Aborted processing of scan {0}",
                                                currentScanset.getLowestScanNumber());
                }
                else
                {
                    messageBase = string.Format("Aborted processing of summed scans {0}-{1}",
                                                currentScanset.getLowestScanNumber(),
                                                currentScanset.getHighestScanNumber());
                }
            }

            Console.WriteLine("{0}; runtime exceeded {1} minutes. IsotopicProfileCount={2}",
                              messageBase,
                              maxProcessingTimeMinutes,
                              currentScanset.NumIsotopicProfiles);
        }