example_script.R

gdsc_raw_data <- read.csv("/media/storage/Google_Drive/Study/Master/ICB/backups/kit_fit/data/CV1.csv")
data("gdsc_example")
head(gdsc_example, 2)
gdsc_example <- removeFailedDrugs(gdsc_example)
gdsc_example <- removeMissingDrugs(gdsc_example)
normalized_gdsc_example <- normalizeData(gdsc_example,
trim = T,
neg_control = "NC-1",
pos_control = "B")
head(normalized_gdsc_example, 2)
scaled_gdsc_example <- setConcsForNlme(normalized_gdsc_example, group_conc_ranges = F)
unique(subset(scaled_gdsc_example, DRUGSET_ID == 159 & DRUG_ID_lib == 1003, select = c("DRUGSET_ID", "lib_drug", "dose", "CONC", "maxc", "x")))
unique(subset(normalized_gdsc_example, DRUG_ID_lib == 1510 & dose == "D1", select = c("DRUGSET_ID", "lib_drug", "dose", "CONC")))
set_concs_test <- setConcsForNlme(normalized_gdsc_example, group_conc_ranges = T)

unique(subset(set_concs_test, DRUG_ID_lib == 1510, select = c("lib_drug", "dose", "CONC", "maxc", "x")))
rm(set_concs_test)
set_concs_test <- setConcsForNlme(normalized_gdsc_example, group_conc_ranges = F)
unique(subset(set_concs_test, DRUG_ID_lib == 1510, select =  c("lib_drug", "dose", "CONC", "maxc", "x")))
nlme_data <- prepNlmeData(scaled_gdsc_example,
                          cl_id = "COSMIC_ID",
                          drug_specifiers = "DRUG_ID_lib")
nlme_data <- prepNlmeData(scaled_gdsc_example,
                          cl_id = "COSMIC_ID",
                          drug_specifiers = c("DRUG_ID_lib", "maxc"))
head(nlme_data, 3)


nlme_model <- fitModelNlmeData(nlme_data, isLargeData =FALSE)
nlme_stats <- calcNlmeStats(nlme_model, nlme_data)
head(data.frame(nlme_stats), 2)
plotResponse(model_stats = nlme_stats, cell_line = 1503364, drug_identifier = "1032_2")
plotResponse(model_stats = nlme_stats, cell_line = 687829, drug_identifier = "1003_0.1")
IC50_matrix <- getIC50Matrix(nlme_stats)
AUC_matrix <- getIC50Matrix(nlme_stats, measure = "auc")
write.csv(IC50_matrix, "my_gdsctools_dir/IC50_matrix.csv")
yemelianovskyi/gdscIC50_advanced documentation built on Jan. 30, 2020, 12:27 a.m.