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
19 from Residues import Residues
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
58
60 s = []
61 s.append(self.sid)
62 s.append(str(self.residues).replace(" ","\t") )
63 s.append(self.hierarchy)
64 return "\t".join(s) + "\n"
65
66
68 """Iterates over a DOM file, returning a Dom record for each line
69 in the file.
70
71 Arguments:
72
73 handle -- file-like object.
74 """
75 for line in handle:
76 yield Record(line)
77
78
80 """Iterates over a DOM file.
81 """
82 - def __init__(self, handle, parser=None):
83 """Create an object that iterates over a DES file.
84
85 handle -- file-like object.
86
87 parser -- an optional Parser object to change the results into
88 another form. If set to None, then the raw contents
89 of the file will be returned.
90
91 """
92 from types import FileType, InstanceType
93 if type(handle) is not FileType and type(handle) is not InstanceType:
94 raise ValueError("I expected a file handle or file-like object")
95 self._handle = handle
96 self._parser = parser
97
99 line = self._handle.readline()
100 if not line:
101 return None
102 if self._parser is not None:
103 return self._parser.parse(line)
104 return line
105
108 """Returns a Dom.Record """
109 import warnings
110 warnings.warn("""Bio.SCOP.Dom.Parser is deprecated.
111 Instead of
112
113 parser = Dom.Parser()
114 record = parser.parse(entry)
115
116 please use
117
118 record = Dom.Record(entry)
119 """)
120 return Record(entry)
121