annotate spectralMatching.R @ 9:6bd3ff77063c draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
author tomnl
date Tue, 25 Jun 2019 05:59:31 -0400
parents ca0ac330f1a4
children 7e4a5ce0877d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
1 library(msPurity)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
2 library(msPurityData)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
3 library(optparse)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
4 print(sessionInfo())
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
5
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
6
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
7 option_list <- list(
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
8 make_option(c("-o", "--outDir"), type="character"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
9 make_option("--q_dbPth", type="character"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
10 make_option("--l_dbPth", type="character"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
11
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
12 make_option("--q_msp", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
13 make_option("--l_msp", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
14
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
15 make_option("--q_defaultDb", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
16 make_option("--l_defaultDb", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
17
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
18 make_option("--q_ppmPrec", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
19 make_option("--l_ppmPrec", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
20
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
21 make_option("--q_ppmProd", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
22 make_option("--l_ppmProd", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
23
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
24 make_option("--q_raThres", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
25 make_option("--l_raThres", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
26
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
27 make_option("--q_polarity", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
28 make_option("--l_polarity", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
29
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
30 make_option("--q_purity", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
31 make_option("--l_purity", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
32
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
33 make_option("--q_xcmsGroups", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
34 make_option("--l_xcmsGroups", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
35
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
36 make_option("--q_pids", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
37 make_option("--l_pids", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
38
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
39 make_option("--q_rtrangeMin", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
40 make_option("--l_rtrangeMin", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
41
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
42 make_option("--q_rtrangeMax", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
43 make_option("--l_rtrangeMax", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
44
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
45 make_option("--q_accessions", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
46 make_option("--l_accessions", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
47
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
48 make_option("--q_sources", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
49 make_option("--l_sources", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
50
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
51 make_option("--q_sourcesUser", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
52 make_option("--l_sourcesUser", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
53
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
54 make_option("--q_instrumentTypes", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
55 make_option("--l_instrumentTypes", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
56
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
57 make_option("--q_instrumentTypesUser", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
58 make_option("--l_instrumentTypesUser", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
59
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
60 make_option("--q_instruments", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
61 make_option("--l_instruments", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
62
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
63 make_option("--q_spectraTypes", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
64 make_option("--l_spectraTypes", type="character", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
65
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
66 make_option("--q_spectraFilter", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
67 make_option("--l_spectraFilter", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
68
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
69 make_option("--usePrecursors", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
70
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
71 make_option("--mzW", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
72 make_option("--raW", type="double"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
73
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
74 make_option("--rttol", type="double", default=NA),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
75
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
76 make_option("--updateDb", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
77 make_option("--copyDb", action="store_true"),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
78 make_option("--cores", default=1)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
79
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
80
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
81 )
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
82
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
83 # store options
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
84 opt<- parse_args(OptionParser(option_list=option_list))
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
85
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
86 print(opt)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
87
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
88 extractMultiple <- function(optParam){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
89 if (!is.na(optParam)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
90 param <- trimws(strsplit(optParam, ',')[[1]])
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
91 param <- param[param != ""]
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
92 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
93 param <- NA
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
94 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
95 return(param)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
96
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
97 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
98
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
99 if(!is.null(opt$q_defaultDb)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
100 q_dbPth <- system.file("extdata", "library_spectra", "library_spectra.db", package="msPurityData")
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
101 }else if (!is.null(opt$q_dbPth)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
102 q_dbPth <- opt$q_dbPth
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
103 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
104 message('No query database available')
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
105 exit()
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
106 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
107
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
108 if(!is.null(opt$l_defaultDb)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
109 l_dbPth <- system.file("extdata", "library_spectra", "library_spectra.db", package="msPurityData")
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
110 }else if (!is.null(opt$l_dbPth)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
111 l_dbPth <- opt$l_dbPth
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
112 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
113 message('No library database available')
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
114 exit()
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
115 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
116
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
117
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
118 q_polarity <- extractMultiple(opt$q_polarity)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
119 l_polarity <- extractMultiple(opt$l_polarity)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
120
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
121 q_xcmsGroups <- extractMultiple(opt$q_xcmsGroups)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
122 l_xcmsGroups <- extractMultiple(opt$l_xcmsGroups)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
123
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
124 q_pids <- extractMultiple(opt$q_pids)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
125 l_pids <- extractMultiple(opt$l_pids)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
126
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
127 q_sources <- extractMultiple(opt$q_sources)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
128 l_sources <- extractMultiple(opt$l_sources)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
129
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
130 q_sourcesUser <- extractMultiple(opt$q_sourcesUser)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
131 l_sourcesUser <- extractMultiple(opt$l_sourcesUser)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
132
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
133 q_sources <-c(q_sources, q_sourcesUser)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
134 l_sources <-c(l_sources, l_sourcesUser)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
135
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
136 q_instrumentTypes <- extractMultiple(opt$q_instrumentTypes)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
137 l_instrumentTypes <- extractMultiple(opt$l_instrumentTypes)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
138
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
139 q_instrumentTypes <-c(q_instrumentTypes, q_instrumentTypes)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
140 l_instrumentTypes <-c(l_instrumentTypes, l_instrumentTypes)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
141
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
142
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
143 if(!is.null(opt$l_spectraFilter)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
144 l_spectraFilter <- TRUE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
145 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
146 l_spectraFilter <- FALSE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
147 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
148
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
149 if(!is.null(opt$q_spectraFilter)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
150 q_spectraFilter <- TRUE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
151 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
152 q_spectraFilter <- FALSE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
153 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
154
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
155 if(!is.null(opt$updateDb)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
156 updateDb <- TRUE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
157 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
158 updateDb <- FALSE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
159 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
160
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
161 if(!is.null(opt$copyDb)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
162 copyDb <- TRUE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
163 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
164 copyDb <- FALSE
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
165 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
166
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
167 if(!is.null(opt$l_rtrangeMax)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
168 l_rtrangeMax <- opt$l_rtrangeMax
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
169 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
170 l_rtrangeMax <- NA
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
171 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
172
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
173 if(!is.null(opt$q_rtrangeMax)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
174 q_rtrangeMax <- opt$q_rtrangeMax
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
175 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
176 q_rtrangeMax <- NA
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
177 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
178
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
179 if(!is.null(opt$l_rtrangeMin)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
180 l_rtrangeMin <- opt$l_rtrangeMin
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
181 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
182 l_rtrangeMin <- NA
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
183 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
184
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
185 if(!is.null(opt$q_rtrangeMin)){
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
186 q_rtrangeMin <- opt$q_rtrangeMin
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
187 }else{
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
188 q_rtrangeMin <- NA
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
189 }
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
190
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
191
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
192
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
193 sm <- msPurity::spectralMatching(q_dbPth = q_dbPth,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
194 l_dbPth = l_dbPth,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
195
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
196 q_purity = opt$q_purity,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
197 l_purity = opt$l_purity,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
198
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
199 q_ppmProd = opt$q_ppmProd,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
200 l_ppmProd = opt$l_ppmProd,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
201
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
202 q_ppmPrec = opt$q_ppmPrec,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
203 l_ppmPrec = opt$l_ppmPrec,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
204
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
205 q_raThres = opt$q_raThres,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
206 l_raThres = opt$l_raThres,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
207
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
208 q_pol = q_polarity,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
209 l_pol = l_polarity,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
210
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
211 q_xcmsGroups = q_xcmsGroups,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
212 l_xcmsGroups = l_xcmsGroups,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
213
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
214 q_pids = q_pids,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
215 l_pids = l_pids,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
216
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
217 q_sources = q_sources,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
218 l_sources = l_sources,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
219
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
220 q_instrumentTypes = q_instrumentTypes,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
221 l_instrumentTypes = l_instrumentTypes,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
222
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
223 q_spectraFilter= q_spectraFilter,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
224 l_spectraFilter= l_spectraFilter,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
225
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
226 l_rtrange=c(l_rtrangeMin, l_rtrangeMax),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
227 q_rtrange=c(q_rtrangeMin, q_rtrangeMax),
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
228
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
229 q_accessions = opt$q_accessions,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
230 l_accessions= opt$l_accessions,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
231
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
232 raW = opt$raW,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
233 mzW = opt$mzW,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
234 rttol=opt$rttol,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
235 cores=opt$cores,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
236
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
237 copyDb=copyDb,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
238 updateDb=updateDb,
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
239 outPth = "db_with_spectral_matching.sqlite"
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
240 )
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
241
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
242
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
243
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
244 write.table(sm$matchedResults, 'matched_results.tsv', sep = '\t', row.names = FALSE, col.names = TRUE)
ca0ac330f1a4 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2948ce35fa7fffe5a64711cb30be971031e79019-dirty
tomnl
parents:
diff changeset
245 write.table(sm$xcmsMatchedResults, 'xcms_matched_results.tsv', sep = '\t', row.names = FALSE, col.names = TRUE)
9
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
246
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
247
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
248 # Add extra details from library spectra in resulting database
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
249 # First get all the ids from the l_s_peak_meta from the query database
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
250 if(updateDb){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
251 message('Adding extra details to database')
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
252 q_con <- DBI::dbConnect(RSQLite::SQLite(),sm$q_dbPth)
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
253 if (DBI::dbExistsTable(q_con, "l_s_peak_meta")){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
254 l_s_peak_meta <- DBI::dbGetQuery(q_con, 'SELECT * FROM l_s_peak_meta')
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
255 colnames(l_s_peak_meta)[1] <- 'pid'
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
256 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
257
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
258 l_con <- DBI::dbConnect(RSQLite::SQLite(),l_dbPth)
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
259 if (DBI::dbExistsTable(q_con, "s_peaks")){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
260 l_s_peaks <- DBI::dbGetQuery(q_con, sprintf("SELECT * FROM s_peaks WHERE pid in (%s)", paste(unique(l_s_peak_meta$pid), collapse=',')))
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
261
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
262 }else if(DBI::dbExistsTable(q_con, "library_spectra")){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
263 l_s_peaks <- DBI::dbGetQuery(q_con, sprintf("SELECT * FROM library_spectra
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
264 WHERE library_spectra_meta_id in (%s)", paste(unique(l_s_peak_meta$pid), collapse=',')))
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
265 }else{
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
266 l_s_peaks = NULL
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
267 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
268
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
269 if (DBI::dbExistsTable(q_con, "source")){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
270 l_source <- DBI::dbGetQuery(q_con, 'SELECT * FROM source')
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
271 }else if (DBI::dbExistsTable(q_con, "library_spectra_source")) {
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
272 l_source <- DBI::dbGetQuery(q_con, 'library_spectra_source')
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
273 }else{
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
274 l_source = NULL
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
275 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
276
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
277 if (!is.null(l_s_peaks)){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
278 DBI::dbWriteTable(q_con, name='l_s_peaks', value=l_s_peaks, row.names=FALSE, append=TRUE)
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
279 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
280
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
281 if (!is.null(l_source)){
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
282 DBI::dbWriteTable(q_con, name='l_source', value=l_source, row.names=FALSE, append=TRUE)
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
283 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
284
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
285 }
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
286
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
287
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
288
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
289
6bd3ff77063c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 74e7bfbb5e70ec6e665114fa9e9863dafd7bced5
tomnl
parents: 0
diff changeset
290