diff xcms_merge.r @ 3:f439ed7a8f03 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
author lecorguille
date Tue, 18 Sep 2018 16:09:25 -0400
parents
children a26679f68d4d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_merge.r	Tue Sep 18 16:09:25 2018 -0400
@@ -0,0 +1,45 @@
+#!/usr/bin/env Rscript
+
+#Import the different functions
+source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
+source_local("lib.r")
+source_local("lib-xcms3.x.x.r")
+
+pkgs <- c("xcms","batch")
+loadAndDisplayPackages(pkgs)
+cat("\n\n");
+
+args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
+
+
+cat("\tXSET MERGING...\n")
+
+mergeXDataReturn <- mergeXData(args)
+xdata <- mergeXDataReturn$xdata
+singlefile <- mergeXDataReturn$singlefile
+md5sumList <- mergeXDataReturn$md5sumList
+sampleNamesList <- mergeXDataReturn$sampleNamesList
+chromTIC <- mergeXDataReturn$chromTIC
+chromBPI <- mergeXDataReturn$chromBPI
+
+# Create a sampleMetada file
+sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv")
+
+cat("\n\n")
+
+cat("\tXCMSnExp OBJECT INFO\n")
+print(pData(xdata))
+print(xdata)
+cat("\n\n")
+
+cat("\txcmsSet OBJECT INFO\n")
+# Get the legacy xcmsSet object
+xset <- getxcmsSetObject(xdata)
+print(xset@phenoData)
+print(xset)
+cat("\n\n")
+
+cat("\tSAVE RData\n")
+#saving R data in .Rdata file to save the variables used in the present tool
+objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList", "chromTIC", "chromBPI")
+save(list=objects2save[objects2save %in% ls()], file="merged.RData")