Mercurial > repos > recetox > rmassbank
annotate rmassbank.r @ 2:5a6bb93ec656 draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
author | recetox |
---|---|
date | Thu, 30 May 2024 14:53:55 +0000 |
parents | 0b28816c1c2c |
children |
rev | line source |
---|---|
0
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
2 # Script for running RMassBank pipeline: |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
3 # - part1 (all 8 steps at once) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
4 # - part2 (generation of MassBank records) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
5 # |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
6 # Author: Karolina Trachtova (k.trachtova@gmail.com) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
7 # Original authors of RMassBank: Michael Stravs, Emma Schymanski, |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
8 # Steffen Neumann, Erik Mueller, with contributions from Tobias Schulze. |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
9 # |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
10 # INPUT1: settings list |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
11 # INPUT2: compounds csv list |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
12 # INPUT3: mode |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
13 # INPUT4: folder with infolists |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
14 # INPUT5: one or more mzML files |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
15 # |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
16 # RUN: |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
17 # Rscript rmassbank_galaxy_part1.r mysettings.ini Compoundlist.csv pH \ |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
18 # /path/to/files/1_3_Chlorophenyl_piperazin_2818_pos.mzML \ |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
19 # /path/to/files/1_3_Trifluoromethylphenyl_piperazin_2819_pos.mzML |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
20 ############################################################# |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
21 # Load libraries |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
22 rm(list = ls(all = TRUE)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
23 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
24 suppressMessages(library("RMassBank", warn.conflicts = TRUE, quietly = TRUE)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
25 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
26 ############################################################# |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
27 # Read arguments |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
28 args <- commandArgs(trailingOnly = TRUE) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
29 |
2
5a6bb93ec656
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
0
diff
changeset
|
30 stt <- args[1] # file with settings |
5a6bb93ec656
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
0
diff
changeset
|
31 cmp <- args[2] # csv file with compounds |
5a6bb93ec656
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
0
diff
changeset
|
32 md <- args[3] # mode |
5a6bb93ec656
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
0
diff
changeset
|
33 inf <- args[4] # folder with csv infolist |
5a6bb93ec656
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit bc3445f7c41271b0062c7674108f57708d08dd28
recetox
parents:
0
diff
changeset
|
34 files <- (args[5:length(args)]) # one or multiple mzML files |
0
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
35 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
36 print(paste0("Used settings file: ", stt)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
37 print(paste0("Used compound list: ", cmp)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
38 print(paste0("RMassBank pipeline will be run in mode: ", md)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
39 print(paste0("Input files: ", files)) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
40 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
41 ############################################################# |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
42 ## PART I |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
43 # |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
44 # Preparing environment for running RMassBank |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
45 print("Preparing environment for part I ...") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
46 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
47 ## Load file with settings |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
48 loadRmbSettings(stt) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
49 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
50 ## create a workspace |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
51 w <- newMsmsWorkspace() |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
52 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
53 ## Load compound list |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
54 loadList(cmp) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
55 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
56 ## Load input files |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
57 w@files <- files |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
58 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
59 # Running RMassBank pipeline part I |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
60 print("Running RMassBank pipeline part 1 - all 8 steps...") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
61 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
62 prf <- c("results") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
63 w <- msmsWorkflow(w, mode = md, steps = c(1:8), archivename = prf) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
64 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
65 ## Part II |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
66 # |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
67 # Preparing environment for running RMassBank |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
68 print("Preparing environment for part II ...") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
69 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
70 mb <- newMbWorkspace(w) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
71 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
72 loadList(cmp) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
73 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
74 loadRmbSettings(stt) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
75 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
76 print("Loading infolist...") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
77 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
78 mb <- resetInfolists(mb) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
79 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
80 mb <- loadInfolists(mb, inf) |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
81 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
82 print("Running RMassBank pipeline for generation of MassBank records...") |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
83 |
0b28816c1c2c
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff
changeset
|
84 mb <- mbWorkflow(mb) |