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