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

Read in the modifications file - modfile.

1#!/usr/bin/python
2
16
17import msparser
18import sys
19
20if len(sys.argv) < 3:
21 print("Usage: %s UNIMOD SCHEMA" % sys.argv[0])
22 print("UNIMOD is the file path to the unimod.xml file, e.g., ../config/unimod.xml or a fully formed URL such as http://www.matrixscience.com/cgi .")
23 print("SCHEMA is the unimod schema file path, e.g., ../html/xmlns/schema/unimod_2/unimod_2.xsd")
24 sys.exit(1)
25
26umodFile = msparser.ms_umod_configfile(sys.argv[1], sys.argv[2])
27file = msparser.ms_modfile(umodFile)
28
29if not file.isValid() :
30 print("There are errors. Cannot continue. The last error description:")
31 print(file.getLastErrorString())
32 sys.exit(1)
33
34n = file.getNumberOfModifications()
35print("There are %d modifications configured:" % n)
36
37for i in range(n) :
38 print(file.getModificationByNumber(i).getTitle())
39
40
41# Now change Acetyl (K).
42mod = file.getModificationByName("Acetyl (K)")
43mod.setHidden(True)
44file.updateModificationByName("Acetyl (K)", mod)
45
46# And delete Methyl (R).
47file.deleteModificationByName("Methyl (R)")
48
49# Finally, save the file under a new name.
50file.setFileName(sys.argv[1] + ".new")
51file.save_file()
52
53if not file.isValid() :
54 print("Failed to save: %s" % file.getLastErrorString())
55else :
56 print("%s.new now has %d modifications configured" % (sys.argv[1], file.getNumberOfModifications()))
57
58
59
60"""
61
62Running the program as
63
64python config_modfile.py ../config/unimod.xml ../html/xmlns/schema/unimod_2/unimod_2.xsd
65
66will give the following output under Mascot Server 2.3:
67
68
69There are 886 modifications configured:
7015dB-biotin (C)
712-succinyl (C)
722HPG (R)
733-deoxyglucosone (R)
743sulfo (N-term)
754-ONE (C)
764-ONE (H)
774-ONE (K)
784-ONE+Delta:H(-2)O(-1) (C)
794-ONE+Delta:H(-2)O(-1) (H)
804-ONE+Delta:H(-2)O(-1) (K)
814AcAllylGal (C)
82a-type-ion (C-term)
83AccQTag (K)
84AccQTag (N-term)
85Acetyl (C)
86 [...]
87Xlink:B10621 (C)
88Xlink:DMP (K)
89Xlink:DMP (Protein N-term)
90Xlink:DMP-s (K)
91Xlink:DMP-s (Protein N-term)
92Xlink:novobiocin (N-term)
93Xlink:SSD (K)
94ZGB (K)
95ZGB (N-term)
96/usr/local/mascot/config/mod_file.new now has 885 modifications configured
97
98
99"""
100