Mercurial > repos > lecorguille > xcms_plot_chromatogram
diff xcms_plot_chromatogram.r @ 13:024974037c4e draft
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
author | workflow4metabolomics |
---|---|
date | Wed, 07 Apr 2021 12:07:49 +0000 |
parents | dbd877060ac3 |
children | 8846a03995d3 |
line wrap: on
line diff
--- a/xcms_plot_chromatogram.r Thu Sep 24 08:08:50 2020 +0000 +++ b/xcms_plot_chromatogram.r Wed Apr 07 12:07:49 2021 +0000 @@ -5,18 +5,20 @@ cat("\tSESSION INFO\n") #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 <- 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") -pkgs <- c("xcms","batch","RColorBrewer") +pkgs <- c("xcms", "batch", "RColorBrewer") loadAndDisplayPackages(pkgs) cat("\n\n"); # ----- ARGUMENTS ----- cat("\tARGUMENTS INFO\n") -args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects -write.table(as.matrix(args), col.names=F, quote=F, sep='\t') +args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects +write.table(as.matrix(args), col.names = F, quote = F, sep = "\t") cat("\n\n") @@ -49,14 +51,18 @@ cat("\t\tDRAW GRAPHICS\n") register(SerialParam()) -if (!exists("chromTIC") || is.null(chromTIC)) { cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum") } -if (!exists("chromBPI") || is.null(chromBPI)) { cat("\t\t\tCompute BPI\n"); chromBPI <- chromatogram(xdata, aggregationFun = "max") } +if (!exists("chromTIC") || is.null(chromTIC)) { + cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum") +} +if (!exists("chromBPI") || is.null(chromBPI)) { + cat("\t\t\tCompute BPI\n"); chromBPI <- chromatogram(xdata, aggregationFun = "max") +} if (!is.null(chromTIC_adjusted)) chromTIC <- chromTIC_adjusted if (!is.null(chromBPI_adjusted)) chromBPI <- chromBPI_adjusted -getPlotChromatogram(chromTIC, xdata, pdfname="TICs.pdf", aggregationFun = "sum") -getPlotChromatogram(chromBPI, xdata, pdfname="BPIs.pdf", aggregationFun = "max") +getPlotChromatogram(chromTIC, xdata, pdfname = "TICs.pdf", aggregationFun = "sum") +getPlotChromatogram(chromBPI, xdata, pdfname = "BPIs.pdf", aggregationFun = "max") cat("\n\n") @@ -66,12 +72,5 @@ print(xdata) cat("\n\n") -# 2020-01-17 - disable because xcms 3.4.4 raises an error with xdata build with xcms 3.6.1 -#cat("\txcmsSet OBJECT INFO\n") -# Get the legacy xcmsSet object -#xset <- getxcmsSetObject(xdata) -#print(xset) -#cat("\n\n") - cat("\tDONE\n")