annotate ramclustr_wrapper.R @ 12:844e308330c4 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit f79a5b51599254817727bc9028b9797ea994cb4e
author recetox
date Tue, 27 Jun 2023 14:23:19 +0000
parents 62bf6ef633d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
308bd645da47 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents: 8
diff changeset
1 store_output <- function(ramclustr_obj,
308bd645da47 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents: 8
diff changeset
2 output_merge_msp,
308bd645da47 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents: 8
diff changeset
3 output_spec_abundance,
308bd645da47 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
recetox
parents: 8
diff changeset
4 msp_file) {
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
5 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp)
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
6 write.csv(ramclustr_obj$SpecAbund,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
7 file = output_spec_abundance,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
8 row.names = TRUE, quote = FALSE
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
9 )
5
10ded21d47c0 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 3d2821ffc97cc4f9287ee83bbddb306a8034daa0"
recetox
parents: 4
diff changeset
10
10ded21d47c0 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 3d2821ffc97cc4f9287ee83bbddb306a8034daa0"
recetox
parents: 4
diff changeset
11 if (!is.null(msp_file)) {
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
12 exp_name <- ramclustr_obj$ExpDes[[1]][which(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
13 row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
14 ), 1]
8
d9bcc43023c5 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c321421a07bfdcc9ed423e9ed2ee794157984ba1
recetox
parents: 5
diff changeset
15 filename <- paste("spectra/", exp_name, ".msp", sep = "")
5
10ded21d47c0 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 3d2821ffc97cc4f9287ee83bbddb306a8034daa0"
recetox
parents: 4
diff changeset
16 file.copy(from = filename, to = msp_file, overwrite = TRUE)
10ded21d47c0 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 3d2821ffc97cc4f9287ee83bbddb306a8034daa0"
recetox
parents: 4
diff changeset
17 }
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
18 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
19
4
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
20 load_experiment_definition <- function(filename) {
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
21 experiment <- RAMClustR::defineExperiment(csv = filename)
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
22 return(experiment)
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
23 }
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
24
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
25 read_metadata <- function(filename) {
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
26 data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE)
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
27
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
28 if (!"qc" %in% colnames(data)) {
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
29 if ("sampleType" %in% colnames(data)) {
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
30 data$qc <- ifelse(data$sampleType == "qc", TRUE, FALSE)
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
31 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
32 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
33
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
34 if (!"order" %in% colnames(data)) {
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
35 if ("injectionOrder" %in% colnames(data)) {
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
36 names(data)[names(data) == "injectionOrder"] <- "order"
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
37 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
38 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
39
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
40 return(data)
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
41 }
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
42
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
43 read_ramclustr_aplcms <- function(ms1_featuredefinitions = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
44 ms1_featurevalues = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
45 df_phenodata = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
46 phenodata_ext = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
47 exp_des = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
48 st = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
49 ensure_no_na = TRUE) {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
50 ms1_featuredefinitions <- arrow::read_parquet(ms1_featuredefinitions)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
51 ms1_featurevalues <- arrow::read_parquet(ms1_featurevalues)
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
52
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
53 if (!is.null(df_phenodata)) {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
54 if (phenodata_ext == "csv") {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
55 df_phenodata <- read.csv(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
56 file = df_phenodata,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
57 header = TRUE, check.names = FALSE
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
58 )
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
59 } else {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
60 df_phenodata <- read.csv(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
61 file = df_phenodata,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
62 header = TRUE, check.names = FALSE, sep = "\t"
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
63 )
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
64 }
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
65 }
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
66 if (!is.null(exp_des)) {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
67 exp_des <- load_experiment_definition(exp_des)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
68 }
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
69
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
70 feature_values <- ms1_featurevalues[-1]
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
71 feature_values <- t(feature_values)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
72 colnames(feature_values) <- ms1_featurevalues[[1]]
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
73
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
74 feature_definitions <- data.frame(ms1_featuredefinitions)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
75
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
76 ramclustr_obj <- RAMClustR::rc.get.df.data(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
77 ms1_featureDefinitions = feature_definitions,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
78 ms1_featureValues = feature_values,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
79 phenoData = df_phenodata,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
80 ExpDes = exp_des,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
81 st = st,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
82 ensure.no.na = ensure_no_na
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
83 )
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
84 return(ramclustr_obj)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
85 }
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
86
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
87 apply_normalisation <- function(ramclustr_obj = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
88 normalize_method,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
89 metadata_file = NULL,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
90 qc_inj_range,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
91 p_cut,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
92 rsq_cut,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
93 p_adjust) {
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
94 batch <- NULL
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
95 order <- NULL
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
96 qc <- NULL
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
97
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
98 if (normalize_method == "TIC") {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
99 ramclustr_obj <- RAMClustR::rc.feature.normalize.tic(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
100 ramclustObj =
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
101 ramclustr_obj
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
102 )
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
103 } else if (normalize_method == "quantile") {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
104 ramclustr_obj <- RAMClustR::rc.feature.normalize.quantile(ramclustr_obj)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
105 } else if (normalize_method == "batch.qc") {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
106 if (!(is.null(metadata_file) || metadata_file == "None")) {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
107 metadata <- read_metadata(metadata_file)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
108 batch <- metadata$batch
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
109 order <- metadata$order
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
110 qc <- metadata$qc
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
111 }
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
112
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
113 ramclustr_obj <- RAMClustR::rc.feature.normalize.batch.qc(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
114 order = order,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
115 batch = batch,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
116 qc = qc,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
117 ramclustObj = ramclustr_obj,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
118 qc.inj.range = qc_inj_range
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
119 )
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
120 } else {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
121 if (!(is.null(metadata_file) || metadata_file == "None")) {
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
122 metadata <- read_metadata(metadata_file)
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
123 batch <- metadata$batch
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
124 order <- metadata$order
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
125 qc <- metadata$qc
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
126 }
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
127
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
128 ramclustr_obj <- RAMClustR::rc.feature.normalize.qc(
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
129 order = order,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
130 batch = batch,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
131 qc = qc,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
132 ramclustObj = ramclustr_obj,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
133 p.cut = p_cut,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
134 rsq.cut = rsq_cut,
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
135 p.adjust = p_adjust
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
136 )
4
69e0da4703b5 "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
recetox
parents: 0
diff changeset
137 }
10
62bf6ef633d0 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 981ab05cdced6cbcbb1f13aa492e127365a4e9ed
recetox
parents: 9
diff changeset
138 return(ramclustr_obj)
0
cb0b83b330fd "planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit c69f8d9772bdb9fb3cc9473651397cd6bb877020"
recetox
parents:
diff changeset
139 }