comparison ramclustr_wrapper.R @ 3:2ec9253a647e draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit 8714723083359049eb1a715a946851e07f8a3a20
author recetox
date Tue, 20 Sep 2022 14:43:56 +0000
parents 75dafb766417
children 050cfef6ba65
comparison
equal deleted inserted replaced
2:75dafb766417 3:2ec9253a647e
1 store_output <- function( 1 store_output <- function(ramclustr_obj,
2 ramclustr_obj, 2 output_merge_msp,
3 output_merge_msp, 3 output_spec_abundance,
4 output_spec_abundance, 4 msp_file) {
5 msp_file) {
6 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp) 5 RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp)
7 write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE) 6 write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE, quote = FALSE)
8 7
9 if (!is.null(msp_file)) { 8 if (!is.null(msp_file)) {
10 exp_name <- ramclustr_obj$ExpDes[[1]][which(row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"), 1] 9 exp_name <- ramclustr_obj$ExpDes[[1]][which(row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"), 1]
11 filename <- paste("spectra/", exp_name, ".msp", sep = "") 10 filename <- paste("spectra/", exp_name, ".msp", sep = "")
12 file.copy(from = filename, to = msp_file, overwrite = TRUE) 11 file.copy(from = filename, to = msp_file, overwrite = TRUE)
34 } 33 }
35 34
36 return(data) 35 return(data)
37 } 36 }
38 37
39 ramclustr_xcms <- function( 38 ramclustr_xcms <- function(input_xcms,
40 input_xcms, 39 use_pheno,
41 use_pheno, 40 sr,
42 sr, 41 st = NULL,
43 st = NULL, 42 cor_method,
44 cor_method, 43 maxt,
45 maxt, 44 linkage,
46 linkage, 45 min_module_size,
47 min_module_size, 46 hmax,
48 hmax, 47 deep_split,
49 deep_split, 48 normalize,
50 normalize, 49 metadata_file = NULL,
51 metadata_file = NULL, 50 qc_inj_range,
52 qc_inj_range, 51 block_size,
53 block_size, 52 mult,
54 mult, 53 mzdec,
55 mzdec, 54 rt_only_low_n,
56 rt_only_low_n, 55 replace_zeros,
57 replace_zeros, 56 exp_design = NULL) {
58 exp_design = NULL
59 ) {
60 obj <- load(input_xcms) 57 obj <- load(input_xcms)
61 58
62 batch <- NULL 59 batch <- NULL
63 order <- NULL 60 order <- NULL
64 qc <- NULL 61 qc <- NULL
98 replace.zeros = replace_zeros, 95 replace.zeros = replace_zeros,
99 batch = batch, 96 batch = batch,
100 order = order, 97 order = order,
101 qc = qc, 98 qc = qc,
102 ExpDes = experiment 99 ExpDes = experiment
103 ) 100 )
104 return(x) 101 return(x)
105 } 102 }
106 103
107 ramclustr_csv <- function( 104 ramclustr_csv <- function(ms,
108 ms, 105 idmsms,
109 idmsms, 106 sr,
110 sr, 107 st,
111 st, 108 cor_method,
112 cor_method, 109 maxt,
113 maxt, 110 linkage,
114 linkage, 111 min_module_size,
115 min_module_size, 112 hmax,
116 hmax, 113 deep_split,
117 deep_split, 114 normalize,
118 normalize, 115 metadata_file = NULL,
119 metadata_file = NULL, 116 qc_inj_range,
120 qc_inj_range, 117 block_size,
121 block_size, 118 mult,
122 mult, 119 mzdec,
123 mzdec, 120 rt_only_low_n,
124 rt_only_low_n, 121 replace_zeros,
125 replace_zeros, 122 exp_design = NULL) {
126 exp_design = NULL 123 if (!file.exists(idmsms)) {
127 ) {
128 if (!file.exists(idmsms))
129 idmsms <- NULL 124 idmsms <- NULL
125 }
130 126
131 batch <- NULL 127 batch <- NULL
132 order <- NULL 128 order <- NULL
133 qc <- NULL 129 qc <- NULL
134 130
167 replace.zeros = replace_zeros, 163 replace.zeros = replace_zeros,
168 batch = batch, 164 batch = batch,
169 order = order, 165 order = order,
170 qc = qc, 166 qc = qc,
171 ExpDes = experiment 167 ExpDes = experiment
172 ) 168 )
173 return(x) 169 return(x)
174 } 170 }