Mercurial > repos > prog > lcmsmatching
annotate search-mz @ 1:45e985cd8e9e draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
| author | prog |
|---|---|
| date | Tue, 31 Jan 2017 05:27:24 -0500 |
| parents | 3afe41d3e9e7 |
| children | 1ba222315fd5 |
| rev | line source |
|---|---|
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
2 # vi: ft=R |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
3 args <- commandArgs(trailingOnly = F) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
4 script.path <- sub("--file=","",args[grep("--file=",args)]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
5 library(getopt) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
6 source(file.path(dirname(script.path), 'msdb-common.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
7 source(file.path(dirname(script.path), 'MsFileDb.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
8 source(file.path(dirname(script.path), 'MsPeakForestDb.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
9 source(file.path(dirname(script.path), 'MsXlsDb.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
10 source(file.path(dirname(script.path), 'Ms4TabSqlDb.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
11 source(file.path(dirname(script.path), 'MsDbLogger.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
12 source(file.path(dirname(script.path), 'MsDbInputDataFrameStream.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
13 source(file.path(dirname(script.path), 'MsDbOutputDataFrameStream.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
14 source(file.path(dirname(script.path), 'htmlhlp.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
15 source(file.path(dirname(script.path), 'strhlp.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
16 source(file.path(dirname(script.path), 'fshlp.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
17 source(file.path(dirname(script.path), 'biodb-common.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
18 source(file.path(dirname(script.path), 'nethlp.R'), chdir = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
19 |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
20 # Missing paste0() function in R 2.14.1 |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
21 if (as.integer(R.Version()$major) == 2 && as.numeric(R.Version()$minor) < 15) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
22 paste0 <- function(...) paste(..., sep = '') |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
23 |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
24 ############# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
25 # CONSTANTS # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
26 ############# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
27 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
28 PROG <- sub('^.*/([^/]+)$', '\\1', commandArgs()[4], perl = TRUE) |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
29 USERAGENT <- 'search-mz ; pierrick.roger@gmail.com' |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
30 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
31 # Authorized database types |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
32 MSDB.XLS <- 'xls' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
33 MSDB.4TABSQL <- '4tabsql' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
34 MSDB.FILE <- 'file' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
35 MSDB.PEAKFOREST <- 'peakforest' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
36 MSDB.VALS <- c(MSDB.XLS, MSDB.4TABSQL, MSDB.FILE, MSDB.PEAKFOREST) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
37 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
38 # Authorized mode values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
39 POS_MODE <- 'pos' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
40 NEG_MODE <- 'neg' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
41 MSDB.MODE.VALS <- c(POS_MODE, NEG_MODE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
42 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
43 # Default |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
44 MSDB.DFT <- list() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
45 MSDB.DFT[['mzshift']] <- 0 # in ppm |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
46 MSDB.DFT[['mzprec']] <- 5 # in ppm |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
47 MSDB.DFT[['mztolunit']] <- MSDB.DFT.MZTOLUNIT |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
48 MSDB.DFT[['precursor-rt-tol']] <- 5 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
49 MSDB.DFT[['molids-sep']] <- MSDB.DFT.MATCH.SEP |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
50 MSDB.DFT[['db-fields']] <- concat.kv.list(msdb.get.dft.db.fields()) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
51 MSDB.DFT[['db-ms-modes']] <- concat.kv.list(MSDB.DFT.MODES) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
52 MSDB.DFT[['pos-prec']] <- paste(MSDB.DFT.PREC[[MSDB.TAG.POS]], collapse = ',') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
53 MSDB.DFT[['neg-prec']] <- paste(MSDB.DFT.PREC[[MSDB.TAG.NEG]], collapse = ',') |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
54 DEFAULT.ARG.VALUES <- MSDB.DFT |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
55 DEFAULT.ARG.VALUES[['input-col-names']] <- concat.kv.list(msdb.get.dft.input.fields()) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
56 DEFAULT.ARG.VALUES[['output-col-names']] <- concat.kv.list(msdb.get.dft.output.fields()) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
57 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
58 ############## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
59 # PRINT HELP # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
60 ############## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
61 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
62 print.help <- function(spec, status = 0) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
63 cat(getopt(spec, usage = TRUE, command = PROG)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
64 q(status = status) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
65 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
66 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
67 ############################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
68 # SET DEFAULT ARGUMENT VALUES # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
69 ############################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
70 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
71 set.dft.arg.val <-function(opt) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
72 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
73 for (f in names(MSDB.DFT)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
74 if (is.null(opt[[f]])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
75 opt[[f]] <- MSDB.DFT[[f]] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
76 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
77 # Set default values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
78 if ( opt$database == MSDB.XLS && ! is.null(opt$url) && is.null(opt[['cache-dir']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
79 opt[['cache-dir']] <- file.path(opt$url, 'cache') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
80 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
81 if ( ! is.null(opt$rtcol) && opt$rtcol == '') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
82 opt$rtcol <- NULL |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
83 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
84 return(opt) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
85 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
86 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
87 ######################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
88 # PARSE ARGUMENT VALUES # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
89 ######################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
90 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
91 parse.arg.val <- function(opt) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
92 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
93 # Parse input column names |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
94 if ( ! is.null(opt[['db-fields']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
95 cust <- split.kv.list(opt[['db-fields']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
96 opt[['db-fields']] <- split.kv.list(MSDB.DFT[['db-fields']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
97 opt[['db-fields']][names(cust)] <- cust |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
98 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
99 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
100 # Parse MS modes |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
101 if ( ! is.null(opt[['db-ms-modes']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
102 cust <- split.kv.list(opt[['db-ms-modes']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
103 opt[['db-ms-modes']] <- split.kv.list(MSDB.DFT[['db-ms-modes']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
104 opt[['db-ms-modes']][names(cust)] <- cust |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
105 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
106 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
107 # Parse retention time columns |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
108 if ( ! is.null(opt$rtcol)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
109 opt$rtcol <- strsplit(opt$rtcol, ',')[[1]] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
110 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
111 # Parse input column names |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
112 if (is.null(opt[['input-col-names']])) { |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
113 opt[['input-col-names']] <- msdb.get.dft.input.fields() |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
114 } |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
115 else { |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
116 custcols <- split.kv.list(opt[['input-col-names']]) |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
117 dftcols <- msdb.get.dft.input.fields() |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
118 opt[['input-col-names']] <- c(custcols, dftcols[ ! names(dftcols) %in% names(custcols)]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
119 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
120 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
121 # Parse output column names |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
122 if (is.null(opt[['output-col-names']])) { |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
123 # By default keep input col names for output |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
124 opt[['output-col-names']] <- msdb.get.dft.output.fields() |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
125 input.cols <- names(opt[['input-col-names']]) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
126 output.cols <- names(opt[['output-col-names']]) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
127 opt[['output-col-names']] <- c(opt[['input-col-names']][input.cols %in% output.cols], opt[['output-col-names']][ ! output.cols %in% input.cols]) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
128 } |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
129 else { |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
130 custcols <- split.kv.list(opt[['output-col-names']]) |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
131 dftcols <- msdb.get.dft.output.fields() |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
132 opt[['output-col-names']] <- c(custcols, dftcols[ ! names(dftcols) %in% names(custcols)]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
133 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
134 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
135 # Parse lists of precursors |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
136 if ( ! is.null(opt[['pos-prec']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
137 opt[['pos-prec']] <- split.str(opt[['pos-prec']], unlist = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
138 if ( ! is.null(opt[['neg-prec']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
139 opt[['neg-prec']] <- split.str(opt[['neg-prec']], unlist = TRUE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
140 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
141 return(opt) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
142 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
143 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
144 ################################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
145 # PRINT DEFAULT ARGUMENT VALUES # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
146 ################################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
147 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
148 print.dft.arg.val <- function(opt) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
149 |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
150 print.flags <- DEFAULT.ARG.VALUES |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
151 names(print.flags) <- vapply(names(print.flags), function(x) paste0('print-', x), FUN.VALUE = '') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
152 for (f in names(print.flags)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
153 if ( ! is.null(opt[[f]])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
154 cat(print.flags[[f]]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
155 q(status = 0) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
156 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
157 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
158 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
159 make.getopt.spec.print.dft <- function() { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
160 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
161 spec <- character() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
162 |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
163 for (f in names(DEFAULT.ARG.VALUES)) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
164 spec <- c(spec, paste0('print-', f), NA_character_, 0, 'logical', paste0('Print default value of --', f)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
165 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
166 return(spec) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
167 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
168 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
169 ############################## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
170 # MAKE GETOPT SPECIFICATIONS # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
171 ############################## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
172 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
173 make.getopt.spec <- function() { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
174 spec = c( |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
175 'help', 'h', 0, 'logical', 'Print this help.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
176 'mode', 'm', 1, 'character', paste0('MS mode. Possible values are:', paste(MSDB.MODE.VALS, collapse = ", "), '.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
177 'mzshift', 's', 1, 'numeric', paste0('Shift on m/z, in ppm. Default is ', MSDB.DFT$mzshift,'.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
178 'mzprec', 'p', 1, 'numeric', paste0('Tolerance on m/z, in ppm. Default is ', MSDB.DFT$mzprec,'.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
179 'mztolunit', NA_character_, 1, 'character', paste0('Tolerance on m/z, in ppm. Default is ', MSDB.DFT$mztolunit,'.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
180 'rttol', 'r', 1, 'numeric', paste0('Tolerance on retention times. Unset by default.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
181 'rttolx', 'x', 1, 'numeric', paste0('Tolerance on retention times. Unset by default.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
182 'rttoly', 'y', 1, 'numeric', paste0('Tolerance on retention times. Unset by default.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
183 'rtcol', 'c', 1, 'character', paste0('Chromatographic column to use. Unset by default. If set, use the corresponding column to filter on retention times, if retention times are provided.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
184 'all-cols', NA_character_, 0, 'logical', 'Use all available chromatographic columns to match retention times.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
185 'check-cols', NA_character_, 0, 'logical', 'Check that the chromatographic column names specified with option -c really exist.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
186 'list-cols', NA_character_, 0, 'logical', 'List all chromatographic columns present in the database. Write list inside the file specified by -o option.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
187 'same-rows', 'a', 0, 'logical', 'If set, output exactly the same number of rows as the input. This means that in case of multiple matches for one mz, then only one line is output (i.e.: the mz value is not duplicated on several lines). In the main output file, an "ms.matching" column is output with inside, for each mz, a comma separated list of matched component/molecule IDs. If unset, then only the main output file is used, and one single is written to it with one line per peak match, and eventual mz line duplicated if there are multiple matches for this mz.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
188 'same-cols', 'b', 0, 'logical', 'If set, output the same columns as inside the input. All input columns are copied to the output.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
189 'input-file', 'i', 1, 'character', 'Set input file.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
190 'output-file', 'o', 1, 'character', 'Set file to use for the main output.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
191 'peak-output-file', NA_character_, 1, 'character', 'If set and if --same-rows is set, then output all matches inside the specified file, with one mz match per line. The output columns are: mz, rt, id, col, colrt, composition, attribution. This means that if an mz value is matched several times, then it will repeated on several lines, with one match description per line.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
192 'html-output-file', NA_character_, 1, 'character', 'Set file to use for the HTML output.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
193 'no-main-table-in-html-output', NA_character_, 0, 'logical', 'Do not display main table in HTML output.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
194 'precursor-match', NA_character_, 0, 'logical', 'Remove peaks whose molecule precursor peak has not been matched. Unset by default.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
195 'precursor-rt-tol', NA_character_, 1, 'numeric', paste0('Precursor retention time tolerance. Only used when precursor-match is enabled. Default is ', MSDB.DFT[['precursor-rt-tol']], '.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
196 'pos-prec', NA_character_, 1, 'character', paste0('Set the list of precursors to use in positive mode. Default is "', MSDB.DFT[['pos-prec']], '".'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
197 'neg-prec', NA_character_, 1, 'character', paste0('Set the list of precursors to use in negative mode. Default is "', MSDB.DFT[['neg-prec']], '".'), |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
198 'input-col-names', NA_character_, 1, 'character', paste0('Set the input column names. Default is "', DEFAULT.ARG.VALUES[['input-col-names']], '".'), |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
199 'output-col-names', NA_character_, 1, 'character', paste0('Set the output column names. Default is "', DEFAULT.ARG.VALUES[['output-col-names']], '".'), |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
200 'molids-sep', NA_character_, 1, 'character', paste0('Set character separator used to when concatenating molecule IDs in output. Default is "', MSDB.DFT[['molids-sep']] , '".'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
201 'first-val', NA_character_, 0, 'logical', 'Keep only the first value in multi-value fields. Unset by default.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
202 'excel2011comp', NA_character_, 0, 'logical', 'Excel 2011 compatiblity mode. Output ASCII text files instead of UTF-8 files, where greek letters are replaced with their latin names, plusminus sign is replaced with +- and apostrophe is replaced with \"prime\". All other non-ASCII characters are repladed with underscore.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
203 'database', 'd', 1, 'character', paste0('Set database to use: "xls" for an Excel database, "file" for a single file database, "4tabsql" for a 4Tab SQL database, and "peakforest" for a connection to PeakForest database.'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
204 'url', NA_character_, 1, 'character', 'URL of database. For "peakforest" database it is the HTTP URL, for the "xls" database it is the path to the directory containing the Excel files, for the "file" database it is the path to the file database and for the "4tabsql" database it is the IP address of the server.', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
205 'cache-dir', NA_character_, 1, 'character', 'Path to directory where to store cache files. Only used when database flag is set to "xls".', |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
206 'db-name', NA_character_, 1, 'character', 'Name of the database. Used by the "4tabsql" database.', |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
207 'db-user', NA_character_, 1, 'character', 'User of the database. Used by the "4tabsql" database.', |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
208 'db-password', NA_character_, 1, 'character', 'Password of the database user. Used by the "4tabsql" database.', |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
209 'db-fields', NA_character_, 1, 'character', paste0('Comma separated key/value list giving the field names to be used in the single file database (option --db-file). Default is "', MSDB.DFT[['db-fields']], '".'), |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
210 'db-ms-modes', NA_character_, 1, 'character', paste0('Comma separated key/value list giving the MS modes to be used in the single file database (option --db-file). Default is "', MSDB.DFT[['db-ms-modes']], '".'), |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
211 'db-token', NA_character_, 1, 'character', 'Database token. Used by Peakforest database.', |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
212 'debug', NA_character_, 0, 'logical', 'Set debug mode.' |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
213 ) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
214 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
215 spec <- c(spec, make.getopt.spec.print.dft()) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
216 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
217 if ( ! is.null(spec)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
218 spec <- matrix(spec, byrow = TRUE, ncol = 5) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
219 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
220 return(spec) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
221 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
222 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
223 ############# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
224 # READ ARGS # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
225 ############# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
226 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
227 read_args <- function() { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
228 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
229 # options |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
230 spec <- make.getopt.spec() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
231 opt <- getopt(spec) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
232 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
233 # help |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
234 if ( ! is.null(opt$help)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
235 print.help(spec) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
236 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
237 print.dft.arg.val(opt) # Print default values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
238 opt <- set.dft.arg.val(opt) # Set default values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
239 opt <- parse.arg.val(opt) # Parse list values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
240 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
241 # Check values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
242 error <- .check.db.conn.opts(opt) |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
243 if (is.null(opt[['output-file']]) && is.null(opt[['list-cols']])) { |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
244 warning("You must set a path for the output file.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
245 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
246 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
247 if (is.null(opt[['list-cols']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
248 if (is.null(opt[['input-file']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
249 warning("You must provide an input file.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
250 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
251 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
252 if (is.null(opt$mode) || ( ! opt$mode %in% MSDB.MODE.VALS)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
253 warning("You must specify a mode through the --mode option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
254 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
255 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
256 if (is.null(opt$mzprec)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
257 warning("You must set a precision in MZ with the --mzprec option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
258 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
259 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
260 if ( ( ! is.null(opt$rtcol) || ! is.null(opt[['all-cols']])) && (is.null(opt$rttolx) || is.null(opt$rttoly))) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
261 warning("When chromatographic columns are set, you must provide values for --rttolx and -rttoly.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
262 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
263 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
264 if (is.null(opt$mztolunit) || ( ! opt$mztolunit %in% MSDB.MZTOLUNIT.VALS)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
265 warning("You must specify an M/Z tolerance unit through the --mztolunit option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
266 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
267 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
268 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
269 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
270 # help |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
271 if (error) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
272 print.help(spec, status = 1) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
273 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
274 return(opt) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
275 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
276 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
277 ##################################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
278 # CHECK DATABASE CONNECTION OPTIONS # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
279 ##################################### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
280 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
281 .check.db.conn.opts <- function(opt) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
282 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
283 # Print default values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
284 if ( ! is.null(opt[['print-db-fields']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
285 cat(MSDB.DFT[['db-fields']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
286 q(status = 0) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
287 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
288 if ( ! is.null(opt[['print-db-ms-modes']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
289 cat(MSDB.DFT[['db-ms-modes']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
290 q(status = 0) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
291 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
292 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
293 # Check values |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
294 error <- FALSE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
295 if (is.null(opt$database)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
296 warning("You must provide a database type through --database option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
297 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
298 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
299 if ( ! opt$database %in% MSDB.VALS) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
300 warning(paste0("Invalid value \"", opt$database, "\" for --database option.")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
301 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
302 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
303 if (opt$database == MSDB.FILE) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
304 if (is.null(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
305 warning("When using single file database, you must specify the location of the database file with option --url.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
306 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
307 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
308 if ( ! file.exists(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
309 warning(paste0("The file path \"", opt$url,"\" specified with --db-file option is not valid.")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
310 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
311 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
312 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
313 if (opt$database == MSDB.XLS) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
314 if (is.null(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
315 warning("When using Excel database, you must specify the location of the Excel files directory with option --url.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
316 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
317 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
318 if ( ! file.exists(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
319 warning(paste0("The directory path \"", opt$url,"\" specified with --xls-dir option is not valid.")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
320 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
321 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
322 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
323 if (opt$database == MSDB.4TABSQL) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
324 if (is.null(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
325 warning("When using 4Tab SQL database, you must specify the URL of the SQL server with option --url.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
326 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
327 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
328 if (is.null(opt[['db-name']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
329 warning("When using 4Tab SQL database, you must specify the database name through the --db-name option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
330 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
331 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
332 if (is.null(opt[['db-user']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
333 warning("When using 4Tab SQL database, you must specify the database user through the --db-user option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
334 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
335 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
336 if (is.null(opt[['db-password']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
337 warning("When using 4Tab SQL database, you must specify the database user password through the --db-password option.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
338 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
339 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
340 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
341 if (opt$database == MSDB.PEAKFOREST) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
342 if (is.null(opt$url)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
343 warning("When using PeakForest database, you must specify the URL of the PeakForest server with option --url.") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
344 error <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
345 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
346 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
347 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
348 return(error) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
349 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
350 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
351 ############################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
352 # DISPLAY COMMAND LINE HELP # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
353 ############################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
354 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
355 .disp.cmd.line.help <- function(optspec, opt, prog, error = FALSE) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
356 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
357 if ( ! is.null(opt$help) || error ) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
358 cat(getopt(optspec, usage = TRUE, command = prog)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
359 q(status = 1) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
360 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
361 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
362 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
363 ################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
364 # LOAD DATABASE # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
365 ################# |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
366 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
367 .load.db <- function(opt) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
368 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
369 if (is.null(opt[['pos-prec']]) && is.null(opt[['neg-prec']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
370 precursors <- NULL |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
371 } else { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
372 precursors <- list() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
373 precursors[[MSDB.TAG.POS]] <- opt[['pos-prec']] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
374 precursors[[MSDB.TAG.NEG]] <- opt[['neg-prec']] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
375 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
376 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
377 db <- switch(opt$database, |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
378 peakforest = MsPeakForestDb$new(url = opt$url, useragent = USERAGENT, token = opt[['db-token']]), |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
379 xls = MsXlsDb$new(db_dir = opt$url, cache_dir = opt[['cache-dir']]), |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
380 '4tabsql' = Ms4TabSqlDb$new(host = extract.address(opt$url), port = extract.port(opt$url), dbname = opt[['db-name']], user = opt[['db-user']], password = opt[['db-password']]), |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
381 file = MsFileDb$new(file = opt$url), |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
382 NULL) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
383 db$setPrecursors(precursors) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
384 if (db$areDbFieldsSettable()) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
385 db$setDbFields(opt[['db-fields']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
386 if (db$areDbMsModesSettable()) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
387 db$setDbMsModes(opt[['db-ms-modes']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
388 db$addObservers(MsDbLogger$new()) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
389 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
390 return(db) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
391 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
392 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
393 ############### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
394 # OUTPUT HTML # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
395 ############### |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
396 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
397 output.html <- function(db, main, peaks, file, opt, output.fields) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
398 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
399 # Replace public database IDs by URLs |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
400 if ( ! is.null(peaks) || ! is.null(main)) { |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
401 # Conversion from extdb id field to extdb name |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
402 extdb2classdb = list() |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
403 extdb2classdb[MSDB.TAG.KEGG] = BIODB.KEGG |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
404 extdb2classdb[MSDB.TAG.HMDB] = BIODB.HMDB |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
405 extdb2classdb[MSDB.TAG.CHEBI] = BIODB.CHEBI |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
406 extdb2classdb[MSDB.TAG.PUBCHEM] = BIODB.PUBCHEMCOMP |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
407 |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
408 # Loop on all dbs |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
409 for (extdb in c(MSDB.TAG.KEGG, MSDB.TAG.HMDB, MSDB.TAG.CHEBI, MSDB.TAG.PUBCHEM)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
410 field <- output.fields[[extdb]] |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
411 if ( ! is.null(peaks) && field %in% colnames(peaks)) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
412 peaks[[field]] <- vapply(peaks[[field]], function(id) if (is.na(id)) '' else paste0('<a href="', get.entry.url(class = extdb2classdb[[extdb]], accession = id, content.type = BIODB.HTML), '">', id, '</a>'), FUN.VALUE = '') |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
413 if ( ! is.null(main) && field %in% colnames(main)) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
414 main[[field]] <- vapply(main[[field]], function(ids) if (is.na(ids) || nchar(ids) == 0) '' else paste(vapply(strsplit(ids, opt[['molids-sep']])[[1]], function(id) paste0('<a href="', get.entry.url(class = extdb2classdb[[extdb]], accession = id, content.type = BIODB.HTML), '">', id, '</a>'), FUN.VALUE = ''), collapse = opt[['molids-sep']]), FUN.VALUE = '') |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
415 } |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
416 } |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
417 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
418 # Write HTML |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
419 html <- HtmlWriter(file = file) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
420 html$writeBegTag('html') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
421 html$writeBegTag('header') |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
422 html$writeTag('meta', attr = c(charset = "UTF-8")) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
423 html$writeTag('title', text = "LC/MS matching results") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
424 html$writeBegTag('style') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
425 html$write('table, th, td { border-collapse: collapse; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
426 html$write('table, th { border: 1px solid black; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
427 html$write('td { border-left: 1px solid black; border-right: 1px solid black; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
428 html$write('th, td { padding: 5px; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
429 html$write('th { background-color: LightBlue; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
430 html$write('tr:nth-child(even) { background-color: LemonChiffon; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
431 html$write('tr:nth-child(odd) { background-color: LightGreen; }') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
432 html$writeEndTag('style') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
433 html$writeEndTag('header') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
434 html$writeBegTag('body') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
435 html$writeTag('h1', text = "LC/MS matching") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
436 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
437 # Write parameters |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
438 html$writeTag('h2', text = "Parameters") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
439 html$writeBegTag('ul') |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
440 html$writeTag('li', text = paste0("Mode = ", opt$mode, ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
441 html$writeTag('li', text = paste0("M/Z precision = ", opt$mzprec, ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
442 html$writeTag('li', text = paste0("M/Z shift = ", opt$mzshift, ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
443 html$writeTag('li', text = paste0("Precursor match = ", (if (is.null(opt[['precursor-match']])) "no" else "yes"), ".")) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
444 if ( ! is.null(opt[['precursor-match']])) { |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
445 html$writeTag('li', text = paste0("Positive precursors = ", paste0(opt[['pos-prec']], collapse = ', '), ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
446 html$writeTag('li', text = paste0("Negative precursors = ", paste0(opt[['neg-prec']], collapse = ', '), ".")) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
447 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
448 if ( ! is.null(opt$rtcol)) { |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
449 html$writeTag('li', text = paste0("Columns = ", paste(opt$rtcol, collapse = ", "), ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
450 html$writeTag('li', text = paste0("RTX = ", opt$rttolx, ".")) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
451 html$writeTag('li', text = paste0("RTY = ", opt$rttoly, ".")) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
452 if ( ! is.null(opt[['precursor-match']])) |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
453 html$writeTag('li', text = paste0("RTZ = ", opt[['precursor-rt-tol']], ".")) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
454 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
455 html$writeEndTag('ul') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
456 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
457 # Write results |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
458 html$writeTag('h2', text = "Results") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
459 results <- FALSE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
460 if ( ! is.null(main) && nrow(main) > 0 && is.null(opt[['no-main-table-in-html-output']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
461 html$writeTag('h3', text = "Main output") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
462 html$writeTable(main) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
463 results <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
464 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
465 if ( ! is.null(peaks) && nrow(peaks) > 0) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
466 html$writeTag('h3', text = "Matched peaks") |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
467 html$writeTable(peaks) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
468 results <- TRUE |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
469 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
470 if ( ! results) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
471 html$writeTag('p', 'None.') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
472 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
473 html$writeEndTag('body') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
474 html$writeEndTag('html') |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
475 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
476 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
477 ######## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
478 # MAIN # |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
479 ######## |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
480 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
481 options(error = function() { traceback(2) ; quit(status = 1) }, warn = 2 ) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
482 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
483 # Read command line arguments |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
484 opt <- read_args() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
485 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
486 if (is.null(opt$debug)) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
487 options(error = function() { quit(status = 1) }, warn = 0 ) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
488 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
489 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
490 # Load database |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
491 db <- .load.db(opt) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
492 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
493 # Print columns |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
494 if ( ! is.null(opt[['list-cols']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
495 cols <- db$getChromCol() |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
496 df.write.tsv(cols, file = if (is.null(opt[['output-file']])) stdout() else opt[['output-file']]) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
497 q(status = 0) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
498 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
499 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
500 # Read input |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
501 if ( ! is.null(opt[['input-file']]) && ! file.exists(opt[['input-file']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
502 stop(paste0("Input file \"", opt[['input-file']], "\" does not exist.")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
503 if (file.info(opt[['input-file']])$size > 0) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
504 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
505 # Load file into data frame |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
506 input <- read.table(file = opt[['input-file']], header = TRUE, sep = "\t", stringsAsFactor = FALSE) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
507 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
508 # Convert each column that is identified by a number into a name |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
509 for (field in names(opt[['input-col-names']])) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
510 if ( ! opt[['input-col-names']][[field]] %in% colnames(input) && length(grep('^[0-9]+$', opt[['input-col-names']][[field]])) > 0) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
511 col.index <- as.integer(opt[['input-col-names']][[field]]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
512 if (col.index < 1 || col.index > length(colnames(input))) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
513 stop(paste0("No column n°", col.index, " for input field ", field, ".")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
514 opt[['input-col-names']][[field]] <- colnames(input)[[col.index]] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
515 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
516 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
517 } else { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
518 input <- data.frame() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
519 input[[opt[['input-col-names']][['mz']]]] <- double() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
520 input[[opt[['input-col-names']][['rt']]]] <- double() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
521 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
522 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
523 # Check mz column |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
524 if ( ! opt[['input-col-names']][['mz']] %in% colnames(input)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
525 stop(paste0('No column named "', opt[['input-col-names']][['mz']], '" in input file.')) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
526 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
527 # Set columns 'all-cols' specified |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
528 if ( ! is.null(opt[['all-cols']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
529 opt$rtcol <- db$getChromCol() |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
530 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
531 # Check chrom columns |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
532 if ( ! is.null(opt[['check-cols']]) && ! is.null(opt$rtcol)) { |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
533 dbcols <- db$getChromCol()[['id']] |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
534 unknown.cols <- opt$rtcol[ ! opt$rtcol %in% dbcols] |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
535 if (length(unknown.cols) > 0) { |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
536 stop(paste0("Unknown chromatographic column", (if (length(unknown.cols) > 1) 's' else ''), ': ', paste(unknown.cols, collapse = ', '), ".\nAllowed chromatographic column names are:\n", paste(dbcols, collapse = "\n"))) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
537 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
538 } |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
539 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
540 # Check that an RT column exists when using MZ/RT matching |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
541 if ( ! is.null(opt$rtcol) && ! opt[['input-col-names']][['rt']] %in% colnames(input)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
542 stop(paste0("You are running an MZ/RT match run on your input data, but no retention time column named '", opt[['input-col-names']][['rt']],"' can be found inside your input file.")) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
543 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
544 # Set streams |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
545 input.stream <- MsDbInputDataFrameStream$new(df = input, input.fields = opt[['input-col-names']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
546 main.output <- MsDbOutputDataFrameStream$new(keep.unused = ! is.null(opt[['same-cols']]), output.fields = opt[['output-col-names']], one.line = ! is.null(opt[['same-rows']]), match.sep = opt[['molids-sep']], first.val = ! is.null(opt[['first-val']]), ascii = ! is.null(opt[['excel2011comp']]), nogreek = ! is.null(opt[['excel2011comp']]), noapostrophe = ! is.null(opt[['excel2011comp']]), noplusminus = ! is.null(opt[['excel2011comp']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
547 peaks.output <- MsDbOutputDataFrameStream$new(keep.unused = ! is.null(opt[['same-cols']]), output.fields = opt[['output-col-names']], first.val = ! is.null(opt[['first-val']]), ascii = ! is.null(opt[['excel2011comp']]), nogreek = ! is.null(opt[['excel2011comp']]), noapostrophe = ! is.null(opt[['excel2011comp']]), noplusminus = ! is.null(opt[['excel2011comp']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
548 invisible(db$setInputStream(input.stream)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
549 db$addOutputStreams(c(main.output, peaks.output)) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
550 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
551 # Set M/Z tolerance unit |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
552 db$setMzTolUnit(opt$mztolunit) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
553 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
554 # Search database |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
555 mode <- if (opt$mode == POS_MODE) MSDB.TAG.POS else MSDB.TAG.NEG |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
556 db$searchForMzRtList(mode = mode, shift = opt$mzshift, prec = opt$mzprec, rt.tol = opt$rttol, rt.tol.x = opt$rttolx, rt.tol.y = opt$rttoly, col = opt$rtcol, precursor.match = ! is.null(opt[['precursor-match']]), precursor.rt.tol = opt[['precursor-rt-tol']]) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
557 |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
558 # Write output |
|
1
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
559 main.output$moveColumnsToBeginning(colnames(input)) |
|
45e985cd8e9e
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
prog
parents:
0
diff
changeset
|
560 peaks.output$moveColumnsToBeginning(colnames(input)) |
|
0
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
561 # TODO Create a class MsDbOutputCsvFileStream |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
562 df.write.tsv(main.output$getDataFrame(), file = opt[['output-file']], row.names = FALSE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
563 if ( ! is.null(opt[['peak-output-file']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
564 # TODO Create a class MsDbOutputCsvFileStream |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
565 df.write.tsv(peaks.output$getDataFrame(), file = opt[['peak-output-file']], row.names = FALSE) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
566 if ( ! is.null(opt[['html-output-file']])) |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
567 # TODO Create a class MsDbOutputHtmlFileStream |
|
3afe41d3e9e7
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit bb4d3e23d99828bfee16d31d794c49a17313ec2f
prog
parents:
diff
changeset
|
568 output.html(db = db, main = main.output$getDataFrame(), peaks = peaks.output$getDataFrame(), file = opt[['html-output-file']], opt = opt, output.fields = opt[['output-col-names']]) |
