Пример #1
0
 public PeakTransitionGroupFeatures(PeakTransitionGroupId id, IList <PeakGroupFeatures> peakGroupFeatures, bool verbose) : this()
 {
     Key               = id.Key;
     IsDecoy           = id.IsDecoy;
     PeakGroupFeatures = peakGroupFeatures;
     if (verbose)
     {
         Id = id;    // Avoid holding this in memory unless required for verbose output
     }
 }
Пример #2
0
 public PeakTransitionGroupFeatures(PeakTransitionGroupId id, IList <PeakGroupFeatures> peakGroupFeatures)
 {
     Id = id;
     PeakGroupFeatures = peakGroupFeatures;
 }
Пример #3
0
        private static IEnumerable <PeakTransitionGroupFeatures> GetPeakFeatures(this SrmDocument document,
                                                                                 PeptideGroupDocNode nodePepGroup,
                                                                                 PeptideDocNode nodePep,
                                                                                 IsotopeLabelType labelType,
                                                                                 IList <TransitionGroupDocNode> nodeGroups,
                                                                                 IList <IPeakFeatureCalculator> calcs,
                                                                                 IDictionary <int, int> runEnumDict,
                                                                                 bool verbose)
        {
            var   chromatograms    = document.Settings.MeasuredResults.Chromatograms;
            float mzMatchTolerance = (float)document.Settings.TransitionSettings.Instrument.MzMatchTolerance;

            foreach (var chromatogramSet in chromatograms)
            {
                ChromatogramGroupInfo[] arrayChromInfo;
                if (!document.Settings.MeasuredResults.TryLoadChromatogram(chromatogramSet, nodePep, nodeGroups[0],
                                                                           mzMatchTolerance, false, out arrayChromInfo))
                {
                    continue;
                }

                foreach (var chromGroupInfo in arrayChromInfo)
                {
                    var peakId          = new PeakTransitionGroupId(nodePepGroup, nodePep, labelType, chromatogramSet, chromGroupInfo, runEnumDict);
                    var listRunFeatures = new List <PeakGroupFeatures>();

                    var summaryPeakData = new SummaryPeptidePeakData(document, nodePep, nodeGroups, chromatogramSet, chromGroupInfo);
                    var context         = new PeakScoringContext(document);

                    while (summaryPeakData.NextPeakIndex())
                    {
                        if (!summaryPeakData.HasArea)
                        {
                            continue;
                        }

                        var features = new float[calcs.Count];

                        for (int i = 0; i < calcs.Count; i++)
                        {
                            features[i] = summaryPeakData.GetScore(context, calcs[i]);
                        }

                        // CONSIDER: Peak features can take up a lot of space in large scale DIA
                        //           It may be possible to save even more by using a smaller struct
                        //           when times are not required, which they are only for export
                        float retentionTime = 0, startTime = 0, endTime = 0;
                        if (verbose)
                        {
                            var peakTimes = summaryPeakData.RetentionTimeStatistics;
                            retentionTime = peakTimes.RetentionTime;
                            startTime     = peakTimes.StartTime;
                            endTime       = peakTimes.EndTime;
                        }
                        int peakIndex = summaryPeakData.UsedBestPeakIndex
                            ? summaryPeakData.BestPeakIndex
                            : summaryPeakData.PeakIndex;
                        listRunFeatures.Add(new PeakGroupFeatures(peakIndex, retentionTime, startTime, endTime, features));
                    }

                    yield return(new PeakTransitionGroupFeatures(peakId, listRunFeatures.ToArray(), verbose));
                }
            }
        }
Пример #4
0
        private static IEnumerable <PeakTransitionGroupFeatures> GetPeakFeatures(this SrmDocument document,
                                                                                 PeptideGroupDocNode nodePepGroup,
                                                                                 PeptideDocNode nodePep,
                                                                                 IsotopeLabelType labelType,
                                                                                 IList <TransitionGroupDocNode> nodeGroups,
                                                                                 IList <IPeakFeatureCalculator> calcs,
                                                                                 IDictionary <int, int> runEnumDict,
                                                                                 bool includeMzFilters)
        {
            var   chromatograms    = document.Settings.MeasuredResults.Chromatograms;
            float mzMatchTolerance = (float)document.Settings.TransitionSettings.Instrument.MzMatchTolerance;

            foreach (var chromatogramSet in chromatograms)
            {
                ChromatogramGroupInfo[] arrayChromInfo;
                if (!document.Settings.MeasuredResults.TryLoadChromatogram(chromatogramSet, nodePep, nodeGroups[0],
                                                                           mzMatchTolerance, false, out arrayChromInfo))
                {
                    continue;
                }

                foreach (var chromGroupInfo in arrayChromInfo)
                {
                    var peakId          = new PeakTransitionGroupId(nodePepGroup, nodePep, labelType, chromatogramSet, chromGroupInfo, runEnumDict);
                    var listRunFeatures = new List <PeakGroupFeatures>();

                    var summaryPeakData = new SummaryPeptidePeakData(document, nodePep, nodeGroups, chromatogramSet, chromGroupInfo);
                    var context         = new PeakScoringContext(document);

                    while (summaryPeakData.NextPeakIndex())
                    {
                        if (!summaryPeakData.HasArea)
                        {
                            continue;
                        }

                        var features = new float[calcs.Count];

                        for (int i = 0; i < calcs.Count; i++)
                        {
                            features[i] = summaryPeakData.GetScore(context, calcs[i]);
                        }

                        MzFilterPairs[] mzFilters = null;
                        if (includeMzFilters)
                        {
                            mzFilters = summaryPeakData.GetMzFilters(context);
                        }

                        float retentionTime  = summaryPeakData.RetentionTime;
                        float startTime      = summaryPeakData.StartTime;
                        float endTime        = summaryPeakData.EndTime;
                        bool  isMaxPeakIndex = summaryPeakData.IsMaxPeakIndex;
                        listRunFeatures.Add(new PeakGroupFeatures(summaryPeakData.PeakIndex, retentionTime, startTime, endTime,
                                                                  isMaxPeakIndex, features, mzFilters));
                    }

                    yield return(new PeakTransitionGroupFeatures(peakId, listRunFeatures.ToArray()));
                }
            }
        }