Mercurial > repos > recetox > waveica
annotate waveica_wrapper.R @ 6:cf3f2f964d80 draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
| author | recetox |
|---|---|
| date | Thu, 29 Sep 2022 15:20:18 +0000 |
| parents | 8b55efc7d117 |
| children | 385b1221be44 |
| rev | line source |
|---|---|
|
6
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
1 read_file <- function(file, metadata, ft_ext, mt_ext) { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
2 data <- read_data(file, ft_ext) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
3 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
4 if (!is.na(metadata)) { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
5 mt_data <- read_data(metadata, mt_ext) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
6 data <- merge(mt_data, data, by = "sampleName") |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
7 } |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
8 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
9 return(data) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
10 } |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
11 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
12 read_data <- function(file, ext) { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
13 if (ext == "csv") { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
14 data <- read.csv(file, header = TRUE) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
15 } else if (ext == "tsv") { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
16 data <- read.csv(file, header = TRUE, sep = "\t") |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
17 } else { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
18 data <- arrow::read_parquet(file) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
19 } |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
20 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
21 return(data) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
22 } |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
23 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
24 waveica <- function(file, |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
25 metadata = NA, |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
26 ext, |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
27 wavelet_filter, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
28 wavelet_length, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
29 k, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
30 t, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
31 t2, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
32 alpha, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
33 exclude_blanks) { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
34 |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
35 # get input from the Galaxy, preprocess data |
|
6
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
36 ext <- strsplit(x = ext, split = "\\,")[[1]] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
37 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
38 ft_ext <- ext[1] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
39 mt_ext <- ext[2] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
40 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
41 data <- read_file(file, metadata, ft_ext, mt_ext) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
42 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
43 required_columns <- c("sampleName", "class", "sampleType", "injectionOrder", "batch") |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
44 verify_input_dataframe(data, required_columns) |
|
1
2bcfd5b450bb
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit c52cdb1ab3c4e65ce3b55e29739f16abb8bfd6eb"
recetox
parents:
0
diff
changeset
|
45 |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
46 data <- sort_by_injection_order(data) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
47 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
48 # separate data into features, batch and group |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
49 feature_columns <- colnames(data)[!colnames(data) %in% required_columns] |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
50 features <- data[, feature_columns] |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
51 group <- enumerate_groups(as.character(data$sampleType)) |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
52 batch <- data$batch |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
53 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
54 # run WaveICA |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
55 features <- recetox.waveica::waveica( |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
56 data = features, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
57 wf = get_wf(wavelet_filter, wavelet_length), |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
58 batch = batch, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
59 group = group, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
60 K = k, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
61 t = t, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
62 t2 = t2, |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
63 alpha = alpha |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
64 ) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
65 |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
66 data[, feature_columns] <- features |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
67 |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
68 # remove blanks from dataset |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
69 if (exclude_blanks) { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
70 data <- exclude_group(data, group) |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
71 } |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
72 |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
73 return(data) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
74 } |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
75 |
|
6
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
76 waveica_singlebatch <- function(file, |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
77 metadata = NA, |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
78 ext, |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
79 wavelet_filter, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
80 wavelet_length, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
81 k, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
82 alpha, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
83 cutoff, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
84 exclude_blanks) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
85 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
86 # get input from the Galaxy, preprocess data |
|
6
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
87 ext <- strsplit(x = ext, split = "\\,")[[1]] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
88 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
89 ft_ext <- ext[1] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
90 mt_ext <- ext[2] |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
91 |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
92 data <- read_file(file, metadata, ft_ext, mt_ext) |
|
4
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
93 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
94 required_columns <- c("sampleName", "class", "sampleType", "injectionOrder") |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
95 optional_columns <- c("batch") |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
96 verify_input_dataframe(data, required_columns) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
97 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
98 data <- sort_by_injection_order(data) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
99 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
100 feature_columns <- colnames(data)[!colnames(data) %in% c(required_columns, optional_columns)] |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
101 features <- data[, feature_columns] |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
102 injection_order <- data$injectionOrder |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
103 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
104 # run WaveICA |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
105 features <- recetox.waveica::waveica_nonbatchwise( |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
106 data = features, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
107 wf = get_wf(wavelet_filter, wavelet_length), |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
108 injection_order = injection_order, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
109 K = k, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
110 alpha = alpha, |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
111 cutoff = cutoff |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
112 ) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
113 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
114 data[, feature_columns] <- features |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
115 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
116 # remove blanks from dataset |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
117 if (exclude_blanks) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
118 data <- exclude_group(data, group) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
119 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
120 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
121 return(data) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
122 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
123 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
124 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
125 sort_by_injection_order <- function(data) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
126 if ("batch" %in% colnames(data)) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
127 data <- data[order(data[, "batch"], |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
128 data[, "injectionOrder"], |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
129 decreasing = FALSE |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
130 ), ] |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
131 } else { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
132 data <- data[order(data[, "injectionOrder"], |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
133 decreasing = FALSE |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
134 ), ] |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
135 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
136 return(data) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
137 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
138 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
139 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
140 verify_input_dataframe <- function(data, required_columns) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
141 if (anyNA(data)) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
142 stop("Error: dataframe cannot contain NULL values! |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
143 Make sure that your dataframe does not contain empty cells") |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
144 } else if (!all(required_columns %in% colnames(data))) { |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
145 stop("Error: missing metadata! |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
146 Make sure that the following columns are present in your dataframe: ", paste(required_columns, collapse = ", ")) |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
147 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
148 } |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
149 |
|
8b55efc7d117
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit aa8206a01efc1813f2586584782f28a73a17fe86"
recetox
parents:
2
diff
changeset
|
150 |
|
1
2bcfd5b450bb
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit c52cdb1ab3c4e65ce3b55e29739f16abb8bfd6eb"
recetox
parents:
0
diff
changeset
|
151 # Match group labels with [blank/sample/qc] and enumerate them |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
152 enumerate_groups <- function(group) { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
153 group[grepl("blank", tolower(group))] <- 0 |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
154 group[grepl("sample", tolower(group))] <- 1 |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
155 group[grepl("qc", tolower(group))] <- 2 |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
156 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
157 return(group) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
158 } |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
159 |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
160 |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
161 # Create appropriate input for R wavelets function |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
162 get_wf <- function(wavelet_filter, wavelet_length) { |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
163 wf <- paste(wavelet_filter, wavelet_length, sep = "") |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
164 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
165 # exception to the wavelet function |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
166 if (wf == "d2") { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
167 wf <- "haar" |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
168 } |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
169 |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
170 return(wf) |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
171 } |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
172 |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
173 |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
174 # Exclude blanks from a dataframe |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
175 exclude_group <- function(data, group) { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
176 row_idx_to_exclude <- which(group %in% 0) |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
177 if (length(row_idx_to_exclude) > 0) { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
178 data_without_blanks <- data[-c(row_idx_to_exclude), ] |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
179 cat("Blank samples have been excluded from the dataframe.\n") |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
180 return(data_without_blanks) |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
181 } else { |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
182 return(data) |
|
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
183 } |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
184 } |
|
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
185 |
|
6
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
186 store_data <- function(data, output, ext) { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
187 if (ext == "csv") { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
188 write.csv(data, file = output, row.names = FALSE, quote = FALSE) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
189 } else if (ext == "tsv") { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
190 write.table(data, file = output, sep = "\t", row.names = FALSE, quote = FALSE) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
191 } else { |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
192 arrow::write_parquet(data, sink = output) |
|
cf3f2f964d80
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit d82e7dad96bebe9424ac7bf490e2786d82c3681a
recetox
parents:
4
diff
changeset
|
193 } |
|
2
d08deef1eb44
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit e33ef984e78721ed37d825c6672795a539a461e1"
recetox
parents:
1
diff
changeset
|
194 cat("Normalization has been completed.\n") |
|
0
2461d20911c9
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 91376ea7a6736351b0cc086ca1bc6c553fdcda97"
recetox
parents:
diff
changeset
|
195 } |
