1
2
3
4
5
6
7
8
9
10 """ Handle the SCOP DOMain file.
11
12 The DOM file has been officially deprecated. For more information see
13 the SCOP"release notes.":http://scop.berkeley.edu/release-notes-1.55.html
14 The DOM files for older releases can be found
15 "elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
16 """
17
18 from Residues import Residues
19
20
22 """Holds information for one SCOP domain.
23
24 sid -- The SCOP ID of the entry, e.g. d1anu1
25
26 residues -- The domain definition as a Residues object
27
28 hierarchy -- A string specifying where this domain is in the hierarchy.
29 """
31 self.sid = ''
32 self.residues = []
33 self.hierarchy = ''
34 if line:
35 self._process(line)
36
38 """Parses DOM records.
39
40 Records consist of 4 tab deliminated fields;
41 sid, pdbid, residues, hierarchy
42 """
43
44
45
46
47
48
49
50 line = line.rstrip()
51 columns = line.split("\t")
52 if len(columns) != 4:
53 raise ValueError("I don't understand the format of %s" % line)
54 self.sid, pdbid, res, self.hierarchy = columns
55 self.residues = Residues(res)
56 self.residues.pdbid =pdbid
57
59 s = []
60 s.append(self.sid)
61 s.append(str(self.residues).replace(" ","\t") )
62 s.append(self.hierarchy)
63 return "\t".join(s) + "\n"
64
65
67 """Iterates over a DOM file, returning a Dom record for each line
68 in the file.
69
70 Arguments:
71
72 handle -- file-like object.
73 """
74 for line in handle:
75 if line.startswith('#'):
76 continue
77 yield Record(line)
78