Author: bugman Date: Fri Apr 4 14:13:28 2008 New Revision: 5291 URL: http://svn.gna.org/viewcvs/relax?rev=5291&view=rev Log: Modifications to the structure.read_pdb() user function. The 'parser' argument has been added to allow different PDB parsers to be selected in the future. To allow for the new relax design, the docstring has been updated with respect to the loading of the sequence and the 'spin_id' argument has been added to allow the selection of specific atoms of the PDB file to be placed as SpinContainers in the relax data store. Modified: 1.3/prompt/structure.py Modified: 1.3/prompt/structure.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/structure.py?rev=5291&r1=5290&r2=5291&view=diff ============================================================================== --- 1.3/prompt/structure.py (original) +++ 1.3/prompt/structure.py Fri Apr 4 14:13:28 2008 @@ -232,7 +232,7 @@ structure.create_vector_dist(length=length, symmetry=symmetry, file=file, dir=dir, force=force) - def read_pdb(self, file=None, dir=None, model=None, load_seq=1): + def read_pdb(self, file=None, dir=None, model=None, parser='scientific', load_seq=True, spin_id='@N'): """The pdb loading function. Keyword Arguments @@ -244,7 +244,11 @@ model: The PDB model number. + parser: The PDB parser used to read the file. + load_seq: A flag specifying whether the sequence should be loaded from the PDB file. + + spin_id: The spin identification string. Description @@ -254,8 +258,14 @@ structure beginning with the line 'MODEL i' in the PDB file will be loaded. Otherwise all structures will be loaded starting from the model number 1. - To load the sequence from the PDB file, set the 'load_seq' flag to 1. If the sequence has - previously been loaded, then this flag will be ignored. + Currently only the Scientific Python PDB parser can be used to read structural data. + Therefore the 'parser' argument should be set to the string 'scientific'. + + To load the molecule, residue, and spin system sequence from the PDB file, set the + 'load_seq' flag to True. If the sequence has previously been loaded, then this flag will be + ignored. The 'spin_id' string will be used to determine which molecules, which residues, + and which atoms will be loaded for the analysis. If this argument is set to None, then all + molecules, all residues, and all atoms in the PDB file will be loaded. Example @@ -263,8 +273,8 @@ To load all structures from the PDB file 'test.pdb' in the directory '~/pdb', type: - relax> structure.read_pdb('test.pdb', '~/pdb', 1) - relax> structure.read_pdb(file='test.pdb', dir='pdb', model=1) + relax> structure.read_pdb('test.pdb', '~/pdb') + relax> structure.read_pdb(file='test.pdb', dir='pdb') To load the 10th model from the file 'test.pdb', use: @@ -280,7 +290,9 @@ text = text + "file=" + `file` text = text + ", dir=" + `dir` text = text + ", model=" + `model` - text = text + ", load_seq=" + `load_seq` + ")" + text = text + ", parser=" + `parser` + text = text + ", load_seq=" + `load_seq` + text = text + ", spin_id=" + `spin_id` + ")" print text # File name. @@ -295,12 +307,20 @@ if model != None and type(model) != int: raise RelaxNoneIntError, ('model', model) + # PDB parser. + if type(parser) != str: + raise RelaxStrError, ('PDB parser', parser) + # The load sequence argument. - if type(load_seq) != int or (load_seq != 0 and load_seq != 1): - raise RelaxBinError, ('load sequence flag', load_seq) + if type(load_seq) != bool: + raise RelaxBoolError, ('load sequence flag', load_seq) + + # Spin identifier. + if spin_id != None and type(spin_id) != str: + raise RelaxNoneStrError, ('spin identifier', spin_id) # Execute the functional code. - structure.read_pdb(file=file, dir=dir, model=model, load_seq=load_seq) + structure.read_pdb(file=file, dir=dir, model=model, parser=parser, load_seq=load_seq, spin_id=spin_id) def vectors(self, heteronuc='N', proton='H', spin_id=None, verbosity=1):