Пример #1
0
        /// <summary>
        /// Gets possible values for an annotation.
        /// </summary>
        public static IEnumerable <object> GetPossibleAnnotations(SrmDocument document, ReplicateValue replicateValue)
        {
            if (!document.Settings.HasResults || null == replicateValue)
            {
                return(new object[0]);
            }
            var annotationCalculator = new AnnotationCalculator(document);

            return(document.Settings.MeasuredResults.Chromatograms
                   .Select(chromSet => replicateValue.GetValue(annotationCalculator, chromSet)).Distinct()
                   .OrderBy(x => x, CollectionUtil.ColumnValueComparer));
        }
Пример #2
0
        /// <summary>
        /// Gets replicate indices for a specific grouping annotation and value.
        /// </summary>
        public static int[] GetReplicateIndices(SrmDocument document, ReplicateValue group, object groupValue)
        {
            var defaultResult = Enumerable.Range(0, document.Settings.MeasuredResults.Chromatograms.Count).ToArray();

            if (group == null)
            {
                return(defaultResult);
            }

            var annotationCalculator = new AnnotationCalculator(document);

            return(defaultResult.Where(i => Equals(groupValue,
                                                   group.GetValue(annotationCalculator, document.Settings.MeasuredResults.Chromatograms[i]))).ToArray());
        }
Пример #3
0
        public static SrmDocument ApplyPeak(SrmDocument doc, PeptideTreeNode nodePepTree, ref TransitionGroupDocNode nodeTranGroup,
                                            int resultsIndex, ChromFileInfoId resultsFile, bool subsequent, ReplicateValue groupBy, object groupByValue, ILongWaitBroker longWaitBroker)
        {
            nodeTranGroup = nodeTranGroup ?? PickTransitionGroup(doc, nodePepTree, resultsIndex);
            GetReferenceData(doc, nodePepTree.DocNode, nodeTranGroup, resultsIndex, resultsFile, out var referenceTarget, out var referenceMatchData, out var runTime);

            var annotationCalculator = new AnnotationCalculator(doc);
            var chromatograms        = doc.Settings.MeasuredResults.Chromatograms;

            for (var i = 0; i < chromatograms.Count; i++)
            {
                var chromSet = chromatograms[i];

                if (groupBy != null)
                {
                    if (!Equals(groupByValue, groupBy.GetValue(annotationCalculator, chromSet)))
                    {
                        continue;
                    }
                }

                for (var j = 0; j < chromSet.MSDataFileInfos.Count; j++)
                {
                    var fileInfo = chromSet.MSDataFileInfos[j];
                    if ((i == resultsIndex && (resultsFile == null || ReferenceEquals(resultsFile, fileInfo.FileId))) ||
                        (subsequent && runTime != null && fileInfo.RunStartTime < runTime))
                    {
                        continue;
                    }

                    var bestMatch = GetPeakMatch(doc, chromSet, fileInfo, nodeTranGroup, referenceTarget, referenceMatchData);
                    if (bestMatch != null)
                    {
                        doc = bestMatch.ChangePeak(doc, nodePepTree, nodeTranGroup, chromSet.Name, fileInfo.FilePath);
                    }
                }
                longWaitBroker.SetProgressCheckCancel(i + 1, chromatograms.Count);
            }
            return(doc);
        }