private Quantity GetTransitionQuantity( SrmSettings srmSettings, IDictionary <PeptideDocNode.TransitionKey, TransitionChromInfo> peptideStandards, NormalizationMethod normalizationMethod, int replicateIndex, TransitionGroupDocNode transitionGroup, TransitionDocNode transition, bool treatMissingAsZero) { if (null == transition.Results) { return(null); } if (replicateIndex >= transition.Results.Count) { return(null); } var chromInfos = transition.Results[replicateIndex]; if (chromInfos.IsEmpty) { return(null); } var chromInfo = GetTransitionChromInfo(transition, replicateIndex); if (null == chromInfo) { return(null); } double?normalizedArea = GetArea(treatMissingAsZero, QValueCutoff, IncludeTruncatedPeaks, transitionGroup, transition, replicateIndex, chromInfo); if (!normalizedArea.HasValue) { return(null); } double denominator = 1.0; if (null != peptideStandards) { if (QuantificationSettings.SimpleRatios) { if (peptideStandards.Count == 0) { return(null); } denominator = peptideStandards.Values.Sum(value => value.Area); } else { TransitionChromInfo chromInfoStandard; if (!peptideStandards.TryGetValue(GetRatioTransitionKey(transitionGroup, transition), out chromInfoStandard)) { return(null); } else { denominator = chromInfoStandard.Area; } } } else { if (chromInfo.IsTruncated.GetValueOrDefault()) { return(null); } if (Equals(normalizationMethod, NormalizationMethod.GLOBAL_STANDARDS)) { var fileInfo = srmSettings.MeasuredResults.Chromatograms[replicateIndex] .GetFileInfo(chromInfo.FileId); if (fileInfo == null) { return(null); } denominator = srmSettings.CalcGlobalStandardArea(replicateIndex, fileInfo); } else if (normalizationMethod is NormalizationMethod.RatioToSurrogate) { denominator = ((NormalizationMethod.RatioToSurrogate)NormalizationMethod) .GetStandardArea(srmSettings, replicateIndex, chromInfo.FileId); } else if (Equals(normalizationMethod, NormalizationMethod.EQUALIZE_MEDIANS)) { var normalizationData = GetNormalizationData(); if (null == normalizationData) { throw new InvalidOperationException(string.Format(@"Normalization method '{0}' is not supported here.", NormalizationMethod)); } double?medianAdjustment = normalizationData.GetMedian(chromInfo.FileId, transitionGroup.TransitionGroup.LabelType) - normalizationData.GetMedianMedian(srmSettings.MeasuredResults.Chromatograms[replicateIndex].SampleType, transitionGroup.TransitionGroup.LabelType); if (!medianAdjustment.HasValue) { return(null); } normalizedArea /= Math.Pow(2.0, medianAdjustment.Value); } else if (Equals(normalizationMethod, NormalizationMethod.TIC)) { var factor = srmSettings.GetTicNormalizationDenominator(replicateIndex, chromInfo.FileId); if (!factor.HasValue) { return(null); } denominator = factor.Value; } } return(new Quantity(normalizedArea.Value, denominator)); }