Mercurial > repos > lecorguille > xcms_xcmsset
annotate xcms_xcmsSet.r @ 32:b02d1992a43a draft
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
author | workflow4metabolomics |
---|---|
date | Wed, 07 Apr 2021 16:47:14 +0000 |
parents | eb15a3841da4 |
children | f5d51091cf84 |
rev | line source |
---|---|
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
2 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
3 # ----- LOG FILE ----- |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
4 log_file <- file("log.txt", open = "wt") |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
5 sink(log_file) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
6 sink(log_file, type = "output") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
7 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
8 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
9 # ----- PACKAGE ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
10 cat("\tSESSION INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
11 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
12 #Import the different functions |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
13 source_local <- function(fname) { |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
14 argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep = "/")) |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
15 } |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
16 source_local("lib.r") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
17 |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
18 pkgs <- c("xcms", "batch") |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
19 loadAndDisplayPackages(pkgs) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
20 cat("\n\n"); |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
21 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
22 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
23 # ----- ARGUMENTS ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
24 cat("\tARGUMENTS INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
25 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
26 write.table(as.matrix(args), col.names = F, quote = F, sep = "\t") |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
27 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
28 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
29 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
30 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
31 # ----- PROCESSING INFILE ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
32 cat("\tARGUMENTS PROCESSING INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
33 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
34 #saving the commun parameters |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
35 BPPARAM <- MulticoreParam(1) |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
36 if (!is.null(args$BPPARAM)) { |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
37 BPPARAM <- MulticoreParam(args$BPPARAM) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
38 } |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
39 register(BPPARAM) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
40 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
41 #saving the specific parameters |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
42 if (!is.null(args$filterAcquisitionNum)) filterAcquisitionNumParam <- args$filterAcquisitionNum |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
43 if (!is.null(args$filterRt)) filterRtParam <- args$filterRt |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
44 if (!is.null(args$filterMz)) filterMzParam <- args$filterMz |
31
eb15a3841da4
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
workflow4metabolomics
parents:
30
diff
changeset
|
45 if (!is.null(args$peaklist)) peaklistParam <- args$peaklist |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
46 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
47 method <- args$method |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
48 |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
49 if (!is.null(args$roiList)) { |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
50 cat("\t\troiList provided\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
51 args$roiList <- list(getDataFrameFromFile(args$roiList)) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
52 print(args$roiList) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
53 } |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
54 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
55 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
56 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
57 # ----- INFILE PROCESSING ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
58 cat("\tINFILE PROCESSING INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
59 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
60 #image is an .RData file necessary to use xset variable given by previous tools |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
61 load(args$image) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
62 if (!exists("raw_data")) stop("\n\nERROR: The RData doesn't contain any object called 'raw_data' which is provided by the tool: MSnbase readMSData") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
63 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
64 # Handle infiles |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
65 rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args) |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
66 zipfile <- rawFilePath$zipfile |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
67 singlefile <- rawFilePath$singlefile |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
68 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
69 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
70 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
71 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
72 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
73 # ----- MAIN PROCESSING INFO ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
74 cat("\tMAIN PROCESSING INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
75 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
76 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
77 cat("\t\tCOMPUTE\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
78 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
79 cat("\t\t\tApply filter[s] (if asked)\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
80 if (exists("filterAcquisitionNumParam")) raw_data <- filterAcquisitionNum(raw_data, filterAcquisitionNumParam[1]:filterAcquisitionNumParam[2]) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
81 if (exists("filterRtParam")) raw_data <- filterRt(raw_data, filterRtParam) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
82 if (exists("filterMzParam")) raw_data <- filterMz(raw_data, filterMzParam) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
83 #Apply this filter only if file contain MS and MSn |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
84 if (length(unique(msLevel(raw_data))) != 1) { |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
85 raw_data <- filterMsLevel(raw_data, msLevel = 1) |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
86 } |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
87 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
88 cat("\t\t\tChromatographic peak detection\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
89 # clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or method ... |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
90 args <- args[names(args) %in% slotNames(do.call(paste0(method, "Param"), list()))] |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
91 |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
92 findChromPeaksParam <- do.call(paste0(method, "Param"), args) |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
93 print(findChromPeaksParam) |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
94 xdata <- findChromPeaks(raw_data, param = findChromPeaksParam) |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
95 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
96 # Check if there are no peaks |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
97 if (nrow(chromPeaks(xdata)) == 0) stop("No peaks were detected. You should review your settings") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
98 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
99 # Create a sampleMetada file |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
100 sampleNamesList <- getSampleMetadata(xdata = xdata, sampleMetadataOutput = "sampleMetadata.tsv") |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
101 |
31
eb15a3841da4
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
workflow4metabolomics
parents:
30
diff
changeset
|
102 # Create a chromPeaks table if required |
eb15a3841da4
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
workflow4metabolomics
parents:
30
diff
changeset
|
103 if (exists("peaklistParam")) { |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
104 if (peaklistParam) { |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
105 cat("\nCreating the chromatographic peaks' table...\n") |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
106 write.table(chromPeaks(xdata), file = "chromPeak_table.tsv", sep = "\t", quote = F, row.names = F) |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
107 } |
31
eb15a3841da4
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
workflow4metabolomics
parents:
30
diff
changeset
|
108 } |
eb15a3841da4
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
workflow4metabolomics
parents:
30
diff
changeset
|
109 |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
110 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
111 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
112 # ----- EXPORT ----- |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
113 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
114 cat("\tXCMSnExp OBJECT INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
115 print(xdata) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
116 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
117 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
118 cat("\txcmsSet OBJECT INFO\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
119 # Get the legacy xcmsSet object |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
120 xset <- getxcmsSetObject(xdata) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
121 print(xset) |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
122 cat("\n\n") |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
123 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
124 #saving R data in .Rdata file to save the variables used in the present tool |
32
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
125 objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList") |
b02d1992a43a
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
workflow4metabolomics
parents:
31
diff
changeset
|
126 save(list = objects2save[objects2save %in% ls()], file = "xcmsSet.RData") |
15
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
127 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
128 |
b62808a2a008
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents:
diff
changeset
|
129 cat("\tDONE\n") |