1
2
3
4
5
6
7 from Entity import Entity
8
9
10 __doc__="The structure class, representing a macromolecular structure."
11
12
14 """
15 The Structure class contains a collection of Model instances.
16 """
20
21
22
24 return "<Structure id=%s>" % self.get_id()
25
26
27
29 """Sort models.
30
31 This sorting function sorts the Model instances in the Structure instance.
32 The sorting is done based on the model id, which is a simple int that
33 reflects the order of the models in the PDB file.
34
35 Arguments:
36 o m1, m2 - Model instances
37 """
38 return cmp(m1.get_id(), m2.get_id())
39
40
41
43 for m in self:
44 for c in m:
45 yield c
46
48 for c in self.get_chains():
49 for r in c :
50 yield r
51
56