annotate xcms_xcmsSet.r @ 41:bca66ffdf02a draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e3956bf3393be5bff67b4d90f1007da00b0ec9b2-dirty
author lecorguille
date Thu, 04 Oct 2018 09:46:51 -0400
parents e8d7395a70b2
children a8f0dd2aff5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
4 log_file <- file("log.txt", open="wt")
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
13 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
14 source_local("lib.r")
39
e8d7395a70b2 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e131bacd37bfaf2c4132fd214c81db9b8a9df513
lecorguille
parents: 37
diff changeset
15 source_local("lib-xcms3.x.x.r")
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
16
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
17 pkgs <- c("xcms","batch")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
18 loadAndDisplayPackages(pkgs)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
19 cat("\n\n");
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
20
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 # ----- ARGUMENTS -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
23 cat("\tARGUMENTS INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
24 args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
25 write.table(as.matrix(args), col.names=F, quote=F, sep='\t')
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
26
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
27 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
28
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 # ----- PROCESSING INFILE -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
31 cat("\tARGUMENTS PROCESSING INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
33 #saving the commun parameters
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
34 BPPARAM <- MulticoreParam(1)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
35 if (!is.null(args$BPPARAM)){
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
36 BPPARAM <- MulticoreParam(args$BPPARAM)
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
37 }
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
38 register(BPPARAM)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
39
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
40 #saving the specific parameters
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
41 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
42 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
43 if (!is.null(args$filterMz)) filterMzParam <- args$filterMz
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
44
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
45 method <- args$method
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 if (!is.null(args$roiList)){
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
48 cat("\t\troiList provided\n")
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
49 args$roiList <- list(getDataFrameFromFile(args$roiList))
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
50 print(args$roiList)
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
51 }
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
52
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
53 cat("\n\n")
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 # ----- INFILE PROCESSING -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
56 cat("\tINFILE PROCESSING INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
57
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
58 #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
59 load(args$image)
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
60 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
61
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
62 # Handle infiles
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
63 if (!exists("singlefile")) singlefile <- NULL
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
64 if (!exists("zipfile")) zipfile <- NULL
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
65 rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args)
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 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
71 cat("\n\n")
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
74 # ----- MAIN PROCESSING INFO -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
75 cat("\tMAIN PROCESSING INFO\n")
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
78 cat("\t\tCOMPUTE\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
79
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
80 ## Get the full path to the files
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
81 files <- getMSFiles(directory)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
82
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
83 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
84 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
85 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
86 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
87 #Apply this filter only if file contain MS and MSn
9ada611dd63f planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 3922356e5edae763800a4311146e2fdeb52c296e
lecorguille
parents: 36
diff changeset
88 if(length(unique(msLevel(raw_data)))!= 1){
9ada611dd63f planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 3922356e5edae763800a4311146e2fdeb52c296e
lecorguille
parents: 36
diff changeset
89 raw_data <- filterMsLevel(raw_data,msLevel=1)
9ada611dd63f planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 3922356e5edae763800a4311146e2fdeb52c296e
lecorguille
parents: 36
diff changeset
90 }
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
91
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
92 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
93 # clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or method ...
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
94 args <- args[names(args) %in% slotNames(do.call(paste0(method,"Param"), list()))]
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
95
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
96 findChromPeaksParam <- do.call(paste0(method,"Param"), args)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
97 print(findChromPeaksParam)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
98 xdata <- findChromPeaks(raw_data, param=findChromPeaksParam)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
99
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
100 # Check if there are no peaks
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
101 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
102
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
103 # Transform the files absolute pathways into relative pathways
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
104 xdata@processingData@files <- sub(paste(getwd(), "/", sep="") , "", xdata@processingData@files)
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
105
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
106 # Create a sampleMetada file
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
107 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
108
36
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
109 cat("\t\t\tCompute and Store TIC and BPI\n")
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
110 chromTIC = chromatogram(xdata, aggregationFun = "sum")
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
111 chromBPI = chromatogram(xdata, aggregationFun = "max")
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
112
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
113 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
114
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
115 # ----- EXPORT -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
116
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
117 cat("\tXCMSnExp OBJECT INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
118 print(xdata)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
119 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
120
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
121 cat("\txcmsSet OBJECT INFO\n")
34
efd23113d5f4 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 49203f8a5271fa5e6bb889e907df71ebf7757309
lecorguille
parents: 33
diff changeset
122 # Get the legacy xcmsSet object
efd23113d5f4 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 49203f8a5271fa5e6bb889e907df71ebf7757309
lecorguille
parents: 33
diff changeset
123 xset <- getxcmsSetObject(xdata)
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
124 print(xset)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
125 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
126
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
127 #saving R data in .Rdata file to save the variables used in the present tool
36
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
128 objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList", "chromTIC", "chromBPI")
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
129 save(list=objects2save[objects2save %in% ls()], file="xcmsSet.RData")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
130
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
131
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
132 cat("\tDONE\n")