annotate xcms.r @ 11:91311aa08cdc draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
author lecorguille
date Mon, 30 Jan 2017 08:52:59 -0500
parents 0888f7ef739a
children 15646e937936
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
1 #!/usr/bin/env Rscript
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
2 # xcms.r version="2.2.0"
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
3 #Authors ABIMS TEAM
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
4 #BPC Addition from Y.guitton
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
5
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
7 # ----- LOG FILE -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
8 log_file=file("log.txt", open = "wt")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
9 sink(log_file)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
10 sink(log_file, type = "output")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
11
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
12
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
13 # ----- PACKAGE -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
14 cat("\tPACKAGE INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
15 #pkgs=c("xcms","batch")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
16 pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
17 for(pkg in pkgs) {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
18 suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
19 cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
20 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
21 source_local <- function(fname){ argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
22 cat("\n\n");
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
23
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
24
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
25
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
26
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
27
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
28 # ----- ARGUMENTS -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
29 cat("\tARGUMENTS INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
30 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
31 write.table(as.matrix(listArguments), col.names=F, quote=F, sep='\t')
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
32
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
33 cat("\n\n");
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
34
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
35
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
36 # ----- ARGUMENTS PROCESSING -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
37 cat("\tINFILE PROCESSING INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
38
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
39 #image is an .RData file necessary to use xset variable given by previous tools
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
40 if (!is.null(listArguments[["image"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
41 load(listArguments[["image"]]); listArguments[["image"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
42 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
43
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
44 #Import the different functions
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
45 source_local("lib.r")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
46
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
47 cat("\n\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
48
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
49 #Import the different functions
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
50
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
51 # ----- PROCESSING INFILE -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
52 cat("\tARGUMENTS PROCESSING INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
53
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
54 # Save arguments to generate a report
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
55 if (!exists("listOFlistArguments")) listOFlistArguments=list()
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
56 listOFlistArguments[[paste(format(Sys.time(), "%y%m%d-%H:%M:%S_"),listArguments[["xfunction"]],sep="")]] = listArguments
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
57
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
58
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
59 #saving the commun parameters
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
60 thefunction = listArguments[["xfunction"]]; listArguments[["xfunction"]]=NULL #delete from the list of arguments
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
61
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
62 xsetRdataOutput = paste(thefunction,"RData",sep=".")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
63 if (!is.null(listArguments[["xsetRdataOutput"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
64 xsetRdataOutput = listArguments[["xsetRdataOutput"]]; listArguments[["xsetRdataOutput"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
65 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
66
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
67 #saving the specific parameters
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
68 rplotspdf = "Rplots.pdf"
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
69 if (!is.null(listArguments[["rplotspdf"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
70 rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
71 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
72 sampleMetadataOutput = "sampleMetadata.tsv"
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
73 if (!is.null(listArguments[["sampleMetadataOutput"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
74 sampleMetadataOutput = listArguments[["sampleMetadataOutput"]]; listArguments[["sampleMetadataOutput"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
75 }
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
76 variableMetadataOutput = "variableMetadata.tsv"
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
77 if (!is.null(listArguments[["variableMetadataOutput"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
78 variableMetadataOutput = listArguments[["variableMetadataOutput"]]; listArguments[["variableMetadataOutput"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
79 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
80 dataMatrixOutput = "dataMatrix.tsv"
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
81 if (!is.null(listArguments[["dataMatrixOutput"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
82 dataMatrixOutput = listArguments[["dataMatrixOutput"]]; listArguments[["dataMatrixOutput"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
83 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
84 if (!is.null(listArguments[["convertRTMinute"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
85 convertRTMinute = listArguments[["convertRTMinute"]]; listArguments[["convertRTMinute"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
86 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
87 if (!is.null(listArguments[["numDigitsMZ"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
88 numDigitsMZ = listArguments[["numDigitsMZ"]]; listArguments[["numDigitsMZ"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
89 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
90 if (!is.null(listArguments[["numDigitsRT"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
91 numDigitsRT = listArguments[["numDigitsRT"]]; listArguments[["numDigitsRT"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
92 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
93 if (!is.null(listArguments[["intval"]])){
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
94 intval = listArguments[["intval"]]; listArguments[["intval"]]=NULL
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
95 }
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
96
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
97 if (thefunction %in% c("xcmsSet","retcor")) {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
98 ticspdf = listArguments[["ticspdf"]]; listArguments[["ticspdf"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
99 bicspdf = listArguments[["bicspdf"]]; listArguments[["bicspdf"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
100 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
101
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
102 #necessary to unzip .zip file uploaded to Galaxy
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
103 #thanks to .zip file it's possible to upload many file as the same time conserving the tree hierarchy of directories
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
104
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
105
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
106 if (!is.null(listArguments[["zipfile"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
107 zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
108 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
109
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
110 if (!is.null(listArguments[["library"]])){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
111 directory=listArguments[["library"]]; listArguments[["library"]]=NULL
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
112 if(!file.exists(directory)){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
113 error_message=paste("Cannot access the directory:",directory,". Please verify if the directory exists or not.")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
114 print(error_message)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
115 stop(error_message)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
116 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
117 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
118
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
119 # We unzip automatically the chromatograms from the zip files.
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
120 if (thefunction %in% c("xcmsSet","retcor","fillPeaks")) {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
121 if(exists("zipfile") && (zipfile!="")) {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
122 if(!file.exists(zipfile)){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
123 error_message=paste("Cannot access the Zip file:",zipfile,". Please, contact your administrator ... if you have one!")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
124 print(error_message)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
125 stop(error_message)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
126 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
127
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
128 #list all file in the zip file
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
129 #zip_files=unzip(zipfile,list=T)[,"Name"]
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
130
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
131
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
132 #unzip
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
133 suppressWarnings(unzip(zipfile, unzip="unzip"))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
134
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
135 #get the directory name
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
136 filesInZip=unzip(zipfile, list=T);
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
137 directories=unique(unlist(lapply(strsplit(filesInZip$Name,"/"), function(x) x[1])));
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
138 directories=directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
139 directory = "."
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
140 if (length(directories) == 1) directory = directories
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
141
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
142 cat("files_root_directory\t",directory,"\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
143
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
144 #
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
145 md5sumList=list("origin"=getMd5sum(directory))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
146
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
147 # Check and fix if there are non ASCII characters. If so, they will be removed from the *mzXML mzML files.
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
148 # Remove because can create issue with some clean files
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
149 #@TODO: fix me
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
150 #if (deleteXmlBadCharacters(directory)) {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
151 # md5sumList=list("removalBadCharacters"=getMd5sum(directory))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
152 #}
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
153
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
154 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
155 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
156
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
157 #addition of the directory to the list of arguments in the first position
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
158 if (thefunction == "xcmsSet") {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
159 checkXmlStructure(directory)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
160 checkFilesCompatibilityWithXcms(directory)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
161 listArguments=append(directory, listArguments)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
162 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
163
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
164
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
165 #addition of xset object to the list of arguments in the first position
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
166 if (exists("xset")){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
167 listArguments=append(list(xset), listArguments)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
168 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
169
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
170 cat("\n\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
171
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
172
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
173
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
174
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
175
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
176
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
177 # ----- MAIN PROCESSING INFO -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
178 cat("\tMAIN PROCESSING INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
179
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
180
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
181 #Verification of a group step before doing the fillpeaks job.
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
182
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
183 if (thefunction == "fillPeaks") {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
184 res=try(is.null(groupnames(xset)))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
185 if (class(res) == "try-error"){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
186 error<-geterrmessage()
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
187 write(error, stderr())
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
188 stop("You must always do a group step after a retcor. Otherwise it won't work for the fillpeaks step")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
189 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
190
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
191 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
192
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
193 #change the default display settings
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
194 #dev.new(file="Rplots.pdf", width=16, height=12)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
195 pdf(file=rplotspdf, width=16, height=12)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
196 if (thefunction == "group") {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
197 par(mfrow=c(2,2))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
198 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
199 #else if (thefunction == "retcor") {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
200 #try to change the legend display
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
201 # par(xpd=NA)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
202 # par(xpd=T, mar=par()$mar+c(0,0,0,4))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
203 #}
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
204
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
205
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
206 #execution of the function "thefunction" with the parameters given in "listArguments"
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
207
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
208 cat("\t\tCOMPUTE\n")
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
209 xset = do.call(thefunction, listArguments)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
210
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
211
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
212 cat("\n\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
213
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
214 dev.off() #dev.new(file="Rplots.pdf", width=16, height=12)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
215
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
216 if (thefunction == "xcmsSet") {
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
217
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
218 #transform the files absolute pathways into relative pathways
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
219 xset@filepaths<-sub(paste(getwd(),"/",sep="") ,"", xset@filepaths)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
220
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
221 if(exists("zipfile") && (zipfile!="")) {
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
222
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
223 #Modify the samples names (erase the path)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
224 for(i in 1:length(sampnames(xset))){
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
225
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
226 sample_name=unlist(strsplit(sampnames(xset)[i], "/"))
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
227 sample_name=sample_name[length(sample_name)]
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
228 sample_name= unlist(strsplit(sample_name,"[.]"))[1]
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
229 sampnames(xset)[i]=sample_name
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
230
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
231 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
232
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
233 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
234
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
235 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
236
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
237 # -- TIC --
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
238 if (thefunction == "xcmsSet") {
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
239 cat("\t\tGET TIC GRAPH\n")
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
240 sampleNamesList = getSampleMetadata(xcmsSet=xset, sampleMetadataOutput=sampleMetadataOutput)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
241 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="raw")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
242 getBPCs(xcmsSet=xset,rt="raw",pdfname=bicspdf)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
243 } else if (thefunction == "retcor") {
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
244 cat("\t\tGET TIC GRAPH\n")
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
245 getTICs(xcmsSet=xset, pdfname=ticspdf,rt="corrected")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
246 getBPCs(xcmsSet=xset,rt="corrected",pdfname=bicspdf)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
247 }
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
248
11
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
249 if (thefunction == "fillPeaks") {
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
250 cat("\t\tGET THE PEAK LIST\n")
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
251 getPeaklistW4M(xset,intval,convertRTMinute,numDigitsMZ,numDigitsRT,variableMetadataOutput,dataMatrixOutput)
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
252 }
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
253
91311aa08cdc planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 08e7f269a5c59687a7768be8db5fcb4e4d736093
lecorguille
parents: 6
diff changeset
254
6
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
255 cat("\n\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
256
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
257 # ----- EXPORT -----
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
258
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
259 cat("\tXSET OBJECT INFO\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
260 print(xset)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
261 #delete the parameters to avoid the passage to the next tool in .RData image
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
262
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
263
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
264 #saving R data in .Rdata file to save the variables used in the present tool
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
265 objects2save = c("xset","zipfile","listOFlistArguments","md5sumList","sampleNamesList")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
266 save(list=objects2save[objects2save %in% ls()], file=xsetRdataOutput)
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
267
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
268 cat("\n\n")
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
269
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
270
0888f7ef739a planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents:
diff changeset
271 cat("\tDONE\n")