1
2
3
4
5
6
7 """
8 This module provides code to work with the enzyme.dat file from
9 Enzyme.
10 http://www.expasy.ch/enzyme/
11
12 Tested with the release of 03-Mar-2009.
13
14 Functions:
15 read Reads a file containing one ENZYME entry
16 parse Reads a file containing multiple ENZYME entries
17
18 Classes:
19 Record Holds ENZYME data.
20
21 """
22
24 """Parse ENZYME records.
25
26 This function is for parsing ENZYME files containing multiple
27 records.
28
29 handle - handle to the file."""
30
31 while True:
32 record = __read(handle)
33 if not record:
34 break
35 yield record
36
38 """Read one ENZYME record.
39
40 This function is for parsing ENZYME files containing
41 exactly one record.
42
43 handle - handle to the file."""
44
45 record = __read(handle)
46
47 remainder = handle.read()
48 if remainder:
49 raise ValueError("More than one ENZYME record found")
50 return record
51
52
54 """\
55 Holds information from an ExPASy ENZYME record as a Python dictionary.
56
57 Each record contains the following keys:
58 ID: EC number
59 DE: Recommended name
60 AN: Alternative names (if any)
61 CA: Catalytic activity
62 CF: Cofactors (if any)
63 PR: Pointers to the Prosite documentation entrie(s) that
64 correspond to the enzyme (if any)
65 DR: Pointers to the Swiss-Prot protein sequence entrie(s)
66 that correspond to the enzyme (if any)
67 CC: Comments
68 """
69
71 dict.__init__(self)
72 self["ID"] = ''
73 self["DE"] = ''
74 self["AN"] = []
75 self["CA"] = ''
76 self["CF"] = ''
77 self["CC"] = []
78 self["PR"] = []
79 self["DR"] = []
80
82 if self["ID"]:
83 if self["DE"]:
84 return "%s (%s, %s)" % (self.__class__.__name__,
85 self["ID"], self["DE"])
86 else:
87 return "%s (%s)" % (self.__class__.__name__,
88 self["ID"])
89 else:
90 return "%s ( )" % (self.__class__.__name__)
91
93 output = "ID: " + self["ID"]
94 output += " DE: " + self["DE"]
95 output += " AN: " + repr(self["AN"])
96 output += " CA: '" + self["CA"] + "'"
97 output += " CF: " + self["CF"]
98 output += " CC: " + repr(self["CC"])
99 output += " PR: " + repr(self["PR"])
100 output += " DR: %d Records" % len(self["DR"])
101 return output
102
103
104
149