Package edPDB
[hide private]
[frames] | no frames]

Source Code for Package edPDB

 1  # edPDB -- python snippets to edit pdb files 
 2  # Copyright (c) 2010 Oliver Beckstein <orbeckst@gmail.com> 
 3  # 
 4  # Published under the same licence as BioPython. 
 5   
 6  """ 
 7  :mod:`edPDB` -- editing PDB files 
 8  ================================= 
 9   
10  A collection of python snippets to quickly edit pdb files. This is 
11  typically used for setting up system for MD simulations. 
12   
13  Typically, one instantiates a :class:`edPDB.cbook.PDB` object (which 
14  can also be accessed as :class:`edPDB.PDB`) and uses the methods 
15  defined on it to write new pdb files. 
16   
17  The cook book :mod:`edPDB.cbook` contains some more specialized 
18  functions that are not integrated into :class:`~edPDB.cbook.PDB` yet; 
19  study the source and use them as examples. 
20   
21  Built on top of :mod:`Bio.PDB` from Biopython_. 
22   
23  .. _Biopython: http://biopython.org 
24   
25  Modules 
26  ------- 
27   
28  :mod:`edPDB.cbook` 
29      Cook-book with short functions that show how to implement basic 
30      functionality. 
31   
32  :mod:`edPDB.xpdb` 
33      Extensions to the Bio.PDB class. 
34   
35  :mod:`edPDB.selections` 
36      Selections that can be used to extract parts of a pdb. 
37   
38   
39  Future plans 
40  ------------ 
41   
42  Eventually using this module should become as intuitive as ``grep``, 
43  ``sed`` and ``cat`` of pdb files. 
44   
45  """ 
46   
47  try: 
48      import Bio.PDB 
49  except ImportError: 
50      raise ImportError("Biopython's Bio.PDB is absolutely essential. Please install it.") 
51   
52  import logging 
53  # NOTE: logging is still iffy; when I reload I add a new logger each 
54  # time and output is repeated for each reload. Probably should heed 
55  # the advice on logging and libraries in 
56  # http://docs.python.org/library/logging.html?#configuring-logging-for-a-library 
57 -class NullHandler(logging.Handler):
58 - def emit(self, record):
59 pass
60 61 # this clashes conceptually with the console stuff above: really the 62 # above needs to be done in application code; in that case the following 63 # would be enabled: 64 # 65 h = NullHandler() 66 logging.getLogger("edPDB").addHandler(h) 67 del h 68 69 # add standard logging 70 import log 71 logger = log.create() 72 73 74 import xpdb 75 import selections 76 import cbook 77 78 from cbook import PDB 79 80 __all__ = ['PDB'] 81