Mercurial > repos > marie-tremblay-metatoul > nmr_bucketing
annotate NmrBucketing_wrapper.R @ 4:d61f6ceef5d6 draft
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
author | lecorguille |
---|---|
date | Tue, 22 Nov 2016 05:22:03 -0500 |
parents | a99a6026c972 |
children |
rev | line source |
---|---|
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
2 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
3 ## 070115_NmrBucketing2galaxy_v1.R |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
4 ## Marie Tremblay-Franco |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
5 ## MetaboHUB: The French Infrastructure for Metabolomics and Fluxomics |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
6 ## www.metabohub.fr/en |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
7 ## marie.tremblay-franco@toulouse.inra.fr |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
8 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
9 runExampleL <- FALSE |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
10 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
11 if(runExampleL) { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
12 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
13 ## Example of arguments |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
14 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
15 argLs <- list(StudyDir = "Tlse_BPASourisCerveau", |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
16 upper = "10.0", |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
17 lower = "0.50", |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
18 bucket.width = "0.01", |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
19 exclusion = "TRUE", |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
20 exclusion.zone = list(c(6.5,4.5)), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
21 graph="Overlay") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
22 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
23 argLs <- c(argLs, |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
24 list(dataMatrixOut = paste(directory,"_NmrBucketing_dataMatrix.tsv",sep=""), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
25 sampleMetadataOut = paste(directory,"_NmrBucketing_sampleMetadata.tsv",sep=""), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
26 variableMetadataOut = paste(directory,"_NmrBucketing_variableMetadata.tsv",sep=""), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
27 graphOut = paste(directory,"_NmrBucketing_graph.pdf",sep=""), |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
28 logOut = paste(directory,"_NmrBucketing_log.txt",sep=""))) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
29 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
30 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
31 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
32 ## Options |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
33 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
34 strAsFacL <- options()$stringsAsFactors |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
35 options(stringsAsFactors = FALSE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
36 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
37 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
38 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
39 ## Libraries laoding |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
40 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
41 # For parseCommandArgs function |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
42 library(batch) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
43 # For cumtrapz function |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
44 library(pracma) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
45 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
46 # R script call |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
47 source_local <- function(fname) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
48 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
49 argv <- commandArgs(trailingOnly = FALSE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
50 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
51 source(paste(base_dir, fname, sep="/")) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
52 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
53 #Import the different functions |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
54 source_local("NmrBucketing_script.R") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
55 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
56 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
57 ## Errors ????????????????????? |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
58 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
59 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
60 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
61 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
62 ## Constants |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
63 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
64 topEnvC <- environment() |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
65 flagC <- "\n" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
66 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
67 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
68 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
69 ## Script |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
70 ##------------------------------ |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
71 if(!runExampleL) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
72 argLs <- parseCommandArgs(evaluate=FALSE) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
73 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
74 ## sink(argLs[["logOut"]]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
75 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
76 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
77 ## Parameters Loading |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
78 ##------------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
79 # Inputs |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
80 if (!is.null(argLs[["zipfile"]])){ |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
81 fileType="zip" |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
82 zipfile= argLs[["zipfile"]] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
83 directory=unzip(zipfile, list=F) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
84 directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
85 } else if (!is.null(argLs[["library"]])){ |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
86 fileType="zip" |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
87 directory=argLs[["library"]] |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
88 if(!file.exists(directory)){ |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
89 error_message=paste("Cannot access the directory :",directory,".Please verify if the directory exists or not.") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
90 print(error_message) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
91 stop(error_message) |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
92 } |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
93 } else if (!is.null(argLs[["tsvfile"]])){ |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
94 fileType="tsv" |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
95 directory <- read.table(argLs[["tsvfile"]],check.names=FALSE,header=TRUE,sep="\t") |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
96 } |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
97 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
98 leftBorder <- argLs[["left_border"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
99 rightBorder <- argLs[["right_border"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
100 bucketSize <- argLs[["bucket_width"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
101 exclusionZones <- argLs[["zone_exclusion_choices.choice"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
102 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
103 exclusionZonesBorders <- NULL |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
104 if (!is.null(argLs$zone_exclusion_left)) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
105 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
106 for(i in which(names(argLs)=="zone_exclusion_left")) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
107 { |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
108 exclusionZonesBorders <- c(exclusionZonesBorders,list(c(argLs[[i]],argLs[[i+1]]))) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
109 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
110 } |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
111 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
112 graphique <- argLs[["graphType"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
113 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
114 # Outputs |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
115 nomGraphe <- argLs[["graphOut"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
116 dataMatrixOut <- argLs[["dataMatrixOut"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
117 sampleMetadataOut <- argLs[["sampleOut"]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
118 variableMetadataOut <- argLs[["variableOut"]] |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
119 logFile <- argLs[["logOut"]] |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
120 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
121 ## Checking arguments |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
122 ##------------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
123 error.stock <- "\n" |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
124 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
125 if(length(error.stock) > 1) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
126 stop(error.stock) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
127 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
128 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
129 ## Computation |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
130 ##------------ |
4
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
131 outputs <- NmrBucketing(fileType=fileType, fileName=directory, leftBorder=leftBorder, rightBorder=rightBorder, bucketSize=bucketSize, |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
132 exclusionZones=exclusionZones, exclusionZonesBorders=exclusionZonesBorders, graph=graphique, nomFichier=nomGraphe, |
d61f6ceef5d6
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit a0155b12acca444f72ff761fcce740e71be28a6d-dirty
lecorguille
parents:
0
diff
changeset
|
133 savLog.txtC=logFile) |
0
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
134 data_bucket <- outputs[[1]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
135 data_sample <- outputs[[2]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
136 data_variable <- outputs[[3]] |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
137 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
138 ## Saving |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
139 ##------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
140 # Data |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
141 data_bucket <- cbind(rownames(data_bucket),data_bucket) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
142 colnames(data_bucket) <- c("Bucket",colnames(data_bucket)[-1]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
143 write.table(data_bucket,file=argLs$dataMatrixOut,quote=FALSE,row.names=FALSE,sep="\t") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
144 # Sample |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
145 data_sample <- cbind(rownames(data_sample),data_sample) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
146 colnames(data_sample) <- c("Sample",colnames(data_sample)[-1]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
147 write.table(data_sample,file=argLs$sampleOut,quote=FALSE,row.names=FALSE,sep="\t") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
148 # Variable |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
149 data_variable <- cbind(rownames(data_variable),data_variable) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
150 colnames(data_variable) <- c("Bucket",colnames(data_variable)[-1]) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
151 write.table(data_variable,file=argLs$variableOut,quote=FALSE,row.names=FALSE,sep="\t") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
152 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
153 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
154 ## Ending |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
155 ##--------------------- |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
156 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
157 cat("\nEnd of 'NMR bucketing' Galaxy module call: ", as.character(Sys.time()), sep = "") |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
158 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
159 ## sink(NULL) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
160 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
161 options(stringsAsFactors = strAsFacL) |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
162 |
a99a6026c972
planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff
changeset
|
163 rm(list = ls()) |