Skip to contents

See calibration vignette for example of usage.

Usage

calculate_efficiency_bytargetid(
  cq_df,
  formula = cq ~ log2(dilution) + biol_rep,
  use_prep_types = "+RT"
)

Arguments

cq_df

a data frame with cq (quantification cycle) data, 1 row per well

Must have columns prep_type, target_id, cq, dilution. Only prep_type=="+RT" columns are used.

formula

formula to use for log-log regression fit.

Default value assumes multiple biological replicates, cq ~ log2(dilution) + biol_rep.

If only a single Biological Replicate, change to cq ~ log2(dilution). If multiple sample_ids, change to cq ~ log2(dilution) + sample_id.

See ?formula for background and help.

use_prep_types

prep_type column values to use, default "+RT" for RT-qPCR.

By default, this includes only reverse-transcribed values in the efficiency estimation, so excludes negative controls such as no-template and no-RT.

To skip this filtering step, set use_prep_types=NA.

Value

data frame with columns: target_id, efficiency, efficiency.sd, r.squared.

Details

Note efficiency is given in ratio, not per cent; multiply by 100 for that.

See also

calculate_efficiency

Examples


# create simple dilution dataset for two target_ids with two biological reps
dilution_tibble <- tibble(target_id = rep(c("T_1",
                                            "T_2"), each = 8),
                          well_row = rep(c("A",
                                           "B"), each = 8),
                          well_col = rep(1:8, 2),
                          well = paste0(well_row, well_col),
                          dilution = rep(c(1, 0.1, 0.001, 0.0001), 4),
                          cq = c(1, 3, 4, 6, 1, 3, 5, 7,
                                 4, 5, 6, 7, 3, 7, 8, 9),
                          biol_rep = rep(c(1, 1, 1, 1, 2, 2, 2, 2), 2),
                          prep_type = "+RT")
                     
# calculate primer efficiency for multiple targets

#----- use case 1: include difference across replicates in model
dilution_tibble %>%
    calculate_efficiency_bytargetid()
#> # A tibble: 2 × 4
#>   target_id efficiency efficiency.sd r.squared
#>   <chr>          <dbl>         <dbl>     <dbl>
#> 1 T_1            0.376        0.0398     0.948
#> 2 T_2            0.301        0.0722     0.801

#----- use case 2: ignore difference across replicates
dilution_tibble %>%
    calculate_efficiency_bytargetid(formula = cq ~ log2(dilution))
#> # A tibble: 2 × 4
#>   target_id efficiency efficiency.sd r.squared
#>   <chr>          <dbl>         <dbl>     <dbl>
#> 1 T_1            0.376        0.0412     0.933
#> 2 T_2            0.301        0.0819     0.693