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