annotate createSettingsFile.py @ 2:94d6243033ec draft default tip

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