IDAPredict.TestvsControl: Predicts and compares IDA efficacies for a pair of control...

Description Usage Arguments Details Value Examples

View source: R/IDAPredict.TestvsControl.R

Description

This function creates efficacy predictions for a pair of control and test treatments, each treatment consisting of a combination of one or more drugs, using monotherapy efficacy data and the assumptions of independent drug action. Concentrations must be specified for each drug in each treatment.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
IDAPredict.TestvsControl(
  Monotherapy_Data,
  Cell_Line_Name_Column,
  Drug_Name_Column,
  Drug_Concentration_Column,
  Efficacy_Column,
  LowerEfficacyIsBetterDrugEffect,
  Efficacy_Metric_Name = "Efficacy",
  Control_Treatment_Drugs,
  Control_Treatment_Drug_Concentrations,
  Test_Treatment_Drugs,
  Test_Treatment_Drug_Concentrations,
  Calculate_Uncertainty = FALSE,
  Efficacy_SE_Column = NULL,
  n_Simulations = 1000,
  Calculate_Hazard_Ratio = FALSE,
  Average_Duplicate_Records = FALSE,
  Return_Bootstrap_Values = FALSE
)

Arguments

Monotherapy_Data

A data frame where each row contains information about the response of a single cell line to a single drug at a single concentration. Must minimally include columns containing the following information: cell line name, drug name, drug concentration, and measured drug efficacy. May optionally include a column recording the standard error (SE) of the measured drug efficacy.

Cell_Line_Name_Column

A character vector of length 1 containing the name of the column in the Monotherapy_Data data frame which contains cell line names.

Drug_Name_Column

A character vector of length 1 containing the name of the column in the Monotherapy_Data data frame which contains drug names.

Drug_Concentration_Column

A character vector of length 1 containing the name of the column in the Monotherapy_Data data frame which contains drug concentrations.

Efficacy_Column

A character vector of length 1 containing the name of the column in the Monotherapy_Data data frame which contains measured drug efficacies (i.e. percent Viability, percent Cell Growth, etc.).

LowerEfficacyIsBetterDrugEffect

A logic vector of length 1 indicating whether or not lower values in Efficacy_Column indicate a more effective drug effect (i.e. for percent viability). Set TRUE if so. Otherwise, set FALSE if higher values in Efficacy_Column indicate a more effective drug response (i.e. for percent cell death).

Efficacy_Metric_Name

A character vector of length 1 indicating the name of the efficacy metric being used (i.e. Percent_Viability, Percent_Growth, etc.). Used to correctly label column names in output. Defaults to "Efficacy".

Control_Treatment_Drugs

A character vector of length > 0 containing the names of the drugs in the control drug treatment for which efficacy predictions are to be made.

Control_Treatment_Drug_Concentrations

A vector of drug concentrations for Control_Treatment_Drugs with the first concentration in Control_Treatment_Drug_Concentrations corresponding to the first drug in Control_Treatment_Drugs etc. Only one concentration may be specified for each drug in the control treatment, but, if a drug is included in both the control and test treatments, there is no need for the same concentration of that drug to be used in both treatments.

Test_Treatment_Drugs

A character vector of length > 0 containing the names of the drugs in the control drug treatment for which efficacy predictions are to be made.

Test_Treatment_Drug_Concentrations

A vector of drug concentrations for Test_Treatment_Drugs with the first concentration in Test_Treatment_Drug_Concentrations corresponding to the first drug in Test_Treatment_Drugs etc. Only one concentration may be specified for each drug in the test treatment, but, if a drug is included in both the control and test treatments, there is no need for the same concentration of that drug to be used in both treatments.

Calculate_Uncertainty

A logic vector of length one indicating whether or not a semi-parametric bootstrap should be performed to estimate uncertainties in the efficacy predictions based on uncertainties in the monotherapy efficacy measurements. Set TRUE if you wish to calculate uncertainties. Defaults to FALSE.

Efficacy_SE_Column

A character vector of length 1 containing the name of the column in the Monotherapy_Data data frame which contains the standard errors of measured drug efficacies. Must be specified if Calculate_Uncertainty is set to TRUE.

n_Simulations

A positive, integer vector of length 1 with a value >= 40 indicating the number of random samples to be drawn when calculating output efficacy prediction uncertainties. Defaults to 1000.

Calculate_Hazard_Ratio

A logic vector of length 1 indicating whether or not a Hazard Ratios (HR) should be calculated between the control and test treatments. Set TRUE if so. Should only be set to TRUE for efficacy metrics that range between 0 and 1 (i.e. percent viability). Defaults to FALSE.

Average_Duplicate_Records

A logic vector of length 1 indicating whether or not duplicated records (where a cell line has multiple records for being tested with a given drug at a given concentration) should be averaged. If TRUE, Efficacy values are averaged, and, if Calculate_Uncertainty is also TRUE, Efficacy_SE values are added in quadrature and divided by the number of duplicate records for that cell line/drug/concentration set.

Return_Bootstrap_Values

A logic vector of length 1 indicating whether or not the function should return the Control Efficacies, Test Efficacies, and, if Calculate_Hazard_Ratio = TRUE, Hazard Ratios (HRs) simulated in the semi-parametric bootstrap used to estimate the uncertainties of those values. Defaults to FALSE. This parameter can only be set to TRUE if Calculate_Uncertainty = TRUE.

Details

Uncertainty estimates for values calculated by this function are generated using a semi-parametric bootstrap approach. This is performed in several steps.

  1. Control efficacies for each compound/concentration are simulated by random sampling from normal distributions with means equal to the provided calculated efficacies and standard deviations equal to the provided efficacy standard errors.

  2. Test efficacies are simulated in the same fashion as the control efficacies, except in cases when a test drug also exists in the control therapy. In such cases, it is assumed that the efficacy values for this drug are derived from the same dose-response curve for the both the control and test therapies, so each simulated efficacy for that test drug is matched to the corresponding simulated efficacy from that drug in the control therapy using a standard normal deviate.

  3. Efficacy predictions are made for the control and test therapies for each cell line and set of simulated efficacies using the assumptions of independent drug action.

  4. Cell lines are randomly sampled with replacement for each simulation as many times as there are original cell lines. The simulated control and test therapy efficacies are then sampled according to the sampled cell lines for each simulation.

  5. Mean efficacies are calculated for the control and test therapies for each simulation. If specified to do so, these values are then used to calculate simulated HRs.

  6. The simulated distributions of each efficacy metric are used to estimate uncertainties for those metrics.

Value

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
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#Loading Package
  library(IDACombo)

#Making fake monotherapy dataset
  CellLineNames <- rep(c("CL1", "CL2", "CL3", "CL4", "CL5", "CL6"), 6)
  DrugNames <- c(rep("D1", 12), rep("D2", 12), rep("D3", 12))
  Concentrations <- c(rep(1, 6), rep(2, 6), rep(1.5, 6), rep(3, 6), rep("A", 6), rep("B", 6))
  Viability <- c(sample(seq(0.4,1,length.out = 10), 6, replace = TRUE),
                 sample(seq(0.2,0.8,length.out = 10), 6, replace = TRUE),
                 sample(seq(0.4,1,length.out = 10), 6, replace = TRUE),
                 sample(seq(0.2,0.6,length.out = 10), 6, replace = TRUE),
                 sample(seq(0.9,1,length.out = 10), 6, replace = TRUE),
                 sample(seq(0.2,0.6,length.out = 10), 6, replace = TRUE))
  Viability_SE <- Viability * sample(seq(0,0.1,length.out = 100), 36, replace = TRUE)
  Fake_Data <- data.frame(CellLineNames, DrugNames, Concentrations, Viability, Viability_SE)

#Creating efficacy predictions for control and test treatments and comparing without
#uncertainty calculations
  #For case where drugs in test treatment are at reduced concentrations from
  #those used in the control treatment due to the addition of a third drug.
  #Note that this may mean that the test treatment is less effective than
  #the control treatment, such that the Hazard Ratio is > 1.
    IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                             Cell_Line_Name_Column = "CellLineNames",
                             Drug_Name_Column = "DrugNames",
                             Drug_Concentration_Column = "Concentrations",
                             Efficacy_Column = "Viability",
                             Control_Treatment_Drugs = c("D1", "D2"),
                             Control_Treatment_Drug_Concentrations = c(2, 3),
                             Test_Treatment_Drugs = c("D1", "D2", "D3"),
                             Test_Treatment_Drug_Concentrations = c(1, 1.5, "B"),
                             Calculate_Uncertainty = FALSE,
                             LowerEfficacyIsBetterDrugEffect = TRUE,
                             Efficacy_Metric_Name = "Viability",
                             Calculate_Hazard_Ratio = TRUE,
                             Average_Duplicate_Records = FALSE)

  #For case where drugs in test treatment are at same concentrations as
  #those used in the control treatment.
    IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                             Cell_Line_Name_Column = "CellLineNames",
                             Drug_Name_Column = "DrugNames",
                             Drug_Concentration_Column = "Concentrations",
                             Efficacy_Column = "Viability",
                             Control_Treatment_Drugs = c("D1", "D2"),
                             Control_Treatment_Drug_Concentrations = c(2, 3),
                             Test_Treatment_Drugs = c("D1", "D2", "D3"),
                             Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                             Calculate_Uncertainty = FALSE,
                             LowerEfficacyIsBetterDrugEffect = TRUE,
                             Efficacy_Metric_Name = "Viability",
                             Calculate_Hazard_Ratio = TRUE,
                             Average_Duplicate_Records = FALSE)

#Creating efficacy predictions for control and test treatments and comparing with
#uncertainty calculations but without returning simulated values that are generated
#using a semi-parametric bootstrap to estimate uncertainties.

  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Viability",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Viability_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = TRUE,
                           Efficacy_Metric_Name = "Viability",
                           Calculate_Hazard_Ratio = TRUE,
                           Average_Duplicate_Records = FALSE)

#Creating efficacy predictions for control and test treatments and comparing with
#uncertainty calculations and with returning simulated values that are generated
#using a semi-parametric bootstrap to estimate standard errors.

  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Viability",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Viability_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = TRUE,
                           Efficacy_Metric_Name = "Viability",
                           Calculate_Hazard_Ratio = TRUE,
                           Average_Duplicate_Records = FALSE,
                           Return_Bootstrap_Values = TRUE)

#Converting Viabilty to reduction in viability and redoing calculations
#without returning simulated values from semi-parametric boostrap. Note the change
#in the LowerEfficacyIsBetterDrugEffect flag from TRUE to FALSE
  Reduction_in_Viability <- 1-Viability
  Reduction_in_Viability_SE <- Viability_SE
  Fake_Data <- data.frame(CellLineNames,
                          DrugNames,
                          Concentrations,
                          Reduction_in_Viability,
                          Reduction_in_Viability_SE)
  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Reduction_in_Viability",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Reduction_in_Viability_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = FALSE,
                           Efficacy_Metric_Name = "Reduction_in_Viability",
                           Calculate_Hazard_Ratio = TRUE,
                           Average_Duplicate_Records = FALSE)

#Changing efficacy metric to percent growth (range -1 to 1)
#Note that calculating Hazard Ratios is no longer valid, so
#Calculate_Hazard_Ratio is set to FALSE.
  Percent_Growth <- c(sample(seq(0.4,1,length.out = 10), 6, replace = TRUE),
                      sample(seq(-0.4,0.2,length.out = 10), 6, replace = TRUE),
                      sample(seq(-0.2,0.3,length.out = 10), 6, replace = TRUE),
                      sample(seq(-1,0.2,length.out = 10), 6, replace = TRUE),
                      sample(seq(0.8,1,length.out = 10), 6, replace = TRUE),
                      sample(seq(-1,-0.2,length.out = 10), 6, replace = TRUE))
  Percent_Growth_SE <- abs(Percent_Growth * sample(seq(0,0.1,length.out = 100), 36, replace = TRUE))
  Fake_Data <- data.frame(CellLineNames,
                          DrugNames,
                          Concentrations,
                          Percent_Growth,
                          Percent_Growth_SE)
  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Percent_Growth",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Percent_Growth_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = TRUE,
                           Efficacy_Metric_Name = "Percent_Growth",
                           Calculate_Hazard_Ratio = FALSE,
                           Average_Duplicate_Records = FALSE)

#Adding duplicate records for each cell line, and showing behavior with
#Average_Duplicate_Records = FALSE. Should produce warning messages that
#duplicates were found and removed.
  Percent_Growth <- c(sample(seq(0.4,1,length.out = 10), 6, replace = TRUE),
                      sample(seq(-0.4,0.2,length.out = 10), 6, replace = TRUE),
                      sample(seq(-0.2,0.3,length.out = 10), 6, replace = TRUE),
                      sample(seq(-1,0.2,length.out = 10), 6, replace = TRUE),
                      sample(seq(0.8,1,length.out = 10), 6, replace = TRUE),
                      sample(seq(-1,-0.2,length.out = 10), 6, replace = TRUE))
  Percent_Growth_SE <- abs(Percent_Growth * sample(seq(0,0.1,length.out = 100), 36, replace = TRUE))
  Fake_Data_to_add <- data.frame(CellLineNames,
                          DrugNames,
                          Concentrations,
                          Percent_Growth,
                          Percent_Growth_SE)
  Fake_Data <- rbind(Fake_Data, Fake_Data_to_add)
  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Percent_Growth",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Percent_Growth_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = TRUE,
                           Efficacy_Metric_Name = "Percent_Growth",
                           Calculate_Hazard_Ratio = FALSE,
                           Average_Duplicate_Records = FALSE)

#Now setting to average duplicate values.
  IDAPredict.TestvsControl(Monotherapy_Data = Fake_Data,
                           Cell_Line_Name_Column = "CellLineNames",
                           Drug_Name_Column = "DrugNames",
                           Drug_Concentration_Column = "Concentrations",
                           Efficacy_Column = "Percent_Growth",
                           Control_Treatment_Drugs = c("D1", "D2"),
                           Control_Treatment_Drug_Concentrations = c(2, 3),
                           Test_Treatment_Drugs = c("D1", "D2", "D3"),
                           Test_Treatment_Drug_Concentrations = c(2, 3, "B"),
                           Calculate_Uncertainty = TRUE,
                           Efficacy_SE_Column = "Percent_Growth_SE",
                           n_Simulations = 1000,
                           LowerEfficacyIsBetterDrugEffect = TRUE,
                           Efficacy_Metric_Name = "Percent_Growth",
                           Calculate_Hazard_Ratio = FALSE,
                           Average_Duplicate_Records = TRUE)

Alexander-Ling/IDACombo documentation built on July 31, 2020, 7:31 a.m.