allpy
changeset 733:73070c394dc4
SequenceMixin: args resi_begin and resi_end of set_pdb_chain can be integers
Side effect: matching of pdb identifiers became less accurate,
only integers are compared, but insertion codes not
see #70
author | boris <bnagaev@gmail.com> |
---|---|
date | Fri, 08 Jul 2011 18:53:14 +0200 |
parents | d7ecda3130eb |
children | eb2aa74497d5 |
files | allpy/structure.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- a/allpy/structure.py Fri Jul 08 20:52:06 2011 +0400 1.2 +++ b/allpy/structure.py Fri Jul 08 18:53:14 2011 +0200 1.3 @@ -83,6 +83,7 @@ 1.4 * resi_begin and resi_end -- identifiers of first and last pdb 1.5 residues of residue range to be used. If only one is provided, 1.6 another parameter is set to first or last residue of chain. 1.7 + They can be integers or biopythons identifiers of residues. 1.8 Id of residue is (hetero_flag, sequence_id, insertion_code), 1.9 see biopdb documantation for more information. 1.10 1.11 @@ -102,10 +103,14 @@ 1.12 self.pdb_chain = chain 1.13 pdb_sequence = self.__class__.from_pdb_chain(chain) 1.14 if resi_begin: 1.15 - while pdb_sequence[0].pdb_residue.get_id() != resi_begin: 1.16 + if isinstance(resi_begin, int): 1.17 + resi_begin = (None, resi_begin, None) 1.18 + while pdb_sequence[0].pdb_residue.get_id()[1] != resi_begin[1]: 1.19 pdb_sequence.pop(0) 1.20 if resi_end: 1.21 - while pdb_sequence[-1].pdb_residue.get_id() != resi_end: 1.22 + if isinstance(resi_end, int): 1.23 + resi_end = (None, resi_end, None) 1.24 + while pdb_sequence[-1].pdb_residue.get_id()[1] != resi_end[1]: 1.25 pdb_sequence.pop() 1.26 Alignment = self.types.Alignment 1.27 a = Alignment()