By default, \(\Delta \Delta Cq\) is positive if a target is more highly detected in the relevant sample, compared to reference samples. This can be flipped by setting the parameter `ddcq_positive` to `FALSE`. In either case, The fold change, \(2^{\Delta \Delta Cq}\), is also reported.

calculate_deltadeltacq_bytargetid(
  deltacq_df,
  ref_sample_ids,
  norm_function = median,
  ddcq_positive = TRUE
)

Arguments

deltacq_df

a data frame containing columns `sample_id`, value_name (default `delta_cq`) and tid_name (default `target_id`). Crucially, sample_id should be the same for different technical replicates measuring identical reactions in different wells of the plate, but differ for different biological and experimental replicates.

Usually this will be a data frame that was output by `calculate_deltacq_bysampleid`.

ref_sample_ids

reference sample_ids to normalize by

norm_function

Function to use to calculate the value to normalize by on given scale. Default is median, alternatively could use mean.

ddcq_positive

(default TRUE) output \(\Delta \Delta Cq\) as positive if a target is more highly detected in the relevant sample, compared to reference samples.

Value

data frame like cq_df with three additional columns:

ref_delta_cqsummary (median/mean) \(\Delta Cq\) value for target_id in reference sample ids
deltadelta_cqthe normalized value, \(\Delta \Delta Cq\)
fold_changethe normalized fold-change ratio, \(2^(-\Delta \Delta Cq)\)

Details

This function does a global normalization, where all samples are compared to one or more reference samples specified in `ref_sample_ids`. There are other experimental designs that require comparing samples in pairs or small groups, e.g. a time course comparing `delta_cq` values against a reference strain at each time point. For those situations, instead we recommend adapting code from this function, changing the grouping variables used in to `dplyr::group_by` to draw the contrasts appropriate for the experiment.