Mercurial > repos > marie-tremblay-metatoul > nmr_preprocessing
annotate ReadFids_wrapper.R @ 6:6e837e9352a2 draft default tip
"planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 62fed9acaee7410de763b756cfa7de48ee258929"
author | workflow4metabolomics |
---|---|
date | Wed, 13 May 2020 03:52:09 -0400 |
parents | 5e64657b4fe5 |
children |
rev | line source |
---|---|
2
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
2 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
3 ## 08122016_ReadFids_wrapper.R |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
4 ## Manon Martin |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
5 ## manon.martin@uclouvain.be |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
6 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
7 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
8 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
9 # Preamble |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
10 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
11 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
12 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
13 runExampleL <- FALSE |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
14 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
15 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
16 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
17 ## Options |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
18 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
19 strAsFacL <- options()$stringsAsFactors |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
20 options(stringsAsFactors = FALSE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
21 options(warn=1) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
22 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
23 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
24 ## Libraries laoding |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
25 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
26 library(batch) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
27 library(ggplot2) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
28 library(gridExtra) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
29 library(reshape2) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
30 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
31 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
32 # R script call |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
33 source_local <- function(fname) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
34 { |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
35 argv <- commandArgs(trailingOnly = FALSE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
36 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
37 source(paste(base_dir, fname, sep="/")) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
38 } |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
39 #Import the different functions |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
40 source_local("ReadFids_script.R") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
41 source_local("DrawFunctions.R") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
42 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
43 ## Errors ????????????????????? |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
44 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
45 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
46 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
47 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
48 ## Constants |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
49 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
50 topEnvC <- environment() |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
51 flagC <- "\n" |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
52 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
53 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
54 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
55 ## Script |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
56 ##------------------------------ |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
57 if(!runExampleL) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
58 argLs <- parseCommandArgs(evaluate=FALSE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
59 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
60 sink(argLs$logOut) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
61 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
62 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
63 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
64 ## Parameters Loading |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
65 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
66 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
67 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
68 ## Inputs |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
69 # Path |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
70 ## Bruker FIDs |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
71 fileType="Bruker" |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
72 zipfile= argLs[["fidzipfile"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
73 directory=unzip(zipfile, list=F) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
74 path=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
75 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
76 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
77 # other inputs from ReadFids |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
78 l = argLs[["title_line"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
79 subdirs <- argLs[["subdirectories"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
80 dirs.names <- argLs[["dirs_names"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
81 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
82 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
83 # Outputs |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
84 # dataMatrix <- argLs[["dataMatrix"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
85 # sampleMetadata <- argLs[["sampleMetadata"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
86 logOut <- argLs[["logOut"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
87 nomGraphe <- argLs[["graphOut"]] |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
88 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
89 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
90 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
91 ## Checking arguments |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
92 ##------------------- |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
93 error.stock <- "\n" |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
94 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
95 if(length(error.stock) > 1) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
96 stop(error.stock) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
97 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
98 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
99 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
100 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
101 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
102 ## Computation |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
103 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
104 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
105 sink(logOut,append=TRUE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
106 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
107 if(length(warnings())>0){ # or !is.null(warnings()) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
108 print("something happened") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
109 } |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
110 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
111 ## Starting |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
112 cat("\nStart of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), "\n\n", sep = "") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
113 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
114 outputs <- ReadFids(path = path, l=l, subdirs = subdirs, dirs.names = dirs.names) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
115 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
116 data_matrix <- outputs[["Fid_data"]] # Data matrix |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
117 data_sample <- outputs[["Fid_info"]] # Sample metadata |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
118 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
119 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
120 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
121 pdf(nomGraphe, onefile = TRUE, width = 13, height = 13) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
122 title = "Raw FID data" |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
123 DrawSignal(data_matrix, subtype = "stacked", |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
124 ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
125 xlab = "Frequency", num.stacked = 4, |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
126 main = title, createWindow=FALSE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
127 invisible(dev.off()) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
128 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
129 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
130 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
131 ## Saving |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
132 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
133 ##====================================================== |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
134 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
135 # Data matrix |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
136 write.table(data_matrix,file=argLs$dataMatrix, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
137 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
138 # Sample metadata |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
139 write.table(data_sample,file=argLs$sampleMetadata, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
140 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
141 # log file |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
142 # write.table(t(data.frame(argLs)), file = argLs$logOut, col.names = FALSE, quote=FALSE) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
143 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
144 # input arguments |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
145 cat("\n INPUT and OUTPUT ARGUMENTS :\n") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
146 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
147 argLs |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
148 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
149 ## Ending |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
150 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
151 cat("\nEnd of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), sep = "") |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
152 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
153 sink() |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
154 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
155 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
156 options(stringsAsFactors = strAsFacL) |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
157 |
5e64657b4fe5
planemo upload for repository https://github.com/workflow4metabolomics/nmr_preprocessing commit 22ca8782d7c4c0211e13c95b425d4f29f53f995e
lecorguille
parents:
diff
changeset
|
158 rm(list = ls()) |