annotate annotationRmn2DWrapper.R @ 3:546c7ccd2ed4 draft default tip

"planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
author workflow4metabolomics
date Fri, 04 Feb 2022 09:01:11 +0000
parents dff7bde22102
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
3 ## 201919016 2DNmrAnnotation_1.0.0.R
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
4 ## Marie Tremblay-Franco
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
5 ## MetaboHUB: The French Infrastructure for Metabolomics and Fluxomics
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
6 ## marie.tremblay-franco@inrae.fr
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
7
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
8 runExampleL <- FALSE
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
9
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
10 if (runExampleL) {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
11 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
12 ## Example of arguments
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
13 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
14 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
15
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
16
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
17 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
18 ## Options
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
19 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
20 strAsFacL <- options()$stringsAsFactors
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
21 options(stringsAsFactors = FALSE)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
22 options(digits = 8, scipen = 3)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
23
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
24 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
25 ## Constants
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
26 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
27 topEnvC <- environment()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
28 flagC <- "\n"
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
29
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
30
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
31 ##-------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
32 ## Input parameters reading
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
33 ##-------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
34
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
35 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
36 ## R libraries laoding
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
37 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
38 library(batch)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
39 library(dplyr)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
40 library(ggplot2)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
41 library(openxlsx)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
42 library(stringr)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
43 library(tidyr)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
44 library(curl)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
45 library(jsonlite)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
46 library(stringi)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
47
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
48 if (!runExampleL)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
49 argLs <- parseCommandArgs(evaluate = FALSE)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
50 logFile <- argLs[["logOut"]]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
51 sink(logFile)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
52
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
53 cat("\tPACKAGE INFO\n")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
54 sessionInfo()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
55
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
56 ##------------------------------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
57 ## Functions
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
58 ##------------------------------
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
59 source_local <- function(fname) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
60 argv <- commandArgs(trailingOnly = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
61 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
62 source(paste(base_dir, fname, sep = "/"))
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
63 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
64 #Import the different functions
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
65 source_local("annotationRmn2D.R")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
66 source_local("annotationRmn2DGlobale.R")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
67 source_local("viridis.R")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
68
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
69 ## Input parameter values
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
70 fileToAnnotate <- argLs[[1]]
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
71 # Constraints values
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
72 ph <- argLs$pH
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
73 field <- argLs$magneticField
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
74
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
75 # Chosen sequence(s)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
76 cosy <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
77 hmbc <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
78 hsqc <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
79 jres <- 0
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
80 tocsy <- 0
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
81
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
82 if (argLs$cosy_2dsequences == "yes") {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
83 cosy <- 1
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
84 peakforestSpectra <- readLines(curl("https://metabohub.peakforest.org/rest/v1/spectra/nmr2d/search?query=cosy&token=9131jq9l8gsjn1j14t351h716u&max=500"))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
85 peakforestSpectra <- fromJSON(peakforestSpectra, simplifyDataFrame = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
86 if (ph != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
87 peakforestSpectra <- peakforestSpectra[peakforestSpectra$sampleNMRTubeConditionsMetadata$potentiaHydrogenii == ph, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
88 if (field != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
89 peakforestSpectra <- peakforestSpectra[peakforestSpectra$analyzerNMRSpectrometerDevice$magneticFieldStrenght == field, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
90
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
91 if (nrow(peakforestSpectra) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
92 BdDReference_COSY <- peakforestSpectra$peaks
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
93 names(BdDReference_COSY) <- str_split(peakforestSpectra[, 2], simplify = TRUE, pattern = ";")[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
94 names(BdDReference_COSY) <- enc2utf8(names(BdDReference_COSY))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
95 names(BdDReference_COSY) <- str_replace_all(names(BdDReference_COSY), "\u00e9", "e")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
96
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
97 for (k in seq_len(length(BdDReference_COSY))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
98 peakforestSpectra_df <- data.frame(ppm.dim1 = BdDReference_COSY[[k]][, 2], ppm.dim2 = BdDReference_COSY[[k]][, 1],
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
99 BdDReference_COSY[[k]][, 3:ncol(BdDReference_COSY[[k]])])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
100 BdDReference_COSY[[k]] <- peakforestSpectra_df
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
101 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
102 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
103 stop("No COSY spectra correspond to requested pH and/or magnetic field", call. = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
104 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
105 rm(peakforestSpectra)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
106 rm(peakforestSpectra_df)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
107 }
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
108
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
109 if (argLs$hmbc_2dsequences == "yes") {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
110 hmbc <- 1
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
111 peakforestSpectra <- readLines(curl("https://metabohub.peakforest.org/rest/v1/spectra/nmr2d/search?query=hmbc&token=9131jq9l8gsjn1j14t351h716u&max=500"))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
112 peakforestSpectra <- fromJSON(peakforestSpectra, simplifyDataFrame = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
113 if (ph != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
114 peakforestSpectra <- peakforestSpectra[peakforestSpectra$sampleNMRTubeConditionsMetadata$potentiaHydrogenii == ph, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
115 if (field != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
116 peakforestSpectra <- peakforestSpectra[peakforestSpectra$analyzerNMRSpectrometerDevice$magneticFieldStrenght == field, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
117
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
118 if (nrow(peakforestSpectra) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
119
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
120 BdDReference_HMBC <- peakforestSpectra$peaks
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
121 names(BdDReference_HMBC) <- str_split(peakforestSpectra[, 2], simplify = TRUE, pattern = ";")[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
122 names(BdDReference_HMBC) <- enc2utf8(names(BdDReference_HMBC))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
123 names(BdDReference_HMBC) <- str_replace_all(names(BdDReference_HMBC), "\u00e9", "e")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
124
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
125 peakforestSpectra_df <- data.frame()
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
126 for (k in seq_len(length(BdDReference_HMBC))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
127 peakforestSpectra_df <- data.frame(ppm.dim1 = BdDReference_HMBC[[k]][, 2], ppm.dim2 = BdDReference_HMBC[[k]][, 1],
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
128 BdDReference_HMBC[[k]][, 3:ncol(BdDReference_HMBC[[k]])])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
129 BdDReference_HMBC[[k]] <- peakforestSpectra_df
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
130 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
131 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
132 stop("No HMBC spectra correspond to requested pH and/or magnetic field", call. = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
133 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
134 rm(peakforestSpectra)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
135 rm(peakforestSpectra_df)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
136 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
137
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
138 if (argLs$hsqc_2dsequences == "yes") {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
139 hsqc <- 1
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
140 peakforestSpectra <- readLines(curl("https://metabohub.peakforest.org/rest/v1/spectra/nmr2d/search?query=hsqc&token=9131jq9l8gsjn1j14t351h716u&max=500"))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
141 peakforestSpectra <- fromJSON(peakforestSpectra, simplifyDataFrame = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
142
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
143 if (ph != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
144 peakforestSpectra <- peakforestSpectra[peakforestSpectra$sampleNMRTubeConditionsMetadata$potentiaHydrogenii == ph, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
145 if (field != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
146 peakforestSpectra <- peakforestSpectra[peakforestSpectra$analyzerNMRSpectrometerDevice$magneticFieldStrenght == field, ]
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
147
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
148 if (nrow(peakforestSpectra) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
149 BdDReference_HSQC <- peakforestSpectra$peaks
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
150 names(BdDReference_HSQC) <- str_split(peakforestSpectra[, 2], simplify = TRUE, pattern = ";")[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
151 names(BdDReference_HSQC) <- enc2utf8(names(BdDReference_HSQC))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
152 names(BdDReference_HSQC) <- str_replace_all(names(BdDReference_HSQC), "\u00e9", "e")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
153
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
154 for (k in seq_len(length(BdDReference_HSQC))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
155 peakforestSpectra_df <- data.frame(ppm.dim1 = BdDReference_HSQC[[k]][, 2], ppm.dim2 = BdDReference_HSQC[[k]][, 1],
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
156 BdDReference_HSQC[[k]][, 3:ncol(BdDReference_HSQC[[k]])])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
157 BdDReference_HSQC[[k]] <- peakforestSpectra_df
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
158 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
159 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
160 stop("No HSQC spectra correspond to requested pH and/or magnetic field", call. = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
161 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
162 rm(peakforestSpectra)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
163 rm(peakforestSpectra_df)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
164 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
165
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
166 if (argLs$jres_2dsequences == "yes") {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
167 jres <- 1
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
168 peakforestSpectra <- readLines(curl("https://metabohub.peakforest.org/rest/v1/spectra/nmr2d/search?query=jres&token=9131jq9l8gsjn1j14t351h716u&max=500"))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
169 peakforestSpectra <- fromJSON(peakforestSpectra, simplifyDataFrame = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
170
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
171 if (ph != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
172 peakforestSpectra <- peakforestSpectra[peakforestSpectra$sampleNMRTubeConditionsMetadata$potentiaHydrogenii == ph, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
173 if (field != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
174 peakforestSpectra <- peakforestSpectra[peakforestSpectra$analyzerNMRSpectrometerDevice$magneticFieldStrenght == field, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
175
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
176 if (nrow(peakforestSpectra) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
177 BdDReference_JRES <- peakforestSpectra$peaks
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
178 names(BdDReference_JRES) <- str_split(peakforestSpectra[, 2], simplify = TRUE, pattern = ";")[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
179 names(BdDReference_JRES) <- enc2utf8(names(BdDReference_JRES))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
180 names(BdDReference_JRES) <- str_replace_all(names(BdDReference_JRES), "\u00e9", "e")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
181
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
182 for (k in seq_len(length(BdDReference_JRES))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
183 peakforestSpectra_df <- data.frame(ppm.dim1 = BdDReference_JRES[[k]][, 2], ppm.dim2 = BdDReference_JRES[[k]][, 1],
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
184 BdDReference_JRES[[k]][, 3:ncol(BdDReference_JRES[[k]])])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
185 BdDReference_JRES[[k]] <- peakforestSpectra_df
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
186 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
187 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
188 stop("No JRES spectra correspond to requested pH and/or magnetic field", call. = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
189 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
190 rm(peakforestSpectra)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
191 rm(peakforestSpectra_df)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
192 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
193
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
194 if (argLs$tocsy_2dsequences == "yes") {
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
195 tocsy <- 1
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
196 peakforestSpectra <- readLines(curl("https://metabohub.peakforest.org/rest/v1/spectra/nmr2d/search?query=tocsy&token=9131jq9l8gsjn1j14t351h716u&max=500"))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
197 peakforestSpectra <- fromJSON(peakforestSpectra, simplifyDataFrame = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
198
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
199 if (ph != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
200 peakforestSpectra <- peakforestSpectra[peakforestSpectra$sampleNMRTubeConditionsMetadata$potentiaHydrogenii == ph, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
201 if (field != 0)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
202 peakforestSpectra <- peakforestSpectra[peakforestSpectra$analyzerNMRSpectrometerDevice$magneticFieldStrenght == field, ]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
203
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
204 if (nrow(peakforestSpectra) != 0) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
205 BdDReference_TOCSY <- peakforestSpectra$peaks
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
206 names(BdDReference_TOCSY) <- str_split(peakforestSpectra[, 2], simplify = TRUE, pattern = ";")[, 1]
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
207 names(BdDReference_TOCSY) <- enc2utf8(names(BdDReference_TOCSY))
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
208 names(BdDReference_TOCSY) <- str_replace_all(names(BdDReference_TOCSY), "\u00e9", "e")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
209
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
210 for (k in seq_len(length(BdDReference_TOCSY))) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
211 peakforestSpectra_df <- data.frame(ppm.dim1 = BdDReference_TOCSY[[k]][, 2], ppm.dim2 = BdDReference_TOCSY[[k]][, 1],
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
212 BdDReference_TOCSY[[k]][, 3:ncol(BdDReference_TOCSY[[k]])])
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
213 BdDReference_TOCSY[[k]] <- peakforestSpectra_df
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
214 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
215 } else {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
216 stop("No TOCSY spectra correspond to requested pH and/or magnetic field", call. = FALSE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
217 }
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
218 rm(peakforestSpectra)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
219 rm(peakforestSpectra_df)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
220 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
221
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
222 if (argLs$cosy_2dsequences == "no" & argLs$hmbc_2dsequences == "no" & argLs$hsqc_2dsequences == "no" & argLs$jres_2dsequences == "no" & argLs$tocsy_2dsequences == "no")
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
223 stop("No chosen sequence. You have to choose at least 1 sequence", call. = FALSE)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
224
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
225
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
226 # User database
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
227
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
228
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
229 # Allowed chemical shifts
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
230 tolPpm1 <- argLs$tolppm1
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
231 tolPpm2HJRes <- argLs$tolppmJRES
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
232 tolPpm2C <- argLs$tolppm2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
233 # Threshold to remove metabolites (probability score < threshold)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
234 seuil <- argLs$threshold
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
235 # Remove metabolites when multiple assignations?
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
236 unicite <- str_to_upper(argLs$unicity)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
237
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
238 ## Output paramater values
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
239 AnnotationGraph <- argLs[["AnnotationGraph"]]
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
240
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
241 print(argLs)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
242
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
243 ## ANNOTATION
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
244 st0 <- Sys.time()
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
245 pdf(AnnotationGraph, onefile = TRUE)
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
246 annotationMelange <- annotationRmn2DGlobale(fileToAnnotate, tolPpm1 = tolPpm1, tolPpm2HJRes = tolPpm2HJRes,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
247 tolPpm2C = tolPpm2C, cosy = cosy, hmbc = hmbc, hsqc = hsqc,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
248 jres = jres, tocsy = tocsy, seuil = seuil, unicite = unicite)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
249 dev.off()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
250
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
251 if (cosy == 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
252 write.table(annotationMelange$COSY$liste_resultat, file = argLs[["annotationCOSY"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
253 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
254 if (nrow(annotationMelange$COSY$listing_ppm_commun) != 0)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
255 write.table(annotationMelange$COSY$listing_ppm_commun, file = argLs[["ppmCommunCOSY"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
256 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
257 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
258
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
259 if (hmbc == 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
260 write.table(annotationMelange$HMBC$liste_resultat, file = argLs[["annotationHMBC"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
261 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
262 if (nrow(annotationMelange$HMBC$listing_ppm_commun) != 0)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
263 write.table(annotationMelange$HMBC$listing_ppm_commun, file = argLs[["ppmCommunHMBC"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
264 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
265 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
266
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
267 if (hsqc == 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
268 write.table(annotationMelange$HSQC$liste_resultat, file = argLs[["annotationHSQC"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
269 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
270 if (nrow(annotationMelange$HSQC$listing_ppm_commun) != 0)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
271 write.table(annotationMelange$HSQC$listing_ppm_commun, file = argLs[["ppmCommunHSQC"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
272 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
273 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
274
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
275 if (jres == 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
276 write.table(annotationMelange$JRES$liste_resultat, file = argLs[["annotationJRES"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
277 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
278 if (nrow(annotationMelange$JRES$listing_ppm_commun) != 0)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
279 write.table(annotationMelange$JRES$listing_ppm_commun, file = argLs[["ppmCommunJRES"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
280 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
281 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
282
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
283 if (tocsy == 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
284 write.table(annotationMelange$TOCSY$liste_resultat, file = argLs[["annotationTOCSY"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
285 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
286 if (nrow(annotationMelange$TOCSY$listing_ppm_commun) != 0)
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
287 write.table(annotationMelange$TOCSY$listing_ppm_commun, file = argLs[["ppmCommunTOCSY"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
288 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
289 }
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
290
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
291 ## Combinaison de sequences
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
292 if (cosy + jres + hmbc + hsqc + tocsy > 1) {
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
293 write.table(annotationMelange$combination, file = argLs[["annotationCombination"]], quote = FALSE,
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
294 row.names = FALSE, sep = "\t")
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
295 }
3
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
296 st1 <- Sys.time()
546c7ccd2ed4 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit 911f4beba3dcb25c1033e8239426f8f763683523"
workflow4metabolomics
parents: 2
diff changeset
297 print(st1 - st0)
2
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
298
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
299 ## Ending
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
300 ##--------
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
301 cat("\nEnd of '2D NMR annotation' Galaxy module call: ", as.character(Sys.time()), sep = "")
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
302 sink()
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
303 options(stringsAsFactors = strAsFacL)
dff7bde22102 "planemo upload for repository https://github.com/workflow4metabolomics/tools-metabolomics commit b3abcb650e9b38458aa0ac5f7d838811d982ff65"
workflow4metabolomics
parents:
diff changeset
304 rm(list = ls())