From 079d25eaf7c7fa3281c7458d9a0dc98775dea458 Mon Sep 17 00:00:00 2001 From: Piero Dalle Pezze Date: Wed, 20 Dec 2017 21:36:32 +0000 Subject: [PATCH] restored. --- sbpipe/R/sbpipe_ps2.r | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sbpipe/R/sbpipe_ps2.r b/sbpipe/R/sbpipe_ps2.r index 1f8c973d..55853720 100644 --- a/sbpipe/R/sbpipe_ps2.r +++ b/sbpipe/R/sbpipe_ps2.r @@ -20,9 +20,8 @@ # $Date: 2016-07-6 12:14:32 $ - + library(ggplot2) -library(data.table) # retrieve SBpipe folder containing R scripts args <- commandArgs(trailingOnly = FALSE) @@ -42,18 +41,19 @@ source(file.path(SBPIPE_R, 'sbpipe_ggplot2_themes.r')) # :param outputdir: the output directory # :param run: the simulation run plot_double_param_scan_data <- function(model, scanned_par1, scanned_par2, inputdir, outputdir, run) { - - theme_set(basic_theme(36)) - + + theme_set(basic_theme(36)) + writeLines(paste("1st var: ", scanned_par1, sep="")) - writeLines(paste("2st var: ", scanned_par2, sep="")) + writeLines(paste("2st var: ", scanned_par2, sep="")) # create the directory of output - if (!file.exists(outputdir)){ - dir.create(outputdir) + if (!file.exists(outputdir)){ + dir.create(outputdir) } # EXTRACT the tuples of min and max values FROM the complete dataset. Doing so, we don't need to iterate. - df <- data.frame(fread(file.path(inputdir, paste(model, "_", run, ".csv", sep="")))) + df <- read.table(file.path(inputdir, paste(model, "_", run, ".csv", sep="")), header=TRUE, + na.strings="NA", dec=".", sep="\t") # discard the first column (Time) and the columns of the two scanned parameters columns2discard <- c(colnames(df)[1], scanned_par1, scanned_par2) @@ -81,7 +81,8 @@ plot_double_param_scan_data <- function(model, scanned_par1, scanned_par2, input df.coordinates <- data.frame() # Extract the coordinates of the data frame to plot if(length(files) > 0) - df.coordinates <- data.frame(fread(file.path(inputdir, files[1]), select=c(scanned_par1, scanned_par2))) + df.tp <- read.table(file.path(inputdir, files[1]), header=TRUE, na.strings="NA", dec=".", sep="\t") + df.coordinates <- subset(df.tp, select=c(scanned_par1, scanned_par2)) #print(df.coordinates) # Construct a generic palette @@ -91,7 +92,7 @@ plot_double_param_scan_data <- function(model, scanned_par1, scanned_par2, input for(j in 1:length(files)) { print(paste('Processing file:', files[j], sep=" ")) # Read variable - df.tp <- data.frame(fread(file.path(inputdir, files[j]))) + df.tp <- read.table(file.path(inputdir, files[j]), header=TRUE, na.strings="NA", dec=".", sep="\t") for(k in 1:length(columns)) { # add the column to plot (the colour) to the coordinate data in df.coordinates @@ -116,6 +117,4 @@ plot_double_param_scan_data <- function(model, scanned_par1, scanned_par2, input dpi=300, width=8, height=6) } } -} - - +} \ No newline at end of file