-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflow_QC.R
146 lines (120 loc) · 5.23 KB
/
workflow_QC.R
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
#!/usr/bin/env Rscript
# first install packages affy, matrixStats and vsn
#install.packages("../ProtStatsWF", repos = NULL, type="source")
library(limma)
library(ProtStatsWF)
library(optparse)
option_list <- list(
make_option(opt_str = c("--data_path"),
type = "character",
help = "A string of the input path for the data."),
make_option(opt_str = c("--output_path"),
type = "character",
help = "A string of the input path for the data."),
make_option(opt_str = c("--intensity_columns_start"),
type = "integer",
help = "An integer of the first data column."),
make_option(opt_str = c("--intensity_columns_end"),
type = "integer",
help = "An integer of the last data column."),
make_option(opt_str = c("--use_groups"),
type = "character",
default = "TRUE",
help = "A logical if groupings should be used."),
make_option(opt_str = c("--zero_to_NA"),
type = "character",
default = "TRUE",
help = "A logical if 0 should be considered 0 or turned into not-available/NA."),
make_option(opt_str = c("--do_log_transformation"),
type = "character",
default = "TRUE",
help = "A logical if the data should be log transformed."),
make_option(opt_str = c("--log_base"),
type = "integer",
default = 2,
help = "An integer base the data should be log transformed in, if it is going to be log transformed."),
make_option(opt_str = c("--normalization_method"),
type = "character",
default = "loess",
help = "A character of the normalization method. Possible methods are no normalization nonorm or median, loess (default), quantile or lts normalization"),
make_option(opt_str = c("--PCA_impute"),
type = "character",
default = "FALSE",
help = "A logical if the data should imputed when doing the PCA."),
make_option(opt_str = c("--PCA_impute_method"),
type = "character",
default = "mean",
help = "A character containing the method the data for the PCA is imputed. Methods are mean (default) or median"),
make_option(opt_str = c("--generate_MA_plots"),
type = "character",
default = "TRUE",
help = "A logical if the MA-plots should be generated."),
make_option(opt_str = c("--MA_maxPlots"),
type = "integer",
default = 5000,
help = "Maximum number of MA-plots to generate.")
)
opt <- parse_args(OptionParser(option_list=option_list))
if(is.null(opt$data_path)){
message("The data path is missing. Add: --data_path <your/data/path/file.xlsx>")
}
if(is.null(opt$output_path)){
message("The output path is missing. Add: --output_path <your/output/path/folder>")
}
if(is.null(opt$intensity_columns_start)){
message("The column number where the data starts is missing. Add: --intensity_columns_start <number>")
}
if(is.null(opt$intensity_columns_end)){
message("The column number where the data ends is missing. Add: --intensity_columns_end <number>")
}
## transform some options to logical:
opt$use_groups <- as.logical(opt$use_groups)
opt$zero_to_NA <- as.logical(opt$zero_to_NA)
opt$do_log_transformation <- as.logical(opt$do_log_transformation)
opt$PCA_impute <- as.logical(opt$PCA_impute)
opt$generate_MA_plots <- as.logical(opt$generate_MA_plots)
intensity_columns = opt$intensity_columns_start:opt$intensity_columns_end
print(opt)
print(getwd())
print(opt$do_log_transformation)
### weitere Parameter für die User:
# group_colours
### hashtag if we need this in the command line
workflow_QC(data_path = opt$data_path,
intensity_columns = intensity_columns,
output_path = opt$output_path,
na_strings = c("NA", "NaN", "Filtered", "#NV"),
zero_to_NA = opt$zero_to_NA,
do_log_transformation = TRUE,#opt$do_log_transformation,
log_base = opt$log_base,
use_groups = TRUE,#opt$use_groups,
groupvar_name = "Group",
group_colours = NULL,
base_size = 15,
plot_device = "pdf",
plot_height = 10,
plot_width = 15,
plot_dpi = 300,
suffix = "",
normalization_method = opt$normalization_method,
boxplot_method = "boxplot",
generate_MAplots = opt$generate_MA_plots,
MA_maxPlots = opt$MA_maxPlots,
MA_alpha = FALSE,
#PCA_groupvar1 = NULL,
#PCA_groupvar2 = NULL,
PCA_impute = opt$PCA_impute,
PCA_impute_method = opt$PCA_impute_method,
PCA_propNA = 0,
PCA_scale. = TRUE,
PCA_PCx = 1, PCA_PCy = 2,
PCA_groupvar1_name = "Group",
#PCA_groupvar2_name = NULL,
PCA_alpha = 1,
PCA_label = FALSE,
PCA_label_seed = NA,
PCA_label_size = 4,
PCA_xlim = NULL,
PCA_ylim = NULL,
PCA_point.size = 4
)