Mercurial > repos > eschen42 > xcms_refine
annotate xcms_refine.r @ 0:ae9ef9219aae draft default tip
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
author | eschen42 |
---|---|
date | Fri, 12 Feb 2021 18:05:29 +0000 |
parents | |
children |
rev | line source |
---|---|
0
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
2 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
3 # ----- LOG FILE ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
4 log_file=file("log.txt", open = "wt") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
5 sink(log_file) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
6 sink(log_file, type = "output") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
7 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
8 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
9 # ----- PACKAGE ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
10 cat("\tSESSION INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
11 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
12 #Import the different functions |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
13 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
14 source_local("lib.r") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
15 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
16 pkgs <- c("xcms","batch","RColorBrewer") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
17 loadAndDisplayPackages(pkgs) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
18 cat("\n\n"); |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
19 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
20 # ----- EXPLORE NAMESPACE ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
21 # cat("\tXCMS NAMESPACE INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
22 # ls(asNamespace("xcms")) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
23 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
24 # ----- ARGUMENTS ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
25 cat("\tARGUMENTS INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
26 args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
27 write.table(as.matrix(args), col.names=F, quote=F, sep='\t') |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
28 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
29 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
30 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
31 # ----- PROCESSING INFILE ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
32 cat("\tARGUMENTS PROCESSING INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
33 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
34 #saving the specific parameters |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
35 args_method <- args$method |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
36 args_image <- args$image |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
37 args_msLevel <- args$msLevel |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
38 #args[c('method','image','msLevel')] <- NULL |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
39 param_args <- list() |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
40 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
41 if ( args_method == "CleanPeaks" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
42 param_args$maxPeakwidth <- as.numeric(args$maxPeakwidth) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
43 if (is.na(as.numeric(param_args$maxPeakwidth))) stop("\n\nERROR: The maxPeakwidth argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
44 } else if ( args_method == "FilterIntensity" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
45 param_args$threshold <- as.numeric(args$threshold) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
46 if (is.na(as.numeric(param_args$threshold))) stop("\n\nERROR: The threshold argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
47 param_args$nValues <- as.numeric(args$nValues) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
48 if (is.na(as.numeric(param_args$nValues))) stop("\n\nERROR: The nValues argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
49 if (as.integer(param_args$nValues) != param_args$nValues) stop("\n\nERROR: The nValues argument is not an integer value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
50 param_args$value <- args$value |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
51 } else if ( args_method == "MergeNeighboringPeaks" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
52 if (is.na(as.numeric(args$expandRt))) stop("\n\nERROR: The expandRt argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
53 if (is.na(as.numeric(args$expandMz))) stop("\n\nERROR: The expandMz argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
54 if (is.na(as.numeric(args$ppm))) stop("\n\nERROR: The ppm argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
55 if (is.na(as.numeric(args$minProp))) stop("\n\nERROR: The minProp argument cannot be coerced to a numeric value.") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
56 param_args$expandRt <- args$expandRt |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
57 param_args$expandMz <- args$expandMz |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
58 param_args$ppm <- args$ppm |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
59 param_args$minProp <- args$minProp |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
60 } |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
61 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
62 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
63 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
64 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
65 # ----- ARGUMENTS PROCESSING ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
66 cat("\tINFILE PROCESSING INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
67 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
68 #image is an .RData file necessary to use xset variable given by previous tools |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
69 load(args_image) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
70 if (!exists("xdata")) stop("\n\nERROR: The RData doesn't contain any object called 'xdata'. Such RData as this might have been created by an old version of XMCS 2.*") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
71 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
72 # Handle infiles |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
73 if (!exists("singlefile")) singlefile <- NULL |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
74 if (!exists("zipfile")) zipfile <- NULL |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
75 rawFilePath <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile, args) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
76 zipfile <- rawFilePath$zipfile |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
77 singlefile <- rawFilePath$singlefile |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
78 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
79 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
80 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
81 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
82 # ----- MAIN PROCESSING INFO ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
83 cat("\tMAIN PROCESSING INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
84 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
85 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
86 cat("\t\tPREPARE PARAMETERS\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
87 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
88 if ( args_method == "CleanPeaks" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
89 refineChromPeaksParam <- CleanPeaksParam(maxPeakwidth = param_args$maxPeakwidth) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
90 } else if ( args_method == "FilterIntensity" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
91 refineChromPeaksParam <- FilterIntensityParam( |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
92 threshold = param_args$threshold, |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
93 nValues = param_args$nValues, |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
94 value = param_args$value |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
95 ) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
96 } else if ( args_method == "MergeNeighboringPeaks" ) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
97 refineChromPeaksParam <- MergeNeighboringPeaksParam( |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
98 expandRt = param_args$expandRt, |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
99 expandMz = param_args$expandMz, |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
100 ppm = param_args$ppm, |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
101 minProp = param_args$minProp |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
102 ) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
103 } |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
104 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
105 cat(str(refineChromPeaksParam)) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
106 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
107 cat("\n\n\t\tCOMPUTE\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
108 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
109 # cat("\t\t\tACE DEBUG show the xdata\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
110 # cat(str(xdata)) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
111 # cat("\n\t\t\tACE DEBUG (end show the xdata)\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
112 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
113 # cat("\t\t\tACE DEBUG show updateObject(xdata)\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
114 xdata <- updateObject(xdata) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
115 # cat(str(xdata)) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
116 # cat("\n\t\t\tACE DEBUG (end show updateObject(xdata))\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
117 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
118 # cat("\t\t\tACE DEBUG show the param_args\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
119 # cat(str(param_args)) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
120 # cat("\n\t\t\tACE DEBUG (end show the param_args)\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
121 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
122 # cat("\t\t\tACE DEBUG show the refineChromPeaksParam\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
123 # cat(str(refineChromPeaksParam)) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
124 # cat("\n\t\t\tACE DEBUG (end show the refineChromPeaksParam)\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
125 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
126 # cat("\t\t\tACE DEBUG show the slotNames\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
127 # cat(str(slotNames(refineChromPeaksParam))) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
128 # cat("\n\t\t\tACE DEBUG (end show the slotNames)\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
129 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
130 # # clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or args_method ... |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
131 # param_args <- param_args[names(param_args) %in% slotNames(do.call(paste0(args_method,"Param"), param_args))] |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
132 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
133 # refineChromPeaksParam <- do.call(paste0(args_method,"Param"), param_args) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
134 # print(refineChromPeaksParam) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
135 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
136 # cat("\t\t\tACE DEBUG invoke refineChromPeaks\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
137 xdata <- refineChromPeaks(xdata, param = refineChromPeaksParam) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
138 # cat("\t\t\tACE DEBUG returned from refineChromPeaks\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
139 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
140 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
141 # cat("\t\tDRAW GRAPHICS\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
142 # getPlotChromPeakDensity(xdata, param = groupChromPeaksParam) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
143 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
144 # if (exists("intval")) { |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
145 # getPeaklistW4M(xdata, intval, convertRTMinute, numDigitsMZ, numDigitsRT, naTOzero, "variableMetadata.tsv", "dataMatrix.tsv") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
146 # } |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
147 # |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
148 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
149 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
150 # ----- EXPORT ----- |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
151 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
152 cat("\tXCMSnExp OBJECT INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
153 print(xdata) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
154 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
155 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
156 cat("\txcmsSet OBJECT INFO\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
157 # Get the legacy xcmsSet object |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
158 xset <- getxcmsSetObject(xdata) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
159 print(xset) |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
160 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
161 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
162 #saving R data in .Rdata file to save the variables used in the present tool |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
163 objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
164 save(list=objects2save[objects2save %in% ls()], file="xcmsSet.RData") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
165 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
166 cat("\n\n") |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
167 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
168 |
ae9ef9219aae
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 2f3f29dbaaa8568b40818d3476159c384f1a21d6-dirty"
eschen42
parents:
diff
changeset
|
169 cat("\tDONE\n") |