comparison createSettingsFile.py @ 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
comparison
equal deleted inserted replaced
-1:000000000000 0:0b28816c1c2c
1 import sys
2
3 # Script that creates a .ini settings file for RMassBank pipeline
4 # Intended to be wrapped as a tool to Galaxy (in docker) to create users of RMassBank the mysettings.ini file -> very "stupid" script, does not check correctness of user's input, that will do Galaxy XML wrapper
5 # INPUT: mysettings.ini (default file downloaded via R package RMassBank, will be stored in the docker)
6 #
7 # python script.py mysettings.ini 0.34 0.34 34 FALSE FALSE 34 34 34 34 34 0.34 dmz none 34 34 34 34 34 34 34 34 34 34 34 0.34 0.34 0.34 34 0.34 TRUE /babeldir/path FALSE charged
8
9 fin = open(sys.argv[1], "r")
10 fout = open("mysettings_galaxy.ini", "wt")
11 for line in fin:
12 if "rtMargin:" in line:
13 fout.write("rtMargin: " + sys.argv[2] + "\n")
14 elif "rtShift:" in line:
15 fout.write("rtShift: " + sys.argv[3] + "\n")
16 elif "babeldir:" in line and "#" not in line:
17 fout.write("babeldir: '" + sys.argv[32] + "'\n")
18 elif "use_version:" in line:
19 fout.write("use_version: " + sys.argv[4] + "\n")
20 elif "use_rean_peaks:" in line:
21 fout.write("use_rean_peaks: " + sys.argv[5] + "\n")
22 elif "add_annotation:" in line:
23 fout.write("add_annotation: " + sys.argv[6] + "\n")
24 elif "include_sp_tags:" in line:
25 fout.write("include_sp_tags: " + sys.argv[33] + "\n")
26 elif "pH:" in line:
27 fout.write(" pH: " + sys.argv[7] + " # [M+H]+: Accession numbers 1-14\n")
28 elif "pM:" in line:
29 fout.write(" pM: " + sys.argv[8] + " # [M]+: 17-30\n")
30 elif "pNa:" in line:
31 fout.write(" pNa: " + sys.argv[9] + " # [M+Na]+: 33-46\n")
32 elif "mH:" in line:
33 fout.write(" mH: " + sys.argv[10] + " # [M-H]-: 51-64\n")
34 elif "mFA:" in line:
35 fout.write(" mFA: " + sys.argv[11] + " # [M+FA]-: 67-80\n")
36 elif "electronicNoiseWidth:" in line:
37 fout.write("electronicNoiseWidth: " + sys.argv[12] + "\n")
38 elif "recalibrateBy:" in line:
39 fout.write("recalibrateBy: " + sys.argv[13] + "\n")
40 elif "recalibrateMS1:" in line:
41 fout.write("recalibrateMS1: " + sys.argv[14] + "\n")
42 elif "recalibrateMS1Window:" in line:
43 fout.write("recalibrateMS1Window: " + sys.argv[15] + "\n")
44 elif "multiplicityFilter:" in line:
45 fout.write("multiplicityFilter: " + sys.argv[16] + "\n")
46 elif "ppmHighMass:" in line:
47 fout.write(" ppmHighMass: " + sys.argv[17] + "\n")
48 elif "ppmLowMass:" in line:
49 fout.write(" ppmLowMass: " + sys.argv[18] + "\n")
50 elif "massRangeDivision:" in line:
51 fout.write(" massRangeDivision: " + sys.argv[19] + "\n")
52 elif "ppmFine:" in line:
53 fout.write(" ppmFine: " + sys.argv[20] + "\n")
54 elif "prelimCut:" in line:
55 fout.write(" prelimCut: " + sys.argv[21] + "\n")
56 elif "prelimCutRatio:" in line:
57 fout.write(" prelimCutRatio: " + sys.argv[22] + "\n")
58 elif "fineCut:" in line:
59 fout.write(" fineCut: " + sys.argv[23] + "\n")
60 elif "fineCutRatio:" in line:
61 fout.write(" fineCutRatio: " + sys.argv[24] + "\n")
62 elif "specOkLimit:" in line:
63 fout.write(" specOkLimit: " + sys.argv[25] + "\n")
64 elif "dbeMinLimit:" in line:
65 fout.write(" dbeMinLimit: " + sys.argv[26] + "\n")
66 elif "satelliteMzLimit:" in line:
67 fout.write(" satelliteMzLimit: " + sys.argv[27] + "\n")
68 elif "satelliteIntLimit:" in line:
69 fout.write(" satelliteIntLimit: " + sys.argv[28] + "\n")
70 elif "ppmFine:" in line:
71 fout.write(" ppmFine: " + sys.argv[29] + "\n")
72 elif "mzCoarse:" in line:
73 fout.write(" mzCoarse: " + sys.argv[30] + "\n")
74 elif "fillPrecursorScan:" in line:
75 fout.write(" fillPrecursorScan: " + sys.argv[31] + "\n")
76 elif "unknownMass:" in line:
77 fout.write("unknownMass: " + sys.argv[34] + "\n")
78 else:
79 fout.write(line)
80 fin.close()
81 fout.close()