0
|
1 #!/usr/bin/Rscript --vanilla --slave --no-site-file
|
|
2
|
|
3 ################################################################################################
|
|
4 # WRAPPER FOR Corr_Script_samples_row.R (CORRELATION TABLE) #
|
|
5 # #
|
|
6 # Author: Ophelie BARBET #
|
|
7 # User: Galaxy #
|
|
8 # Original data: used with Corr_Script_samples_row.R #
|
|
9 # Starting date: #
|
|
10 # V-1: First version of wrapper #
|
|
11 # #
|
|
12 # #
|
|
13 # Input files: 2 tables with common samples file #
|
|
14 # Output files: Correlation table ; Heatmap file #
|
|
15 # #
|
|
16 ################################################################################################
|
|
17
|
|
18
|
|
19 library(batch) #necessary for parseCommandArgs function
|
|
20 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
|
|
21
|
|
22 source_local <- function(...){
|
|
23 argv <- commandArgs(trailingOnly = FALSE)
|
|
24 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
|
|
25 for(i in 1:length(list(...))){source(paste(base_dir, list(...)[[i]], sep="/"))}
|
|
26 }
|
|
27 #Import the different functions
|
|
28 source_local("Corr_Script_samples_row.R")
|
|
29
|
|
30
|
|
31 if(length(args) < 10){ stop("NOT enough argument !!!") }
|
|
32
|
|
33
|
|
34 cat('\n--------------------------------------------------------------------',
|
|
35 '\nParameters used in "Between-table Correlation":\n\n')
|
|
36 print(args)
|
|
37 cat('--------------------------------------------------------------------\n\n')
|
|
38
|
|
39
|
|
40 risk_alpha <- NULL
|
|
41 correct_multi <- NULL
|
|
42 if(args$test_corr == "yes"){
|
|
43 risk_alpha <- args$risk_alpha
|
|
44 correct_multi <- args$correct_multi
|
|
45 }
|
|
46
|
|
47 filters_choice <- NULL
|
|
48 threshold <- NULL
|
|
49 if(args$filter == "yes"){
|
|
50 filters_choice <- args$filters_choice
|
|
51 if(filters_choice == "filters_0_thr"){
|
|
52 threshold <- args$threshold
|
|
53 }
|
|
54 }
|
|
55
|
|
56 type_classes <- NULL
|
|
57 reg_class_value <- NULL
|
|
58 irreg_class_vect <- NULL
|
|
59 if(args$color_heatmap == "yes"){
|
|
60 type_classes <- args$type_classes
|
|
61 if(type_classes == "regular"){
|
|
62 reg_class_value <- args$reg_class_value
|
|
63 } else if(type_classes == "irregular"){
|
|
64 irreg_class_vect <- eval(parse(text=paste0("c",args$irreg_class_vect)))
|
|
65 }
|
|
66 }
|
|
67
|
|
68
|
|
69 correlation.tab(args$tab1_in, args$tab2_in, args$tab1_samples, args$tab2_samples, args$corr_method, args$test_corr, risk_alpha, correct_multi, args$filter, filters_choice, threshold,
|
|
70 args$reorder_var, args$color_heatmap, type_classes, reg_class_value, irreg_class_vect, args$tabcorr_out, args$heatmap_out)
|
|
71
|
|
72
|
|
73 cat('\n--------------------------------------------------------------------',
|
|
74 '\nInformation about R (version, Operating System, attached or loaded packages):\n\n')
|
|
75 sessionInfo()
|
|
76 cat('--------------------------------------------------------------------\n\n')
|
|
77
|
|
78
|
|
79 #delete the parameters to avoid the passage to the next tool in .RData image
|
|
80 rm(args) |