public void TestRatioToStandard() { var doc = LoadTestDocument(); foreach (var peptideGroup in doc.MoleculeGroups) { foreach (var peptide in peptideGroup.Peptides) { var peptideQuantifier = new PeptideQuantifier(null, peptideGroup, peptide, QuantificationSettings.DEFAULT.ChangeNormalizationMethod(NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy))); for (int replicateIndex = 0; replicateIndex < doc.Settings.MeasuredResults.Chromatograms.Count; replicateIndex++) { var expected = peptide.Results[replicateIndex].First().LabelRatios.First().Ratio.Ratio; var actual = PeptideQuantifier.SumQuantities( peptideQuantifier.GetTransitionIntensities(doc.Settings, replicateIndex, false).Values, peptideQuantifier.NormalizationMethod).Value; Assert.AreEqual(expected, actual, .0001, "Error on replicate {0}", replicateIndex); } } } }
public double?GetNormalizedPeakArea(int replicateIndex) { var allTransitionQuantities = GetTransitionQuantities(replicateIndex); ICollection <PeptideQuantifier.Quantity> quantitiesToSum; if (!IsAllowMissingTransitions()) { var completeTransitionSet = GetTransitionsToQuantifyOn(); quantitiesToSum = allTransitionQuantities .Where(entry => completeTransitionSet.Contains(entry.Key)) .Select(entry => entry.Value) .ToArray(); if (quantitiesToSum.Count != completeTransitionSet.Count) { return(null); } } else { quantitiesToSum = allTransitionQuantities.Values; } return(PeptideQuantifier.SumQuantities(quantitiesToSum, PeptideQuantifier.NormalizationMethod)); }