Mercurial > repos > computational-metabolomics > mspurity_createmsp
annotate combineAnnotations.R @ 6:d25273689e04 draft
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
| author | computational-metabolomics | 
|---|---|
| date | Thu, 04 Mar 2021 12:31:13 +0000 | 
| parents | 54593159627d | 
| children | b91b9492a4bf | 
| rev | line source | 
|---|---|
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
1 library(optparse) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
2 library(msPurity) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
3 print(sessionInfo()) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
4 | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
5 # Get the parameter | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
6 option_list <- list( | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
7 make_option(c("-s", "--sm_resultPth"), type = "character"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
8 make_option(c("-m", "--metfrag_resultPth"), type = "character"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
9 make_option(c("-c", "--sirius_csi_resultPth"), type = "character"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
10 make_option(c("-p", "--probmetab_resultPth"), type = "character"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
11 make_option(c("-l", "--ms1_lookup_resultPth"), type = "character"), | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
12 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
13 make_option("--ms1_lookup_checkAdducts", action = "store_true"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
14 make_option("--ms1_lookup_keepAdducts", type = "character", default = NA), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
15 make_option("--ms1_lookup_dbSource", type = "character", default = "hmdb"), | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
16 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
17 make_option("--sm_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
18 make_option("--metfrag_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
19 make_option("--sirius_csi_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
20 make_option("--probmetab_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
21 make_option("--ms1_lookup_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
22 make_option("--biosim_weight", type = "numeric"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
23 | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
24 make_option("--summaryOutput", action = "store_true"), | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
25 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
26 make_option("--create_new_database", action = "store_true"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
27 make_option("--outdir", type = "character", default = "."), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
28 | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
29 make_option("--compoundDbType", type = "character", default = "sqlite"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
30 make_option("--compoundDbPth", type = "character", default = NA), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
31 make_option("--compoundDbHost", type = "character", default = NA) | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
32 ) | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
33 opt <- parse_args(OptionParser(option_list = option_list)) | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
34 | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
35 print(opt) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
36 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
37 if (!is.null(opt$create_new_database)) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
38 sm_resultPth <- file.path(opt$outdir, "combined_annotations.sqlite") | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
39 file.copy(opt$sm_resultPth, sm_resultPth) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
40 }else{ | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
41 sm_resultPth <- opt$sm_resultPth | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
42 } | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
43 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
44 if (is.null(opt$ms1_lookup_checkAdducts)) { | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
45 opt$ms1_lookup_checkAdducts <- FALSE | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
46 } | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
47 if (!is.null(opt$ms1_lookup_keepAdducts)) { | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
48 opt$ms1_lookup_keepAdducts <- gsub("__ob__", "[", opt$ms1_lookup_keepAdducts) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
49 opt$ms1_lookup_keepAdducts <- gsub("__cb__", "]", opt$ms1_lookup_keepAdducts) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
50 ms1_lookup_keepAdducts <- strsplit(opt$ms1_lookup_keepAdducts, ",")[[1]] | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
51 } | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
52 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
53 weights <- list("sm" = opt$sm_weight, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
54 "metfrag" = opt$metfrag_weight, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
55 "sirius_csifingerid" = opt$sirius_csi_weight, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
56 "probmetab" = opt$probmetab_weight, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
57 "ms1_lookup" = opt$ms1_lookup_weight, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
58 "biosim" = opt$biosim_weight | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
59 ) | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
60 print(weights) | 
| 
2
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
61 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
62 if (is.null(opt$probmetab_resultPth)) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
63 opt$probmetab_resultPth <- NA | 
| 
2
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
64 } | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
65 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
66 if (round(!sum(unlist(weights), 0) == 1)) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
67 stop(paste0("The weights should sum to 1 not ", sum(unlist(weights)))) | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
68 } | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
69 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
70 if (is.null(opt$summaryOutput)) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
71 summaryOutput <- FALSE | 
| 
2
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
72 }else{ | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
73 summaryOutput <- TRUE | 
| 
2
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
74 } | 
| 
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
75 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
76 if (opt$compoundDbType == "local_config") { | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
77 # load in compound config | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
78 # Soure local function taken from workflow4metabolomics | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
79 source_local <- function(fname) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
80 argv <- commandArgs(trailingOnly = FALSE) | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
81 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
82 source(paste(base_dir, fname, sep = "/")) | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
83 } | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
84 source_local("dbconfig.R") | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
85 }else{ | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
86 compoundDbPth <- opt$compoundDbPth | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
87 compoundDbType <- opt$compoundDbType | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
88 compoundDbName <- NA | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
89 compoundDbHost <- NA | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
90 compoundDbPort <- NA | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
91 compoundDbUser <- NA | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
92 compoundDbPass <- NA | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
93 } | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
94 | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
95 summary_output <- msPurity::combineAnnotations( | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
96 sm_resultPth = sm_resultPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
97 compoundDbPth = compoundDbPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
98 metfrag_resultPth = opt$metfrag_resultPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
99 sirius_csi_resultPth = opt$sirius_csi_resultPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
100 probmetab_resultPth = opt$probmetab_resultPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
101 ms1_lookup_resultPth = opt$ms1_lookup_resultPth, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
102 ms1_lookup_keepAdducts = ms1_lookup_keepAdducts, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
103 ms1_lookup_checkAdducts = opt$ms1_lookup_checkAdducts, | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
104 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
105 compoundDbType = compoundDbType, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
106 compoundDbName = compoundDbName, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
107 compoundDbHost = compoundDbHost, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
108 compoundDbPort = compoundDbPort, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
109 compoundDbUser = compoundDbUser, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
110 compoundDbPass = compoundDbPass, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
111 weights = weights, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
112 summaryOutput = summaryOutput) | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
113 if (summaryOutput) { | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
114 write.table(summary_output, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
115 file.path(opt$outdir, "combined_annotations.tsv"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
116 sep = "\t", row.names = FALSE) | 
| 
2
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
117 } | 
| 
 
54593159627d
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
 
computational-metabolomics 
parents: 
0 
diff
changeset
 | 
118 | 
| 
6
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
119 write.table(summary_output, | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
120 file.path(opt$outdir, "combined_annotations.tsv"), | 
| 
 
d25273689e04
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 
computational-metabolomics 
parents: 
2 
diff
changeset
 | 
121 sep = "\t", row.names = FALSE) | 
| 
0
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
122 | 
| 
 
35898942bfbb
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
123 closeAllConnections() | 
