Read in the enzymes file.
1
2
16
17import msparser
18import sys
19
20if len(sys.argv) < 2 :
21 print("""
22The location of enzymes file has to be specified as a parameter.
23The location should either be the full path to the enzymes file
24or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi
25""")
26 sys.exit(1)
27
28
29
30if len(sys.argv) > 2 :
31 cs = msparser.ms_connection_settings()
32 cs.setSessionID(sys.argv[2])
33 file = msparser.ms_enzymefile(sys.argv[1], cs)
34else :
35 file = msparser.ms_enzymefile(sys.argv[1])
36
37if not file.isValid() :
38 print("There are errors. Cannot continue. The last error description:")
39 print(file.getLastErrorString())
40 sys.exit(1)
41
42
43n = file.getNumberOfEnzymes()
44print("There are " + str(n) + " enzyme definitions available")
45
46for i in range(n) :
47 enzyme = file.getEnzymeByNumber(i)
48 defs = []
49
50 for c in range(enzyme.getNumberOfCutters()) :
51 if enzyme.getCutterType(c) == msparser.ms_enzyme.NTERM_CUTTER :
52 term = "nTerm"
53 else :
54 term = "cTerm"
55
56 defs.append("%s - %s!%s" % (term, enzyme.getCleave(c), enzyme.getRestrict(c)))
57
58 print("%s: %s" % (enzyme.getTitle(), "; ".join(defs)))
59
60
61
62enzyme = file.getEnzymeByNumber(0)
63enzyme.setSemiSpecific(True)
64file.updateEnzymeByNumber(0, enzyme)
65
66
67file.deleteEnzymeByName("V8-DE")
68
69
70file.setFileName(sys.argv[1] + ".new")
71file.save_file()
72
73if not file.isValid() :
74 print("Failed to save: %s" % file.getLastErrorString())
75else :
76 print("%s.new now has %d enzyme definitions available" % (sys.argv[1], file.getNumberOfEnzymes()))
77
78
79""" Running the program as
80
81python config_enzymes.pl /usr/local/mascot/config/enzymes
82
83will give the following output under Mascot Server 2.3
84
85
86There are 21 enzyme definitions available
87Trypsin: cTerm - KR!P
88Trypsin/P: cTerm - KR!
89Arg-C: cTerm - R!P
90Asp-N: nTerm - BD!
91Asp-N_ambic: nTerm - DE!
92Chymotrypsin: cTerm - FLWY!P
93CNBr: cTerm - M!
94CNBr+Trypsin: cTerm - M!; cTerm - KR!P
95Formic_acid: nTerm - D!; cTerm - D!
96Lys-C: cTerm - K!P
97Lys-C/P: cTerm - K!
98LysC+AspN: nTerm - BD!; cTerm - K!P
99Lys-N: nTerm - K!
100PepsinA: cTerm - FL!
101semiTrypsin: cTerm - KR!P
102TrypChymo: cTerm - FKLRWY!P
103TrypsinMSIPI: nTerm - J!; cTerm - KR!P; cTerm - J!
104TrypsinMSIPI/P: nTerm - J!; cTerm - JKR!
105V8-DE: cTerm - BDEZ!P
106V8-E: cTerm - EZ!P
107None: cTerm - KR!P
108/usr/local/mascot/config/enzymes.new now has 20 enzyme definitions available
109
110
111"""