Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
config_fragrules.py

Read in the fragmentation_rules file.

1#!/usr/bin/python
2
16
17import msparser
18import sys
19
20if len(sys.argv) < 2 :
21 print("""
22The location of 'fragmentation_rules' file has to be specified as a parameter.
23The location should either be the full path to the 'fragmentation_rules' file
24or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi
25""")
26
27 sys.exit(1)
28
29# A sessionID can optionally be passed as the second parameter.
30# This will only be required if the 'file' is a URL.
31if len(sys.argv) > 2 :
32 cs = msparser.ms_connection_settings()
33 cs.setSessionID(sys.argv[2])
34 file = msparser.ms_fragrulesfile(sys.argv[1], cs)
35else :
36 file = msparser.ms_fragrulesfile(sys.argv[1])
37
38if not file.isValid() :
39 print("There are errors. Cannot continue. The last error description:")
40 print(file.getLastErrorString())
41 sys.exit(1)
42
43
44n = file.getNumberOfInstruments()
45print("%d instruments are configured:" % n)
46
47for i in range(n) :
48 print(file.getInstrumentName(i))
49
50
51# Now change ESI-QUAD-TOF.
52instrument = file.getInstrumentByName("ESI-QUAD-TOF")
53instrument.setSeriesUsed(23, True) # Add v series
54file.updateInstrumentByName("ESY-QUAD-TOF", instrument)
55
56# And delete MALDI-QIT-TOF.
57file.deleteInstrumentByName("MALDI-QIT-TOF")
58
59# Finally, save the file under a new name.
60file.setFileName(sys.argv[1] + ".new");
61file.save_file();
62
63if not file.isValid() :
64 print("Failed to save: %s" % file.getLastErrorString())
65else :
66 print("%s.new now has %d instruments configured" % (sys.argv[1], file.getNumberOfInstruments()))
67
68firstSeries = msparser.ms_fragmentationrules.getFirstSeries()
69
70firstSeries = msparser.ms_fragmentationrules.getFirstSeries()
71lastSeries = msparser.ms_fragmentationrules.getLastSeries()
72
73print("First series: %s" % firstSeries)
74print("Last series : %s" % lastSeries)
75
76for i in range(firstSeries, 1 + lastSeries) :
77 print("--------- %d ---------" % i)
78 print(msparser.ms_fragmentationrules.getSeriesName(i))
79 print(msparser.ms_fragmentationrules.getSeriesDescription(i))
80
81
82""" Running the program as
83
84python config_fragfules.py /usr/local/mascot/config/fragmentation_rules
85
86will give the following output under Mascot Server 2.3:
87
88
8914 instruments are configured:
90Default
91ESI-QUAD-TOF
92MALDI-TOF-PSD
93ESI-TRAP
94ESI-QUAD
95ESI-FTICR
96MALDI-TOF-TOF
97ESI-4SECTOR
98FTMS-ECD
99ETD-TRAP
100MALDI-QUAD-TOF
101MALDI-QIT-TOF
102MALDI-ISD
103CID+ETD
104/usr/local/mascot/config/fragmentation_rules.new now has 13 instruments configured
105First series: 4
106Last series : 25
107--------- 4 ---------
108immonium
109immonium
110--------- 5 ---------
111a
112a series
113--------- 6 ---------
114a*
115a - NH3 if a significant and fragment includes RKNQ
116--------- 7 ---------
117a0
118a - H2O if a significant and fragment includes STED
119--------- 8 ---------
120b
121b series
122--------- 9 ---------
123b*
124b - NH3 if b significant and fragment includes RKNQ
125--------- 10 ---------
126b0
127b - H2O if b significant and fragment includes STED
128--------- 11 ---------
129c
130c series
131--------- 12 ---------
132x
133x series
134--------- 13 ---------
135y
136y series
137--------- 14 ---------
138y*
139y - NH3 if y significant and fragment includes RKNQ
140--------- 15 ---------
141y0
142y - H2O if y significant and fragment includes STED
143--------- 16 ---------
144z
145z series
146--------- 17 ---------
147yb
148internal yb < 700 Da
149--------- 18 ---------
150ya
151internal ya < 700 Da
152--------- 19 ---------
153y must be significant
154y or y++ must be significant
155--------- 20 ---------
156y must be highest score
157y or y++ must be highest scoring series
158--------- 21 ---------
159z+1
160z+1 series
161--------- 22 ---------
162d
163d and d' series
164--------- 23 ---------
165v
166v series
167--------- 24 ---------
168w
169w and w' series
170--------- 25 ---------
171z+2
172z+2 series
173
174"""
175