Mercurial > repos > eschen42 > mqppep_anova
comparison mqppep_anova.R @ 15:2c5f1a2fe16a draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 96659062ea07ac43d139746b0d119f1ee020f9cd"
author | eschen42 |
---|---|
date | Sat, 26 Mar 2022 02:27:12 +0000 |
parents | b41a077af3aa |
children | 61adb8801b73 |
comparison
equal
deleted
inserted
replaced
14:6679616d0c18 | 15:2c5f1a2fe16a |
---|---|
30 " path to text file having one column and no header") | 30 " path to text file having one column and no header") |
31 ), | 31 ), |
32 make_option( | 32 make_option( |
33 c("-f", "--firstDataColumn"), | 33 c("-f", "--firstDataColumn"), |
34 action = "store", | 34 action = "store", |
35 default = "10", | 35 default = "^Intensity[^_]", |
36 type = "character", | 36 type = "character", |
37 help = "First column of intensity values" | 37 help = "First column of intensity values" |
38 ), | 38 ), |
39 make_option( | 39 make_option( |
40 c("-m", "--imputationMethod"), | 40 c("-m", "--imputationMethod"), |
108 # Check parameter values | 108 # Check parameter values |
109 | 109 |
110 if (! file.exists(args$inputFile)) { | 110 if (! file.exists(args$inputFile)) { |
111 stop((paste("Input file", args$inputFile, "does not exist"))) | 111 stop((paste("Input file", args$inputFile, "does not exist"))) |
112 } | 112 } |
113 input_file <- args$inputFile | 113 input_file <- args$inputFile |
114 alpha_file <- args$alphaFile | 114 alpha_file <- args$alphaFile |
115 first_data_column <- args$firstDataColumn | 115 imputed_data_file_name <- args$imputedDataFile |
116 imp_qn_lt_data_filenm <- args$imputedQNLTDataFile | |
117 report_file_name <- args$reportFile | |
118 | |
116 imputation_method <- args$imputationMethod | 119 imputation_method <- args$imputationMethod |
117 print( | 120 print( |
118 grepl( | 121 grepl( |
119 pattern = imputation_method, | 122 pattern = imputation_method, |
120 x = c("group-median", "median", "mean", "random") | 123 x = c("group-median", "median", "mean", "random") |
131 ) { | 134 ) { |
132 print(sprintf("bad imputationMethod argument: %s", imputation_method)) | 135 print(sprintf("bad imputationMethod argument: %s", imputation_method)) |
133 return(-1) | 136 return(-1) |
134 } | 137 } |
135 | 138 |
139 # read with default values, when applicable | |
136 mean_percentile <- args$meanPercentile | 140 mean_percentile <- args$meanPercentile |
137 print("mean_percentile is:") | 141 sd_percentile <- args$sdPercentile |
138 cat(str(mean_percentile)) | 142 # in the case of 'random" these values are ignored by the client script |
139 | 143 if (imputation_method == "random") { |
140 sd_percentile <- args$sdPercentile | 144 print("mean_percentile is:") |
141 print("sd_percentile is:") | 145 cat(str(mean_percentile)) |
142 cat(str(mean_percentile)) | 146 |
143 | 147 print("sd_percentile is:") |
144 | 148 cat(str(mean_percentile)) |
145 regex_sample_names <- gsub("^[ \t\n]*", "", | 149 } |
146 readChar(args$regexSampleNames, 1000) | 150 |
147 ) | 151 # convert string parameters that are passed in via config files: |
148 regex_sample_names <- gsub("[ \t\n]*$", "", | 152 # - firstDataColumn |
149 regex_sample_names | 153 # - regexSampleNames |
150 ) | 154 # - regexSampleGrouping |
151 cat(regex_sample_names) | 155 read_config_file_string <- function(fname, limit) { |
152 cat("\n") | 156 # eliminate any leading whitespace |
153 | 157 result <- gsub("^[ \t\n]*", "", readChar(fname, limit)) |
154 regex_sample_grouping <- gsub("^[ \t\n]*", "", | 158 # eliminate any trailing whitespace |
155 readChar(args$regexSampleGrouping, 1000) | 159 result <- gsub("[ \t\n]*$", "", result) |
156 ) | 160 # substitute characters escaped by Galaxy sanitizer |
157 regex_sample_grouping <- gsub("[ \t\n]*$", "", | 161 result <- gsub("__lt__", "<", result) |
158 regex_sample_grouping | 162 result <- gsub("__le__", "<=", result) |
159 ) | 163 result <- gsub("__eq__", "==", result) |
160 cat(regex_sample_grouping) | 164 result <- gsub("__ne__", "!=", result) |
161 cat("\n") | 165 result <- gsub("__gt__", ">", result) |
162 | 166 result <- gsub("__ge__", ">=", result) |
163 imputed_data_file_name <- args$imputedDataFile | 167 result <- gsub("__sq__", "'", result) |
164 imp_qn_lt_data_filenm <- args$imputedQNLTDataFile | 168 result <- gsub("__dq__", '"', result) |
165 report_file_name <- args$reportFile | 169 result <- gsub("__ob__", "[", result) |
166 | 170 result <- gsub("__cb__", "]", result) |
167 print("regex_sample_names is:") | 171 } |
168 cat(str(regex_sample_names)) | 172 cat(paste0("first_data_column file: ", args$firstDataColumn, "\n")) |
169 | 173 cat(paste0("regex_sample_names file: ", args$regexSampleNames, "\n")) |
170 print("regex_sample_grouping is:") | 174 cat(paste0("regex_sample_grouping file: ", args$regexSampleGrouping, "\n")) |
171 cat(str(regex_sample_grouping)) | 175 nc <- 1000 |
176 regex_sample_names <- read_config_file_string(args$regexSampleNames, nc) | |
177 regex_sample_grouping <- read_config_file_string(args$regexSampleGrouping, nc) | |
178 first_data_column <- read_config_file_string(args$firstDataColumn, nc) | |
179 cat(paste0("first_data_column: ", first_data_column, "\n")) | |
180 cat(paste0("regex_sample_names: ", regex_sample_names, "\n")) | |
181 cat(paste0("regex_sample_grouping: ", regex_sample_grouping, "\n")) | |
172 | 182 |
173 # from: https://github.com/molgenis/molgenis-pipelines/wiki/ | 183 # from: https://github.com/molgenis/molgenis-pipelines/wiki/ |
174 # How-to-source-another_file.R-from-within-your-R-script | 184 # How-to-source-another_file.R-from-within-your-R-script |
175 # Function location_of_this_script returns the location of this .R script | 185 # Function location_of_this_script returns the location of this .R script |
176 # (may be needed to source other files in same dir) | 186 # (may be needed to source other files in same dir) |