comparison xcms_xcmsSet.r @ 33:f5d51091cf84 draft

planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics/ commit 2cb157bd9a8701a3d6874e084032cbd050b8953e
author workflow4metabolomics
date Mon, 11 Sep 2023 09:22:36 +0000
parents b02d1992a43a
children
comparison
equal deleted inserted replaced
32:b02d1992a43a 33:f5d51091cf84
9 # ----- PACKAGE ----- 9 # ----- PACKAGE -----
10 cat("\tSESSION INFO\n") 10 cat("\tSESSION INFO\n")
11 11
12 #Import the different functions 12 #Import the different functions
13 source_local <- function(fname) { 13 source_local <- function(fname) {
14 argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep = "/")) 14 argv <- commandArgs(trailingOnly = FALSE)
15 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
16 source(paste(base_dir, fname, sep = "/"))
15 } 17 }
16 source_local("lib.r") 18 source_local("lib.r")
17 19
18 pkgs <- c("xcms", "batch") 20 pkgs <- c("xcms", "batch")
19 loadAndDisplayPackages(pkgs) 21 loadAndDisplayPackages(pkgs)
20 cat("\n\n"); 22 cat("\n\n")
21 23
22 24
23 # ----- ARGUMENTS ----- 25 # ----- ARGUMENTS -----
24 cat("\tARGUMENTS INFO\n") 26 cat("\tARGUMENTS INFO\n")
25 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects 27 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects
26 write.table(as.matrix(args), col.names = F, quote = F, sep = "\t") 28 write.table(as.matrix(args), col.names = FALSE, quote = FALSE, sep = "\t")
27 29
28 cat("\n\n") 30 cat("\n\n")
29 31
30 32
31 # ----- PROCESSING INFILE ----- 33 # ----- PROCESSING INFILE -----
32 cat("\tARGUMENTS PROCESSING INFO\n") 34 cat("\tARGUMENTS PROCESSING INFO\n")
33 35
34 #saving the commun parameters 36 #saving the commun parameters
35 BPPARAM <- MulticoreParam(1) 37 BPPARAM <- MulticoreParam(1)
36 if (!is.null(args$BPPARAM)) { 38 if (!is.null(args$BPPARAM)) {
37 BPPARAM <- MulticoreParam(args$BPPARAM) 39 BPPARAM <- MulticoreParam(args$BPPARAM)
38 } 40 }
39 register(BPPARAM) 41 register(BPPARAM)
40 42
41 #saving the specific parameters 43 #saving the specific parameters
42 if (!is.null(args$filterAcquisitionNum)) filterAcquisitionNumParam <- args$filterAcquisitionNum 44 if (!is.null(args$filterAcquisitionNum)) filterAcquisitionNumParam <- args$filterAcquisitionNum
45 if (!is.null(args$peaklist)) peaklistParam <- args$peaklist 47 if (!is.null(args$peaklist)) peaklistParam <- args$peaklist
46 48
47 method <- args$method 49 method <- args$method
48 50
49 if (!is.null(args$roiList)) { 51 if (!is.null(args$roiList)) {
50 cat("\t\troiList provided\n") 52 cat("\t\troiList provided\n")
51 args$roiList <- list(getDataFrameFromFile(args$roiList)) 53 args$roiList <- list(getDataFrameFromFile(args$roiList))
52 print(args$roiList) 54 print(args$roiList)
53 } 55 }
54 56
55 cat("\n\n") 57 cat("\n\n")
56 58
57 # ----- INFILE PROCESSING ----- 59 # ----- INFILE PROCESSING -----
101 103
102 # Create a chromPeaks table if required 104 # Create a chromPeaks table if required
103 if (exists("peaklistParam")) { 105 if (exists("peaklistParam")) {
104 if (peaklistParam) { 106 if (peaklistParam) {
105 cat("\nCreating the chromatographic peaks' table...\n") 107 cat("\nCreating the chromatographic peaks' table...\n")
106 write.table(chromPeaks(xdata), file = "chromPeak_table.tsv", sep = "\t", quote = F, row.names = F) 108 write.table(chromPeaks(xdata), file = "chromPeak_table.tsv", sep = "\t", quote = FALSE, row.names = FALSE)
107 } 109 }
108 } 110 }
109 111
110 cat("\n\n") 112 cat("\n\n")
111 113