Mercurial > repos > recetox > ramclustr
annotate ramclustr_wrapper.R @ 7:09cabbc3d12d draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
author | recetox |
---|---|
date | Thu, 12 Oct 2023 13:30:54 +0000 |
parents | 050cfef6ba65 |
children | c043e1fd79d1 |
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) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
6 write.csv(ramclustr_obj$SpecAbund, |
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, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
8 row.names = TRUE, quote = FALSE |
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, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
49 ensure_no_na = TRUE) { |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
50 ms1_featuredefinitions <- arrow::read_parquet(ms1_featuredefinitions) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
51 ms1_featurevalues <- arrow::read_parquet(ms1_featurevalues) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
52 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 file = df_phenodata, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
57 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
|
58 ) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
59 } else { |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
60 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
|
61 file = df_phenodata, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
62 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
|
63 ) |
4
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
64 } |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
65 } |
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(exp_des)) { |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
67 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
|
68 } |
4
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
69 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
74 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
|
75 |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 phenoData = df_phenodata, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
80 ExpDes = exp_des, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
81 st = st, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
82 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
|
83 ) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
84 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
|
85 } |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
86 |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
87 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
|
88 normalize_method, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
89 metadata_file = NULL, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
90 qc_inj_range, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
91 p_cut, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
92 rsq_cut, |
050cfef6ba65
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents:
3
diff
changeset
|
93 p_adjust) { |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
94 batch <- NULL |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
95 order <- NULL |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
96 qc <- NULL |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
97 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
98 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
|
99 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
|
100 ramclustObj = |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
101 ramclustr_obj |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
102 ) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
103 } 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
|
104 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
|
105 } 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
|
106 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
|
107 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
|
108 batch <- metadata$batch |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
109 order <- metadata$order |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
110 qc <- metadata$qc |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
111 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
112 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
113 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
|
114 order = order, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
115 batch = batch, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
116 qc = qc, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
117 ramclustObj = ramclustr_obj, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
118 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
|
119 ) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
120 } else { |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
121 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
|
122 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
|
123 batch <- metadata$batch |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
124 order <- metadata$order |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
125 qc <- metadata$qc |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
126 } |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
127 |
7
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
128 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
|
129 order = order, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
130 batch = batch, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
131 qc = qc, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
132 ramclustObj = ramclustr_obj, |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 ) |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
137 } |
09cabbc3d12d
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
recetox
parents:
4
diff
changeset
|
138 return(ramclustr_obj) |
0
36104baf75da
"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 4d2ac914c951166e386a94d8ebb8cb1becfac122"
recetox
parents:
diff
changeset
|
139 } |