annotate createSettingsFile.py @ 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 import sys
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
2
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
3 # Script that creates a .ini settings file for RMassBank pipeline
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
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
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
5 # INPUT: mysettings.ini (default file downloaded via R package RMassBank, will be stored in the docker)
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
6 #
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
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
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
8
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
9 fin = open(sys.argv[1], "r")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
10 fout = open("mysettings_galaxy.ini", "wt")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
11 for line in fin:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
12 if "rtMargin:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
13 fout.write("rtMargin: " + sys.argv[2] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
14 elif "rtShift:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
15 fout.write("rtShift: " + sys.argv[3] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
16 elif "babeldir:" in line and "#" not in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
17 fout.write("babeldir: '" + sys.argv[32] + "'\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
18 elif "use_version:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
19 fout.write("use_version: " + sys.argv[4] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
20 elif "use_rean_peaks:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
21 fout.write("use_rean_peaks: " + sys.argv[5] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
22 elif "add_annotation:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
23 fout.write("add_annotation: " + sys.argv[6] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
24 elif "include_sp_tags:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
25 fout.write("include_sp_tags: " + sys.argv[33] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
26 elif "pH:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
27 fout.write(" pH: " + sys.argv[7] + " # [M+H]+: Accession numbers 1-14\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
28 elif "pM:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
29 fout.write(" pM: " + sys.argv[8] + " # [M]+: 17-30\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
30 elif "pNa:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
31 fout.write(" pNa: " + sys.argv[9] + " # [M+Na]+: 33-46\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
32 elif "mH:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
33 fout.write(" mH: " + sys.argv[10] + " # [M-H]-: 51-64\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
34 elif "mFA:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
35 fout.write(" mFA: " + sys.argv[11] + " # [M+FA]-: 67-80\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
36 elif "electronicNoiseWidth:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
37 fout.write("electronicNoiseWidth: " + sys.argv[12] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
38 elif "recalibrateBy:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
39 fout.write("recalibrateBy: " + sys.argv[13] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
40 elif "recalibrateMS1:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
41 fout.write("recalibrateMS1: " + sys.argv[14] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
42 elif "recalibrateMS1Window:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
43 fout.write("recalibrateMS1Window: " + sys.argv[15] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
44 elif "multiplicityFilter:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
45 fout.write("multiplicityFilter: " + sys.argv[16] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
46 elif "ppmHighMass:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
47 fout.write(" ppmHighMass: " + sys.argv[17] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
48 elif "ppmLowMass:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
49 fout.write(" ppmLowMass: " + sys.argv[18] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
50 elif "massRangeDivision:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
51 fout.write(" massRangeDivision: " + sys.argv[19] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
52 elif "ppmFine:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
53 fout.write(" ppmFine: " + sys.argv[20] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
54 elif "prelimCut:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
55 fout.write(" prelimCut: " + sys.argv[21] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
56 elif "prelimCutRatio:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
57 fout.write(" prelimCutRatio: " + sys.argv[22] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
58 elif "fineCut:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
59 fout.write(" fineCut: " + sys.argv[23] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
60 elif "fineCutRatio:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
61 fout.write(" fineCutRatio: " + sys.argv[24] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
62 elif "specOkLimit:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
63 fout.write(" specOkLimit: " + sys.argv[25] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
64 elif "dbeMinLimit:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
65 fout.write(" dbeMinLimit: " + sys.argv[26] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
66 elif "satelliteMzLimit:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
67 fout.write(" satelliteMzLimit: " + sys.argv[27] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
68 elif "satelliteIntLimit:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
69 fout.write(" satelliteIntLimit: " + sys.argv[28] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
70 elif "ppmFine:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
71 fout.write(" ppmFine: " + sys.argv[29] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
72 elif "mzCoarse:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
73 fout.write(" mzCoarse: " + sys.argv[30] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
74 elif "fillPrecursorScan:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
75 fout.write(" fillPrecursorScan: " + sys.argv[31] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
76 elif "unknownMass:" in line:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
77 fout.write("unknownMass: " + sys.argv[34] + "\n")
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
78 else:
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
79 fout.write(line)
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
80 fin.close()
0b28816c1c2c planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/rmassbank commit 02414aa4c20f249c2069e5e3d587e3a8cda923a8
recetox
parents:
diff changeset
81 fout.close()