annotate xcms.r @ 20:08768644f9c4 draft

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