Mercurial > repos > ufz > dose_response_analysis_tool
diff dose_response.R @ 1:8a1b524ed9d8 draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tools/tox_tools/baseline_calculator commit dca5f947ae4c9697ac0cfce0b313170b541124e5
author | ufz |
---|---|
date | Tue, 08 Oct 2024 12:41:07 +0000 |
parents | 082e9d22c38d |
children | c122403ac78a |
line wrap: on
line diff
--- a/dose_response.R Mon Jun 10 11:57:52 2024 +0000 +++ b/dose_response.R Tue Oct 08 12:41:07 2024 +0000 @@ -45,10 +45,14 @@ plot.background = element_rect(fill = "white", color = NA) ) - ggsave(filename = plot_file, plot = p, device = "jpg") + jpeg(filename = plot_file) + print(p) + dev.off() } dose_response_analysis <- function(data, concentration_col, response_col, plot_file, ec_file) { + concentration_col <- colnames(data)[as.integer(concentration_col)] + response_col <- colnames(data)[as.integer(response_col)] models <- fit_models(data, concentration_col, response_col) best_model_info <- select_best_model(models) ec_values <- calculate_ec_values(best_model_info$model) @@ -59,7 +63,7 @@ EC25 = ec_values$EC25[1], EC50 = ec_values$EC50[1] ) - write.csv(ec_data, ec_file, row.names = FALSE) + write.table(ec_data, ec_file, sep = "\t", row.names = FALSE, col.names = TRUE, quote = FALSE) return(list(best_model = best_model_info$name, ec_values = ec_values)) } @@ -72,5 +76,5 @@ plot_file <- args[4] ec_file <- args[5] -data <- read.csv(data_file, header = TRUE) +data <- read.csv(data_file, header = TRUE, sep = "\t") dose_response_analysis(data, concentration_col, response_col, plot_file, ec_file)