Esempio n. 1
0
            public static IEnumerable <RegressionOption> All(SrmDocument document)
            {
                yield return(new RegressionOption(Resources.RegressionOption_All_Fixed_points));

                var docPeptides = new Dictionary <Target, PeptideDocNode>();

                foreach (var nodePep in document.Peptides.Where(nodePep => nodePep.PercentileMeasuredRetentionTime.HasValue && !nodePep.IsDecoy))
                {
                    if (!docPeptides.ContainsKey(nodePep.ModifiedTarget))
                    {
                        docPeptides[nodePep.ModifiedTarget] = nodePep;
                    }
                }

                foreach (var standard in Settings.Default.IrtStandardList.Where(standard => !ReferenceEquals(standard, IrtStandard.EMPTY)))
                {
                    var pepMatches = new List <Tuple <DbIrtPeptide, PeptideDocNode> >();
                    foreach (var pep in standard.Peptides)
                    {
                        if (docPeptides.TryGetValue(pep.GetNormalizedModifiedSequence(), out var nodePep))
                        {
                            pepMatches.Add(Tuple.Create(pep, nodePep));
                        }
                    }
                    if (RCalcIrt.TryGetRegressionLine(
                            pepMatches.Select(pep => (double)pep.Item2.PercentileMeasuredRetentionTime.Value).ToList(),
                            pepMatches.Select(pep => pep.Item1.Irt).ToList(),
                            RCalcIrt.MinStandardCount(standard.Peptides.Count), out var regressionLine))
                    {
                        yield return(new RegressionOption(standard.Name, regressionLine, pepMatches, null, false, false));
                    }
                }
            }