Package Bio :: Package PDB :: Module Structure
[hide private]
[frames] | no frames]

Source Code for Module Bio.PDB.Structure

 1  # Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) 
 2  # This code is part of the Biopython distribution and governed by its 
 3  # license.  Please see the LICENSE file that should have been included 
 4  # as part of this package. 
 5   
 6  """The structure class, representing a macromolecular structure.""" 
 7   
 8  from Bio.PDB.Entity import Entity 
 9   
10   
11 -class Structure(Entity):
12 """The Structure class contains a collection of Model instances.""" 13
14 - def __init__(self, id):
15 """Initialize the class.""" 16 self.level = "S" 17 Entity.__init__(self, id)
18
19 - def __repr__(self):
20 return "<Structure id=%s>" % self.get_id()
21
22 - def get_models(self):
23 for m in self: 24 yield m
25
26 - def get_chains(self):
27 for m in self.get_models(): 28 for c in m: 29 yield c
30
31 - def get_residues(self):
32 for c in self.get_chains(): 33 for r in c: 34 yield r
35
36 - def get_atoms(self):
37 for r in self.get_residues(): 38 for a in r: 39 yield a
40