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