comparison ramclustr_wrapper.R @ 5:10ded21d47c0 draft

"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 3d2821ffc97cc4f9287ee83bbddb306a8034daa0"
author recetox
date Fri, 11 Feb 2022 14:14:38 +0000
parents 69e0da4703b5
children d9bcc43023c5
comparison
equal deleted inserted replaced
4:69e0da4703b5 5:10ded21d47c0
1 store_output <- function( 1 store_output <- function(
2 ramclustr_obj, 2 ramclustr_obj,
3 output_filename,
4 output_method_metadata,
5 output_merge_msp, 3 output_merge_msp,
6 output_spec_abundance) { 4 output_spec_abundance,
7 save(ramclustr_obj, file = output_filename) 5 msp_file) {
8 RAMClustR::write.methods(ramclustr_obj, output_method_metadata)
9 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp) 6 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp)
10 write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE) 7 write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE)
8
9 if (!is.null(msp_file)) {
10 exp.name <- ramclustr_obj$ExpDes[[1]][which(row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"), 1]
11 filename <- paste("spectra/", exp.name, ".msp", sep = "")
12 file.copy(from = filename, to = msp_file, overwrite = TRUE)
13 }
11 } 14 }
12 15
13 load_experiment_definition <- function(filename) { 16 load_experiment_definition <- function(filename) {
14 experiment <- RAMClustR::defineExperiment(csv = filename) 17 experiment <- RAMClustR::defineExperiment(csv = filename)
15 return(experiment) 18 return(experiment)
33 return(data) 36 return(data)
34 } 37 }
35 38
36 ramclustr_xcms <- function( 39 ramclustr_xcms <- function(
37 input_xcms, 40 input_xcms,
41 use_pheno,
38 sr, 42 sr,
43 st = NULL,
44 cor_method,
45 maxt,
46 linkage,
47 min_module_size,
48 hmax,
39 deep_split, 49 deep_split,
50 normalize,
51 metadata_file = NULL,
52 qc_inj_range,
40 block_size, 53 block_size,
41 mult, 54 mult,
42 hmax,
43 collapse,
44 use_pheno,
45 qc_inj_range,
46 normalize,
47 min_module_size,
48 linkage,
49 mzdec, 55 mzdec,
50 cor_method,
51 rt_only_low_n, 56 rt_only_low_n,
52 replace_zeros, 57 replace_zeros,
53 st = NULL,
54 maxt = NULL,
55 fftempdir = NULL,
56 metadata_file = NULL,
57 exp_design = NULL 58 exp_design = NULL
58 ) { 59 ) {
59 obj <- load(input_xcms) 60 obj <- load(input_xcms)
60 61
61 batch <- NULL 62 batch <- NULL
82 sr = sr, 83 sr = sr,
83 deepSplit = deep_split, 84 deepSplit = deep_split,
84 blocksize = block_size, 85 blocksize = block_size,
85 mult = mult, 86 mult = mult,
86 hmax = hmax, 87 hmax = hmax,
87 collapse = collapse,
88 usePheno = use_pheno, 88 usePheno = use_pheno,
89 mspout = FALSE, 89 mspout = FALSE,
90 qc.inj.range = qc_inj_range, 90 qc.inj.range = qc_inj_range,
91 normalize = normalize, 91 normalize = normalize,
92 minModuleSize = min_module_size, 92 minModuleSize = min_module_size,
93 linkage = linkage, 93 linkage = linkage,
94 mzdec = mzdec, 94 mzdec = mzdec,
95 cor.method = cor_method, 95 cor.method = cor_method,
96 rt.only.low.n = rt_only_low_n, 96 rt.only.low.n = rt_only_low_n,
97 fftempdir = fftempdir, 97 fftempdir = NULL,
98 replace.zeros = replace_zeros, 98 replace.zeros = replace_zeros,
99 batch = batch, 99 batch = batch,
100 order = order, 100 order = order,
101 qc = qc, 101 qc = qc,
102 ExpDes = experiment 102 ExpDes = experiment
105 } 105 }
106 106
107 ramclustr_csv <- function( 107 ramclustr_csv <- function(
108 ms, 108 ms,
109 idmsms, 109 idmsms,
110 sample_name_column,
111 feature_delimiter,
112 retention_time_column,
113 sr, 110 sr,
111 st,
112 cor_method,
113 maxt,
114 linkage,
115 min_module_size,
116 hmax,
114 deep_split, 117 deep_split,
118 normalize,
119 metadata_file = NULL,
120 qc_inj_range,
115 block_size, 121 block_size,
116 mult, 122 mult,
117 hmax,
118 collapse,
119 use_pheno,
120 qc_inj_range,
121 normalize,
122 min_module_size,
123 linkage,
124 mzdec, 123 mzdec,
125 cor_method,
126 rt_only_low_n, 124 rt_only_low_n,
127 replace_zeros, 125 replace_zeros,
128 st = NULL,
129 maxt = NULL,
130 fftempdir = NULL,
131 metadata_file = NULL,
132 exp_design = NULL 126 exp_design = NULL
133 ) { 127 ) {
134 if (!file.exists(idmsms)) 128 if (!file.exists(idmsms))
135 idmsms <- NULL 129 idmsms <- NULL
136 130
152 } 146 }
153 147
154 x <- RAMClustR::ramclustR( 148 x <- RAMClustR::ramclustR(
155 ms = ms, 149 ms = ms,
156 idmsms = idmsms, 150 idmsms = idmsms,
157 featdelim = feature_delimiter,
158 timepos = retention_time_column,
159 sampNameCol = sample_name_column,
160 st = st, 151 st = st,
161 maxt = maxt, 152 maxt = maxt,
162 sr = sr, 153 sr = sr,
163 deepSplit = deep_split, 154 deepSplit = deep_split,
164 blocksize = block_size, 155 blocksize = block_size,
165 mult = mult, 156 mult = mult,
166 hmax = hmax, 157 hmax = hmax,
167 collapse = collapse,
168 usePheno = use_pheno,
169 mspout = FALSE, 158 mspout = FALSE,
170 qc.inj.range = qc_inj_range, 159 qc.inj.range = qc_inj_range,
171 normalize = normalize, 160 normalize = normalize,
172 minModuleSize = min_module_size, 161 minModuleSize = min_module_size,
173 linkage = linkage, 162 linkage = linkage,
174 mzdec = mzdec, 163 mzdec = mzdec,
175 cor.method = cor_method, 164 cor.method = cor_method,
176 rt.only.low.n = rt_only_low_n, 165 rt.only.low.n = rt_only_low_n,
177 fftempdir = fftempdir, 166 fftempdir = NULL,
178 replace.zeros = replace_zeros, 167 replace.zeros = replace_zeros,
179 batch = batch, 168 batch = batch,
180 order = order, 169 order = order,
181 qc = qc, 170 qc = qc,
182 ExpDes = experiment 171 ExpDes = experiment