Package prompt :: Module pdb
[hide private]
[frames] | no frames]

Source Code for Module prompt.pdb

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003, 2004 Edward d'Auvergne                                  # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  import sys 
 24   
 25   
26 -class PDB:
27 - def __init__(self, relax):
28 """Class containing the function for loading a pdb file.""" 29 30 self.relax = relax
31 32
33 - def pdb(self, run=None, file=None, dir=None, model=None, heteronuc='N', proton='H', load_seq=1):
34 """The pdb loading function. 35 36 Keyword Arguments 37 ~~~~~~~~~~~~~~~~~ 38 39 run: The run to assign the structure to. 40 41 file: The name of the PDB file. 42 43 dir: The directory where the file is located. 44 45 model: The PDB model number. 46 47 heteronuc: The name of the heteronucleus as specified in the PDB file. 48 49 proton: The name of the proton as specified in the PDB file. 50 51 load_seq: A flag specifying whether the sequence should be loaded from the PDB file. 52 53 54 Description 55 ~~~~~~~~~~~ 56 57 To load a specific model from the PDB file, set the model flag to an integer i. The 58 structure beginning with the line 'MODEL i' in the PDB file will be loaded. Otherwise all 59 structures will be loaded starting from the model number 1. 60 61 To load the sequence from the PDB file, set the 'load_seq' flag to 1. If the sequence has 62 previously been loaded, then this flag will be ignored. 63 64 Once the PDB structures are loaded, unit XH bond vectors will be calculated. The vectors 65 are calculated using the atomic coordinates of the atoms specified by the arguments 66 heteronuc and proton. If more than one model structure is loaded, the unit XH vectors for 67 each model will be calculated and the final unit XH vector will be taken as the average. 68 69 70 Example 71 ~~~~~~~ 72 73 To load all structures from the PDB file 'test.pdb' in the directory '~/pdb' for use in the 74 model-free analysis run 'm8' where the heteronucleus in the PDB file is 'N' and the proton 75 is 'H', type: 76 77 relax> pdb('m8', 'test.pdb', '~/pdb', 1, 'N', 'H') 78 relax> pdb(run='m8', file='test.pdb', dir='pdb', model=1, heteronuc='N', proton='H') 79 80 81 To load the 10th model from the file 'test.pdb', use: 82 83 relax> pdb('m1', 'test.pdb', model=10) 84 relax> pdb(run='m1', file='test.pdb', model=10) 85 86 """ 87 88 # Function intro text. 89 if self.relax.interpreter.intro: 90 text = sys.ps3 + "pdb(" 91 text = text + "run=" + `run` 92 text = text + ", file=" + `file` 93 text = text + ", dir=" + `dir` 94 text = text + ", model=" + `model` 95 text = text + ", heteronuc=" + `heteronuc` 96 text = text + ", proton=" + `proton` 97 text = text + ", load_seq=" + `load_seq` + ")" 98 print text 99 100 # The run argument. 101 if type(run) != str: 102 raise RelaxStrError, ('run', run) 103 104 # File name. 105 if type(file) != str: 106 raise RelaxStrError, ('file name', file) 107 108 # Directory. 109 if dir != None and type(dir) != str: 110 raise RelaxNoneStrError, ('directory name', dir) 111 112 # The model argument. 113 if model != None and type(model) != int: 114 raise RelaxIntError, ('model', model) 115 116 # The heteronucleus argument. 117 if type(heteronuc) != str: 118 raise RelaxStrError, ('heteronucleus', heteronuc) 119 120 # The proton argument. 121 if type(proton) != str: 122 raise RelaxStrError, ('proton', proton) 123 124 # The load sequence argument. 125 if type(load_seq) != int or (load_seq != 0 and load_seq != 1): 126 raise RelaxBinError, ('load sequence flag', load_seq) 127 128 # Execute the functional code. 129 self.relax.generic.pdb.load(run=run, file=file, dir=dir, model=model, heteronuc=heteronuc, proton=proton, load_seq=load_seq)
130