diff ramclustr_wrapper.R @ 4:69e0da4703b5 draft

"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
author recetox
date Fri, 04 Feb 2022 08:31:26 +0000
parents cb0b83b330fd
children 10ded21d47c0
line wrap: on
line diff
--- a/ramclustr_wrapper.R	Fri Jan 28 16:25:33 2022 +0000
+++ b/ramclustr_wrapper.R	Fri Feb 04 08:31:26 2022 +0000
@@ -10,6 +10,11 @@
     write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE)
 }
 
+load_experiment_definition <- function(filename) {
+    experiment <- RAMClustR::defineExperiment(csv = filename)
+    return(experiment)
+}
+
 read_metadata <- function(filename) {
     data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE)
 
@@ -48,7 +53,8 @@
     st = NULL,
     maxt = NULL,
     fftempdir = NULL,
-    metadata_file = NULL
+    metadata_file = NULL,
+    exp_design = NULL
 ) {
     obj <- load(input_xcms)
 
@@ -63,6 +69,12 @@
         qc <- metadata$qc
     }
 
+    experiment <- NULL
+
+    if (!is.null(exp_design)) {
+        experiment <- load_experiment_definition(exp_design)
+    }
+
     x <- RAMClustR::ramclustR(
         xcmsObj = xdata,
         st = st,
@@ -86,7 +98,8 @@
         replace.zeros = replace_zeros,
         batch = batch,
         order = order,
-        qc = qc
+        qc = qc,
+        ExpDes = experiment
         )
     return(x)
 }
@@ -115,7 +128,8 @@
     st = NULL,
     maxt = NULL,
     fftempdir = NULL,
-    metadata_file = NULL
+    metadata_file = NULL,
+    exp_design = NULL
 ) {
     if (!file.exists(idmsms))
         idmsms <- NULL
@@ -131,6 +145,12 @@
         qc <- metadata$qc
     }
 
+    experiment <- NULL
+
+    if (!is.null(exp_design)) {
+        experiment <- load_experiment_definition(exp_design)
+    }
+
     x <- RAMClustR::ramclustR(
         ms = ms,
         idmsms = idmsms,
@@ -158,7 +178,8 @@
         replace.zeros = replace_zeros,
         batch = batch,
         order = order,
-        qc = qc
+        qc = qc,
+        ExpDes = experiment
         )
         return(x)
 }