Beispiel #1
0
        public CalibrationCurve GetCalibrationCurve()
        {
            if (RegressionFit.NONE.Equals(QuantificationSettings.RegressionFit))
            {
                if (HasInternalStandardConcentration())
                {
                    return(CalibrationCurve.NO_EXTERNAL_STANDARDS
                           .ChangeSlope(1 / PeptideQuantifier.PeptideDocNode.InternalStandardConcentration.GetValueOrDefault(1.0)));
                }
                return(CalibrationCurve.NO_EXTERNAL_STANDARDS);
            }
            if (IsotopologResponseCurve)
            {
                var concentrationsByLabel = new Dictionary <IsotopeLabelType, double>();
                foreach (var transitionGroup in PeptideQuantifier.PeptideDocNode.TransitionGroups)
                {
                    if (!transitionGroup.PrecursorConcentration.HasValue)
                    {
                        continue;
                    }
                    double prevConcentration;
                    if (concentrationsByLabel.TryGetValue(transitionGroup.LabelType, out prevConcentration))
                    {
                        if (!Equals(prevConcentration, transitionGroup.PrecursorConcentration.Value))
                        {
                            string message =
                                string.Format(
                                    Resources
                                    .CalibrationCurveFitter_GetCalibrationCurve_Unable_to_calculate_the_calibration_curve_for_the_because_there_are_different_Precursor_Concentrations_specified_for_the_label__0__,
                                    transitionGroup.LabelType);
                            return(new CalibrationCurve().ChangeErrorMessage(message));
                        }
                    }
                    else
                    {
                        concentrationsByLabel.Add(transitionGroup.LabelType, transitionGroup.PrecursorConcentration.Value);
                    }
                }
            }
            List <WeightedPoint> weightedPoints = new List <WeightedPoint>();

            foreach (var replicateIndex in GetValidStandardReplicates())
            {
                double?intensity = GetYValue(replicateIndex);
                if (!intensity.HasValue)
                {
                    continue;
                }
                double        x             = GetSpecifiedXValue(replicateIndex).Value;
                double        weight        = QuantificationSettings.RegressionWeighting.GetWeighting(x, intensity.Value);
                WeightedPoint weightedPoint = new WeightedPoint(x, intensity.Value, weight);
                weightedPoints.Add(weightedPoint);
            }
            if (weightedPoints.Count == 0)
            {
                return(new CalibrationCurve()
                       .ChangeErrorMessage(QuantificationStrings.CalibrationCurveFitter_GetCalibrationCurve_All_of_the_external_standards_are_missing_one_or_more_peaks_));
            }
            return(FindBestLodForPoints(weightedPoints));
        }
Beispiel #2
0
        public CalibrationCurve GetCalibrationCurve()
        {
            if (RegressionFit.NONE.Equals(QuantificationSettings.RegressionFit))
            {
                if (HasInternalStandardConcentration())
                {
                    return(CalibrationCurve.NO_EXTERNAL_STANDARDS
                           .ChangeSlope(1 / PeptideQuantifier.PeptideDocNode.InternalStandardConcentration.GetValueOrDefault(1.0)));
                }
                return(CalibrationCurve.NO_EXTERNAL_STANDARDS);
            }
            List <WeightedPoint> weightedPoints = new List <WeightedPoint>();

            foreach (var replicateIndex in GetValidStandardReplicates())
            {
                double?intensity = GetYValue(replicateIndex);
                if (!intensity.HasValue)
                {
                    continue;
                }
                double        x             = GetSpecifiedXValue(replicateIndex).Value;
                double        weight        = QuantificationSettings.RegressionWeighting.GetWeighting(x, intensity.Value);
                WeightedPoint weightedPoint = new WeightedPoint(x, intensity.Value, weight);
                weightedPoints.Add(weightedPoint);
            }
            if (weightedPoints.Count == 0)
            {
                return(new CalibrationCurve()
                       .ChangeErrorMessage(QuantificationStrings.CalibrationCurveFitter_GetCalibrationCurve_All_of_the_external_standards_are_missing_one_or_more_peaks_));
            }
            return(FindBestLodForPoints(weightedPoints));
        }
 public CalibrationCurve GetCalibrationCurve()
 {
     if (RegressionFit.NONE.Equals(QuantificationSettings.RegressionFit))
     {
         if (HasInternalStandardConcentration())
         {
             return CalibrationCurve.NO_EXTERNAL_STANDARDS
                 .ChangeSlope(1/PeptideQuantifier.PeptideDocNode.InternalStandardConcentration.GetValueOrDefault(1.0));
         }
         return CalibrationCurve.NO_EXTERNAL_STANDARDS;
     }
     List<WeightedPoint> weightedPoints = new List<WeightedPoint>();
     foreach (var replicateIndex in GetValidStandardReplicates())
     {
         double? intensity = GetYValue(replicateIndex);
         if (!intensity.HasValue)
         {
             continue;
         }
         double x = GetSpecifiedXValue(replicateIndex).Value;
         double weight = QuantificationSettings.RegressionWeighting.GetWeighting(x, intensity.Value);
         WeightedPoint weightedPoint = new WeightedPoint(x, intensity.Value, weight);
         weightedPoints.Add(weightedPoint);
     }
     if (weightedPoints.Count == 0)
     {
         return new CalibrationCurve()
             .ChangeErrorMessage(QuantificationStrings.CalibrationCurveFitter_GetCalibrationCurve_All_of_the_external_standards_are_missing_one_or_more_peaks_);
     }
     CalibrationCurve calibrationCurve = QuantificationSettings.RegressionFit.Fit(weightedPoints);
     return calibrationCurve;
 }