annotate NmrBucketing_wrapper.R @ 3:58679e85745f draft

planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 7cd224b2cbddcb2535640a3f76194bd235acb602-dirty
author lecorguille
date Fri, 12 Aug 2016 05:47:27 -0400
parents a99a6026c972
children d61f6ceef5d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
80 if (!is.null(argLs[["zipfile"]])){
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
81 zipfile= argLs[["zipfile"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
82 directory=unzip(zipfile, list=F)
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
83 directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/")
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
84 } else if (!is.null(argLs[["library"]])){
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
85 directory=argLs[["library"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
86 if(!file.exists(directory)){
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
87 error_message=paste("Cannot access the directory :",directory,".Please verify if the directory exists or not.")
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
88 print(error_message)
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
89 stop(error_message)
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
90 }
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
91 }
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
92
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
93 leftBorder <- argLs[["left_border"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
94 rightBorder <- argLs[["right_border"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
95 bucketSize <- argLs[["bucket_width"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
96 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
97
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
98 exclusionZonesBorders <- NULL
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
99 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
100 {
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
101 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
102 {
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
103 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
104 }
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
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
107 graphique <- argLs[["graphType"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
108
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
109 # Outputs
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
110 nomGraphe <- argLs[["graphOut"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
111 dataMatrixOut <- argLs[["dataMatrixOut"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
112 sampleMetadataOut <- argLs[["sampleOut"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
113 variableMetadataOut <- argLs[["variableOut"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
114 log <- argLs[["logOut"]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
115
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
116 ## Checking arguments
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
117 ##-------------------
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
118 error.stock <- "\n"
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
119
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
120 if(length(error.stock) > 1)
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
121 stop(error.stock)
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
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
124 ## Computation
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
125 ##------------
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
126 outputs <- NmrBucketing(directory,leftBorder,rightBorder,bucketSize,exclusionZones,exclusionZonesBorders,graphique,nomGraphe,log)
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
127 data_bucket <- outputs[[1]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
128 data_sample <- outputs[[2]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
129 data_variable <- outputs[[3]]
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
130
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
131 ## Saving
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
132 ##-------
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
133 # Data
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
134 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
135 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
136 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
137 # Sample
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
138 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
139 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
140 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
141 # Variable
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
142 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
143 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
144 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
145
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
146
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
147 ## Ending
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
148 ##---------------------
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
149
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
150 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
151
a99a6026c972 planemo upload for repository https://github.com/workflow4metabolomics/nmr_bucketing commit 44fd4fc42930d2e9ad7b77cf575f2231547de15c
marie-tremblay-metatoul
parents:
diff changeset
152 ## sink(NULL)
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 options(stringsAsFactors = strAsFacL)
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 rm(list = ls())