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