timecourse_AUC_ratio: Calculate AUC for sample/treatment at a concentration across...

Description Usage Arguments Details Value Examples

View source: R/HTDoseResponseCurve.R

Description

This function calculates the AUC at a single concentration across all timepoints. This is very distinct from a typical dose response curve, which can be used to calculate the AUC at a single timepoint across multiple concentrations. For that purpose, use fit_DRC.

Usage

1
2
timecourse_AUC_ratio(D, treatments, sample_types, concentrations,
  summary_method)

Arguments

D

experiment dataset with columns matching the output of read_incucyte_exported_to_excel

treatments

which treatments to calculate

sample_types

samples on which to calculate

concentrations

which concentrations to draw

summary_method

mean or median

Details

AUC for a single sample type/treatment condition across the whole timecourse is calculated using raw data normalized by the vehicle control specified by the user when the dataset was created. AUC is calculated by connecting the normalized data points and then using the trapezoids method for AUC implemented in pracma::trapz.

For each treatment, in each concentration,

Return value is a list. The matrix in the list contains one column for each AUC value followed by one column for each AUC ratios of sample_types[1] / sample_types[2]. The concentrations vector in the list indicates the treatment concentration in each column. The sample_types vector in the list indicates the sample type if the column is a single sample AUC, or the word "ratio" if the value in the column is an AUC ratio.

Value

list( AUC matrix, concentrations, sample_types )

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Create a dataset with two drugs normalized against DMSO, tested at a single
# concentration. Timepoints are 0, 12, 24, 36, 48 hours. drug1 affected 
# line1 cells at this concentration, while drug2 affected line2 cells.
ds = create_dataset( 
     sample_types= rep( c("line1", "line2"), 15),
     treatments = c( rep("DMSO", 10), rep("drug1", 10), rep("drug2", 10)),
     concentrations = c( rep(0, 10), rep(200, 20) ),
     hours = rep( c(0,0,12,12,24,24,36,36,48,48), 3),
     values = c(10,10,15,15,30,25,60,50,80,65,
                10,10,12,15,22,28,26,48,30,60,
                10,10,15,12,30,11,60,13,80,9), 
     plate_id = "plate_1",
     negative_control = "DMSO")
tc=timecourse_AUC_ratio(ds, 
                      treatments=c("drug1", "drug2"), 
                      sample_types=c("line1", "line2"), 
                      concentrations=c(0, 200), 
                      summary_method="mean")
# create a data frame from individual list components
data.frame( sample_type = tc$sample_types,
            concentration = tc$concentrations,
            t(tc$AUC), 
            row.names=1:length(tc$sample_types),
            stringsAsFactors=FALSE)

DavidQuigley/HTDoseResponseCurve documentation built on Jan. 23, 2021, 5:10 a.m.