Mercurial > repos > recetox > ramclustr
annotate ramclustr_wrapper.R @ 11:da7722f665f4 draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
author | recetox |
---|---|
date | Thu, 30 May 2024 14:52:11 +0000 |
parents | 2d94da58904b |
children |
rev | line source |
---|---|
3
2ec9253a647e
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents:
2
diff
changeset
|
1 store_output <- function(ramclustr_obj, |
2ec9253a647e
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents:
2
diff
changeset
|
2 output_merge_msp, |
2ec9253a647e
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents:
2
diff
changeset
|
3 output_spec_abundance, |
2ec9253a647e
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents:
2
diff
changeset
|
4 msp_file) { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
5 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
6 write.table(ramclustr_obj$SpecAbund, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
7 file = output_spec_abundance, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
8 row.names = TRUE, quote = FALSE, col.names = NA, sep = "\t" |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
9 ) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
10 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
11 if (!is.null(msp_file)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
12 exp_name <- ramclustr_obj$ExpDes[[1]][which( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
13 row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment" |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
14 ), 1] |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
15 filename <- paste("spectra/", exp_name, ".msp", sep = "") |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
16 file.copy(from = filename, to = msp_file, overwrite = TRUE) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
17 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
18 } |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
19 |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
20 load_experiment_definition <- function(filename) { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
21 experiment <- RAMClustR::defineExperiment(csv = filename) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
22 return(experiment) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
23 } |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
24 |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
25 read_metadata <- function(filename) { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
26 data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
27 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
28 if (!"qc" %in% colnames(data)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
29 if ("sampleType" %in% colnames(data)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
30 data$qc <- ifelse(data$sampleType == "qc", TRUE, FALSE) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
31 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
32 } |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
33 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
34 if (!"order" %in% colnames(data)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
35 if ("injectionOrder" %in% colnames(data)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
36 names(data)[names(data) == "injectionOrder"] <- "order" |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
37 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
38 } |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
39 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
40 return(data) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
41 } |
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
42 |
4
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
43 read_ramclustr_aplcms <- function(ms1_featuredefinitions = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
44 ms1_featurevalues = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
45 df_phenodata = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
46 phenodata_ext = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
47 exp_des = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
48 st = NULL, |
10
2d94da58904b
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit dc508ea3521991cd42ff6c1aa8aa845b36412771
recetox
parents:
8
diff
changeset
|
49 ensure_no_na = TRUE, |
2d94da58904b
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit dc508ea3521991cd42ff6c1aa8aa845b36412771
recetox
parents:
8
diff
changeset
|
50 ms1_featuredefinitions_ext = "parquet", |
2d94da58904b
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit dc508ea3521991cd42ff6c1aa8aa845b36412771
recetox
parents:
8
diff
changeset
|
51 ms1_featurevalues_ext = "parquet") { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
52 if (ms1_featuredefinitions_ext == "parquet") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
53 ms1_featuredefinitions <- arrow::read_parquet(ms1_featuredefinitions) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
54 } else { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
55 ms1_featuredefinitions <- read.csv(ms1_featuredefinitions, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
56 header = TRUE, sep = "\t", check.names = FALSE |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
57 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
58 } |
10
2d94da58904b
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit dc508ea3521991cd42ff6c1aa8aa845b36412771
recetox
parents:
8
diff
changeset
|
59 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
60 if (ms1_featurevalues_ext == "parquet") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
61 ms1_featurevalues <- arrow::read_parquet(ms1_featurevalues) |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
62 } else { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
63 ms1_featurevalues <- read.csv(ms1_featurevalues, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
64 header = TRUE, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
65 sep = "\t", check.names = FALSE |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
66 ) |
4
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
67 } |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
68 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
69 if (!is.null(df_phenodata)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
70 if (phenodata_ext == "csv") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
71 df_phenodata <- read.csv( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
72 file = df_phenodata, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
73 header = TRUE, check.names = FALSE |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
74 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
75 } else { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
76 df_phenodata <- read.csv( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
77 file = df_phenodata, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
78 header = TRUE, check.names = FALSE, sep = "\t" |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
79 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
80 } |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
81 } |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
82 if (!is.null(exp_des)) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
83 exp_des <- load_experiment_definition(exp_des) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
84 } |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
85 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
86 feature_values <- ms1_featurevalues[-1] |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
87 feature_values <- t(feature_values) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
88 colnames(feature_values) <- ms1_featurevalues[[1]] |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
89 |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
90 feature_definitions <- data.frame(ms1_featuredefinitions) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
91 |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
92 ramclustr_obj <- RAMClustR::rc.get.df.data( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
93 ms1_featureDefinitions = feature_definitions, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
94 ms1_featureValues = feature_values, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
95 phenoData = df_phenodata, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
96 ExpDes = exp_des, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
97 st = st, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
98 ensure.no.na = ensure_no_na |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
99 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
100 return(ramclustr_obj) |
4
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
101 } |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
102 |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
103 apply_normalisation <- function(ramclustr_obj = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
104 normalize_method, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
105 metadata_file = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
106 qc_inj_range, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
107 p_cut, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
108 rsq_cut, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
109 p_adjust) { |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
110 batch <- NULL |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
111 order <- NULL |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
112 qc <- NULL |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
113 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
114 if (normalize_method == "TIC") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
115 ramclustr_obj <- RAMClustR::rc.feature.normalize.tic( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
116 ramclustObj = |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
117 ramclustr_obj |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
118 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
119 } else if (normalize_method == "quantile") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
120 ramclustr_obj <- RAMClustR::rc.feature.normalize.quantile(ramclustr_obj) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
121 } else if (normalize_method == "batch.qc") { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
122 if (!(is.null(metadata_file) || metadata_file == "None")) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
123 metadata <- read_metadata(metadata_file) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
124 batch <- metadata$batch |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
125 order <- metadata$order |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
126 qc <- metadata$qc |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
127 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
128 |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
129 ramclustr_obj <- RAMClustR::rc.feature.normalize.batch.qc( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
130 order = order, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
131 batch = batch, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
132 qc = qc, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
133 ramclustObj = ramclustr_obj, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
134 qc.inj.range = qc_inj_range |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
135 ) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
136 } else { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
137 if (!(is.null(metadata_file) || metadata_file == "None")) { |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
138 metadata <- read_metadata(metadata_file) |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
139 batch <- metadata$batch |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
140 order <- metadata$order |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
141 qc <- metadata$qc |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
142 } |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
143 |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
144 ramclustr_obj <- RAMClustR::rc.feature.normalize.qc( |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
145 order = order, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
146 batch = batch, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
147 qc = qc, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
148 ramclustObj = ramclustr_obj, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
149 p.cut = p_cut, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
150 rsq.cut = rsq_cut, |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
151 p.adjust = p_adjust |
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
152 ) |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
153 } |
11
da7722f665f4
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
10
diff
changeset
|
154 return(ramclustr_obj) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
155 } |