Calculate protein or peptide labeling rate by non-linear least squares fitting to exponential equation \(f_{labeled} = 1 - e^{-k\cdot t}\) where \(k\) is the protein/peptide labeling rate (in units of reciprocal time, depending on what the time column is recorded in). Forces fit through the origin (i.e. assumes no labeling at time point 0) and thus explicitly ignores 0 time points.

tor_calculate_label_rate(data, time_col = "hours", min_num_timepoints = 2,
  combine_peptides = TRUE, quiet = FALSE)

Arguments

data

the data with frac_lab/frac_ulab calculated (tor_calculate_labeled_fraction)

time_col

the name of the column that holds the time, assumes "hours" by default.

min_num_timepoints

what is the minimum number of time points to try to fit a curve? 0 time point do not count towards making this minimum

combine_peptides

whether to combine all peptides for a fit (i.e. fit the whole protein), or to calculate a fit for each peptide. Default is to combine across peptides.

Value

data frame with one line for each peptide or protein (depending on combine_peptides) and the following added columns:

  • nested_data: all the data for the protein or peptide

  • num_peptides: the number of peptides combined for each protein (always 1 if combine_peptides = FALSE)

  • num_timepoints: the number of unique time points that went into each fit - does not include any 0 time points

  • num_datapoints: the number of individual data points that went into each fit

  • enough_data: whether there was enough data to fit a curve at all - i.e. whether there were at least 2 time points

  • fit_error: whether the non-linear squares fit succeeded or failed

  • label_rate: the estimated label rate, in units of reciprocal time depending on the time_col

  • label_rate_se: the standard error of the estimated label rate based on the least squares fit

  • fit_rse: the residual standard error of the fit

  • fit: the actual regression model fit