Mercurial > repos > lecorguille > xcms_fillpeaks
comparison xcms.r @ 29:f6d3e6be4ea3 draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit bff1445c9b00ccdbe05ee3dc6ed24221033384b9
| author | lecorguille | 
|---|---|
| date | Tue, 24 Oct 2017 11:48:31 -0400 | 
| parents | 4db7afa8284d | 
| children | 6b5ed508f81f | 
   comparison
  equal
  deleted
  inserted
  replaced
| 28:9b0bf28bcbaf | 29:f6d3e6be4ea3 | 
|---|---|
| 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("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch") | 16 pkgs=c("tools","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 } | |
| 72 sampleMetadataOutput = "sampleMetadata.tsv" | 68 sampleMetadataOutput = "sampleMetadata.tsv" | 
| 73 if (!is.null(listArguments[["sampleMetadataOutput"]])){ | 69 if (!is.null(listArguments[["sampleMetadataOutput"]])){ | 
| 74 sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL | 70 sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL | 
| 75 } | 71 } | 
| 76 variableMetadataOutput = "variableMetadata.tsv" | 72 variableMetadataOutput = "variableMetadata.tsv" | 
| 90 if (!is.null(listArguments[["numDigitsRT"]])){ | 86 if (!is.null(listArguments[["numDigitsRT"]])){ | 
| 91 numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL | 87 numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL | 
| 92 } | 88 } | 
| 93 if (!is.null(listArguments[["intval"]])){ | 89 if (!is.null(listArguments[["intval"]])){ | 
| 94 intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL | 90 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 | |
| 100 } | 91 } | 
| 101 | 92 | 
| 102 | 93 | 
| 103 if (thefunction %in% c("xcmsSet","retcor","fillPeaks")) { | 94 if (thefunction %in% c("xcmsSet","retcor","fillPeaks")) { | 
| 104 if (!exists("singlefile")) singlefile=NULL | 95 if (!exists("singlefile")) singlefile=NULL | 
| 145 | 136 | 
| 146 } | 137 } | 
| 147 | 138 | 
| 148 #change the default display settings | 139 #change the default display settings | 
| 149 #dev.new(file="Rplots.pdf", width=16, height=12) | 140 #dev.new(file="Rplots.pdf", width=16, height=12) | 
| 150 pdf(file=rplotspdf, width=16, height=12) | 141 pdf(file="Rplots.pdf", width=16, height=12) | 
| 151 if (thefunction == "group") { | 142 if (thefunction == "group") { | 
| 152 par(mfrow=c(2,2)) | 143 par(mfrow=c(2,2)) | 
| 153 } | 144 } | 
| 154 #else if (thefunction == "retcor") { | 145 #else if (thefunction == "retcor") { | 
| 155 #try to change the legend display | 146 #try to change the legend display | 
| 195 | 186 | 
| 196 # -- TIC -- | 187 # -- TIC -- | 
| 197 if (thefunction == "xcmsSet") { | 188 if (thefunction == "xcmsSet") { | 
| 198 cat("\t\tGET TIC GRAPH\n") | 189 cat("\t\tGET TIC GRAPH\n") | 
| 199 sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput) | 190 sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput) | 
| 200 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw") | 191 getTICs(xcmsSet=xset, rt="raw") | 
| 201 getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf) | 192 getBPCs(xcmsSet=xset, rt="raw") | 
| 202 } else if (thefunction == "retcor") { | 193 } else if (thefunction == "retcor") { | 
| 203 cat("\t\tGET TIC GRAPH\n") | 194 cat("\t\tGET TIC GRAPH\n") | 
| 204 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected") | 195 getTICs(xcmsSet=xset, rt="corrected") | 
| 205 getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf) | 196 getBPCs(xcmsSet=xset, rt="corrected") | 
| 206 } | 197 } | 
| 207 | 198 | 
| 208 if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) { | 199 if ((thefunction == "group" || thefunction == "fillPeaks") && exists("intval")) { | 
| 209 getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput) | 200 getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput) | 
| 210 } | 201 } | 
