1
2
3
4
5
6
7 """ Handle the SCOP DEScription file.
8
9 The file format is described in the scop
10 "release notes.":http://scop.berkeley.edu/release-notes-1.55.html
11 The latest DES file can be found
12 "elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
13
14 "Release 1.55":http://scop.berkeley.edu/parse/des.cla.scop.txt_1.55 (July 2001)
15 """
16
17
19 """Holds information for one node in the SCOP hierarchy.
20
21 sunid -- SCOP unique identifiers
22
23 nodetype -- One of 'cl' (class), 'cf' (fold), 'sf' (superfamily),
24 'fa' (family), 'dm' (protein), 'sp' (species),
25 'px' (domain). Additional node types may be added.
26
27 sccs -- SCOP concise classification strings. e.g. b.1.2.1
28
29 name -- The SCOP ID (sid) for domains (e.g. d1anu1),
30 currently empty for other node types
31
32 description -- e.g. "All beta proteins","Fibronectin type III",
33
34 """
36 self.sunid = ''
37 self.nodetype = ''
38 self.sccs = ''
39 self.name = ''
40 self.description =''
41 if line:
42 self._process(line)
43
45 """Parses DES records.
46
47 Records consist of 5 tab deliminated fields,
48 sunid, node type, sccs, node name, node description.
49 """
50
51
52
53
54
55
56
57
58 line = line.rstrip()
59 columns = line.split("\t")
60 if len(columns) != 5:
61 raise ValueError("I don't understand the format of %s" % line)
62
63 sunid, self.nodetype, self.sccs, self.name, self.description = columns
64 if self.name=='-': self.name =''
65 self.sunid = int(sunid)
66
67
79
80
82 """Iterates over a DES file, returning a Des record for each line
83 in the file.
84
85 Arguments:
86 handle -- file-like object
87 """
88 for line in handle:
89 if line.startswith('#'):
90 continue
91 yield Record(line)
92