1
2
3
4
5
6 """Model class, used in Structure objects."""
7
8 from Bio.PDB.Entity import Entity
9
10
12 """
13 The object representing a model in a structure. In a structure
14 derived from an X-ray crystallography experiment, only a single
15 model will be present (with some exceptions). NMR structures
16 normally contain many different models.
17 """
18
19 - def __init__(self, id, serial_num = None):
20 """
21 Arguments:
22 o id - int
23 o serial_num - int
24 """
25 self.level="M"
26 if serial_num is None:
27 self.serial_num=id
28 else:
29 self.serial_num=serial_num
30
31 Entity.__init__(self, id)
32
33
34
36 """Sort the Chains instances in the Model instance.
37
38 Chain instances are sorted alphabetically according to
39 their chain id. Blank chains come last, as they often consist
40 of waters.
41
42 Arguments:
43 o c1, c2 - Chain objects
44 """
45 id1=c1.get_id()
46 id2= c2.get_id()
47
48 if id1==" " and not id2==" ":
49 return 1
50 elif id2==" " and not id1==" ":
51 return -1
52 return cmp(id1, id2)
53
54
55
57 return "<Model id=%s>" % self.get_id()
58
59
60
62 for c in self:
63 for r in c:
64 yield r
65
70