Mercurial > repos > lecorguille > xcms_group
comparison xcms.r @ 28:a18fc7554c6d draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
author | lecorguille |
---|---|
date | Tue, 13 Feb 2018 04:43:21 -0500 |
parents | 36b470f3ebcf |
children |
comparison
equal
deleted
inserted
replaced
27:36b470f3ebcf | 28:a18fc7554c6d |
---|---|
11 | 11 |
12 | 12 |
13 # ----- PACKAGE ----- | 13 # ----- PACKAGE ----- |
14 cat("\tPACKAGE INFO\n") | 14 cat("\tPACKAGE INFO\n") |
15 #pkgs=c("xcms","batch") | 15 #pkgs=c("xcms","batch") |
16 pkgs=c("tools","parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch") | 16 pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch") |
17 for(pkg in pkgs) { | 17 for(pkg in pkgs) { |
18 suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE))) | 18 suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE))) |
19 cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="") | 19 cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="") |
20 } | 20 } |
21 source_local <- function(fname){ argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } | 21 source_local <- function(fname){ argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } |
63 if (!is.null(listArguments[["xsetRdataOutput"]])){ | 63 if (!is.null(listArguments[["xsetRdataOutput"]])){ |
64 xsetRdataOutput = listArguments[["xsetRdataOutput"]]; listArguments[["xsetRdataOutput"]]=NULL | 64 xsetRdataOutput = listArguments[["xsetRdataOutput"]]; listArguments[["xsetRdataOutput"]]=NULL |
65 } | 65 } |
66 | 66 |
67 #saving the specific parameters | 67 #saving the specific parameters |
68 rplotspdf = "Rplots.pdf" | |
69 if (!is.null(listArguments[["rplotspdf"]])){ | |
70 rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL | |
71 } | |
68 sampleMetadataOutput = "sampleMetadata.tsv" | 72 sampleMetadataOutput = "sampleMetadata.tsv" |
69 if (!is.null(listArguments[["sampleMetadataOutput"]])){ | 73 if (!is.null(listArguments[["sampleMetadataOutput"]])){ |
70 sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL | 74 sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL |
71 } | 75 } |
72 variableMetadataOutput = "variableMetadata.tsv" | 76 variableMetadataOutput = "variableMetadata.tsv" |
86 if (!is.null(listArguments[["numDigitsRT"]])){ | 90 if (!is.null(listArguments[["numDigitsRT"]])){ |
87 numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL | 91 numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL |
88 } | 92 } |
89 if (!is.null(listArguments[["intval"]])){ | 93 if (!is.null(listArguments[["intval"]])){ |
90 intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL | 94 intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL |
95 } | |
96 | |
97 if (thefunction %in% c("xcmsSet","retcor")) { | |
98 ticspdf = listArguments[["ticspdf"]]; listArguments[["ticspdf"]]=NULL | |
99 bicspdf = listArguments[["bicspdf"]]; listArguments[["bicspdf"]]=NULL | |
91 } | 100 } |
92 | 101 |
93 | 102 |
94 if (thefunction %in% c("xcmsSet","retcor","fillPeaks")) { | 103 if (thefunction %in% c("xcmsSet","retcor","fillPeaks")) { |
95 if (!exists("singlefile")) singlefile=NULL | 104 if (!exists("singlefile")) singlefile=NULL |
136 | 145 |
137 } | 146 } |
138 | 147 |
139 #change the default display settings | 148 #change the default display settings |
140 #dev.new(file="Rplots.pdf", width=16, height=12) | 149 #dev.new(file="Rplots.pdf", width=16, height=12) |
141 pdf(file="Rplots.pdf", width=16, height=12) | 150 pdf(file=rplotspdf, width=16, height=12) |
142 if (thefunction == "group") { | 151 if (thefunction == "group") { |
143 par(mfrow=c(2,2)) | 152 par(mfrow=c(2,2)) |
144 } | 153 } |
145 #else if (thefunction == "retcor") { | 154 #else if (thefunction == "retcor") { |
146 #try to change the legend display | 155 #try to change the legend display |
186 | 195 |
187 # -- TIC -- | 196 # -- TIC -- |
188 if (thefunction == "xcmsSet") { | 197 if (thefunction == "xcmsSet") { |
189 cat("\t\tGET TIC GRAPH\n") | 198 cat("\t\tGET TIC GRAPH\n") |
190 sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput) | 199 sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput) |
191 getTICs(xcmsSet=xset, rt="raw") | 200 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw") |
192 getBPCs(xcmsSet=xset, rt="raw") | 201 getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf) |
193 } else if (thefunction == "retcor") { | 202 } else if (thefunction == "retcor") { |
194 cat("\t\tGET TIC GRAPH\n") | 203 cat("\t\tGET TIC GRAPH\n") |
195 getTICs(xcmsSet=xset, rt="corrected") | 204 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected") |
196 getBPCs(xcmsSet=xset, rt="corrected") | 205 getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf) |
197 } | 206 } |
198 | 207 |
199 if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) { | 208 if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) { |
200 getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput) | 209 getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput) |
201 } | 210 } |