comparison xcms_plot_chromatogram.r @ 14:8846a03995d3 draft

planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics/ commit 2cb157bd9a8701a3d6874e084032cbd050b8953e
author workflow4metabolomics
date Mon, 11 Sep 2023 09:18:38 +0000
parents 024974037c4e
children
comparison
equal deleted inserted replaced
13:024974037c4e 14:8846a03995d3
4 # ----- PACKAGE ----- 4 # ----- PACKAGE -----
5 cat("\tSESSION INFO\n") 5 cat("\tSESSION INFO\n")
6 6
7 #Import the different functions 7 #Import the different functions
8 source_local <- function(fname) { 8 source_local <- function(fname) {
9 argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep = "/")) 9 argv <- commandArgs(trailingOnly = FALSE)
10 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
11 source(paste(base_dir, fname, sep = "/"))
10 } 12 }
11 source_local("lib.r") 13 source_local("lib.r")
12 14
13 pkgs <- c("xcms", "batch", "RColorBrewer") 15 pkgs <- c("xcms", "batch", "RColorBrewer")
14 loadAndDisplayPackages(pkgs) 16 loadAndDisplayPackages(pkgs)
15 cat("\n\n"); 17 cat("\n\n")
16 18
17 19
18 # ----- ARGUMENTS ----- 20 # ----- ARGUMENTS -----
19 cat("\tARGUMENTS INFO\n") 21 cat("\tARGUMENTS INFO\n")
20 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects 22 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects
21 write.table(as.matrix(args), col.names = F, quote = F, sep = "\t") 23 write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t")
22 24
23 cat("\n\n") 25 cat("\n\n")
24 26
25 # ----- PROCESSING INFILE ----- 27 # ----- PROCESSING INFILE -----
26 cat("\tARGUMENTS PROCESSING INFO\n") 28 cat("\tARGUMENTS PROCESSING INFO\n")
50 52
51 cat("\t\tDRAW GRAPHICS\n") 53 cat("\t\tDRAW GRAPHICS\n")
52 54
53 register(SerialParam()) 55 register(SerialParam())
54 if (!exists("chromTIC") || is.null(chromTIC)) { 56 if (!exists("chromTIC") || is.null(chromTIC)) {
55 cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum") 57 cat("\t\t\tCompute TIC\n")
58 chromTIC <- chromatogram(xdata, aggregationFun = "sum")
56 } 59 }
57 if (!exists("chromBPI") || is.null(chromBPI)) { 60 if (!exists("chromBPI") || is.null(chromBPI)) {
58 cat("\t\t\tCompute BPI\n"); chromBPI <- chromatogram(xdata, aggregationFun = "max") 61 cat("\t\t\tCompute BPI\n")
62 chromBPI <- chromatogram(xdata, aggregationFun = "max")
59 } 63 }
60 64
61 if (!is.null(chromTIC_adjusted)) chromTIC <- chromTIC_adjusted 65 if (!is.null(chromTIC_adjusted)) chromTIC <- chromTIC_adjusted
62 if (!is.null(chromBPI_adjusted)) chromBPI <- chromBPI_adjusted 66 if (!is.null(chromBPI_adjusted)) chromBPI <- chromBPI_adjusted
63 67