annotate ramclustr_wrapper.R @ 10:2d94da58904b draft

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