annotate xcms_xcmsSet.r @ 36:d39b9aff9cf7 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
author lecorguille
date Thu, 05 Apr 2018 18:05:45 -0400
parents 7f636ad1162b
children 9ada611dd63f
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")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
15
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
16 pkgs <- c("xcms","batch")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
17 loadAndDisplayPackages(pkgs)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
18 cat("\n\n");
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
19
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 # ----- ARGUMENTS -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
22 cat("\tARGUMENTS INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
23 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
24 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
25
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
26 cat("\n\n")
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
29 # ----- PROCESSING INFILE -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
30 cat("\tARGUMENTS PROCESSING INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
31
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
32 #saving the commun parameters
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
33 BPPARAM <- MulticoreParam(1)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
34 if (!is.null(args$BPPARAM)){
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
35 BPPARAM <- MulticoreParam(args$BPPARAM)
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
36 }
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
37 register(BPPARAM)
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 #saving the specific parameters
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
40 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
41 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
42 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
43
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
44 method <- args$method
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
45
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
46 if (!is.null(args$roiList)){
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
47 cat("\t\troiList provided\n")
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
48 args$roiList <- list(getDataFrameFromFile(args$roiList))
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
49 print(args$roiList)
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
50 }
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
51
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
52 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
53
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
54 # ----- INFILE PROCESSING -----
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
55 cat("\tINFILE PROCESSING INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
56
35
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
57 #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
58 load(args$image)
7f636ad1162b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f01148783819c37e474790dbd56619862960448a
lecorguille
parents: 34
diff changeset
59 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
60
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
61 # Handle infiles
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
62 if (!exists("singlefile")) singlefile <- NULL
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
63 if (!exists("zipfile")) zipfile <- NULL
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
64 rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
65 zipfile <- rawFilePath$zipfile
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
66 singlefile <- rawFilePath$singlefile
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
67 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)
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
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
79 ## Get the full path to the files
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
80 files <- getMSFiles(directory)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
81
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
82 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
83 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
84 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
85 if (exists("filterMzParam")) raw_data <- filterMz(raw_data, filterMzParam)
33
c363b9f1caef planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7b226c3ba91a3cf654ec1c14b3ef85090968bb0f
lecorguille
parents: 32
diff changeset
86
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
87 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
88 # 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
89 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
90
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
91 findChromPeaksParam <- do.call(paste0(method,"Param"), args)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
92 print(findChromPeaksParam)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
93 xdata <- findChromPeaks(raw_data, param=findChromPeaksParam)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
94
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
95 # Check if there are no peaks
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
96 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
97
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
98 # Transform the files absolute pathways into relative pathways
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
99 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
100
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
101 # Create a sampleMetada file
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
102 sampleNamesList <- getSampleMetadata(xdata=xdata, sampleMetadataOutput="sampleMetadata.tsv")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
103
36
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
104 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
105 chromTIC = chromatogram(xdata, aggregationFun = "sum")
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
106 chromBPI = chromatogram(xdata, aggregationFun = "max")
d39b9aff9cf7 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 5e066c50d2e4ac6d5796b53331cbd3198ab8c4f9-dirty
lecorguille
parents: 35
diff changeset
107
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
108 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
109
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
110 # ----- EXPORT -----
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 cat("\tXCMSnExp OBJECT INFO\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
113 print(xdata)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
114 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
115
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
116 cat("\txcmsSet OBJECT INFO\n")
34
efd23113d5f4 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 49203f8a5271fa5e6bb889e907df71ebf7757309
lecorguille
parents: 33
diff changeset
117 # Get the legacy xcmsSet object
efd23113d5f4 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 49203f8a5271fa5e6bb889e907df71ebf7757309
lecorguille
parents: 33
diff changeset
118 xset <- getxcmsSetObject(xdata)
32
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
119 print(xset)
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
120 cat("\n\n")
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
121
2bf1cb023c94 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit e384d6dd5f410799ec211f73bca0b5d5d7bc651e
lecorguille
parents:
diff changeset
122 #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
123 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
124 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
125
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 cat("\tDONE\n")