diff xcms.r @ 29:c013ed353a2f draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
author lecorguille
date Tue, 13 Feb 2018 04:44:03 -0500
parents 30410a052ab3
children
line wrap: on
line diff
--- a/xcms.r	Thu Oct 26 11:16:24 2017 -0400
+++ b/xcms.r	Tue Feb 13 04:44:03 2018 -0500
@@ -13,7 +13,7 @@
 # ----- PACKAGE -----
 cat("\tPACKAGE INFO\n")
 #pkgs=c("xcms","batch")
-pkgs=c("tools","parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")
+pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")
 for(pkg in pkgs) {
     suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
     cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="")
@@ -65,6 +65,10 @@
 }
 
 #saving the specific parameters
+rplotspdf = "Rplots.pdf"
+if (!is.null(listArguments[["rplotspdf"]])){
+    rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL
+}
 sampleMetadataOutput = "sampleMetadata.tsv"
 if (!is.null(listArguments[["sampleMetadataOutput"]])){
     sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL
@@ -90,6 +94,11 @@
     intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL
 }
 
+if (thefunction %in% c("xcmsSet","retcor")) {
+    ticspdf = listArguments[["ticspdf"]]; listArguments[["ticspdf"]]=NULL
+    bicspdf = listArguments[["bicspdf"]]; listArguments[["bicspdf"]]=NULL
+}
+
 
 if (thefunction %in% c("xcmsSet","retcor","fillPeaks"))  {
     if (!exists("singlefile")) singlefile=NULL
@@ -138,7 +147,7 @@
 
 #change the default display settings
 #dev.new(file="Rplots.pdf", width=16, height=12)
-pdf(file="Rplots.pdf", width=16, height=12)
+pdf(file=rplotspdf, width=16, height=12)
 if (thefunction == "group") {
     par(mfrow=c(2,2))
 }
@@ -188,12 +197,12 @@
 if (thefunction == "xcmsSet") {
     cat("\t\tGET TIC GRAPH\n")
     sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput)
-    getTICs(xcmsSet=xset, rt="raw")
-    getBPCs(xcmsSet=xset, rt="raw")
+    getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw")
+    getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf)
 } else if (thefunction == "retcor") {
     cat("\t\tGET TIC GRAPH\n")
-    getTICs(xcmsSet=xset, rt="corrected")
-    getBPCs(xcmsSet=xset, rt="corrected")
+    getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected")
+    getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf)
 }
 
 if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) {