allpy
changeset 592:2f851b66a2c7
structure.py: fix set_pdb_chain()
use "is" for monomers instead of Sequence.index
(due to different monomers could be ==)
author | boris (kodomo) <bnagaev@gmail.com> |
---|---|
date | Sat, 26 Mar 2011 02:18:36 +0300 |
parents | 49582a92418a |
children | 6c6ae5013ab6 |
files | allpy/structure.py |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line diff
1.1 --- a/allpy/structure.py Sat Mar 26 02:16:01 2011 +0300 1.2 +++ b/allpy/structure.py Sat Mar 26 02:18:36 2011 +0300 1.3 @@ -98,7 +98,6 @@ 1.4 a.append_sequence(self) 1.5 a.append_sequence(pdb_sequence) 1.6 a.process(processors.Muscle()) 1.7 - mutations = 0 1.8 Block = self.types.Block 1.9 matches = Block.from_alignment(a, columns=[]) 1.10 for column in a.columns: 1.11 @@ -118,10 +117,17 @@ 1.12 for block in match_blocks: 1.13 for column in block.columns: 1.14 matched_pdb.append(column[pdb_sequence]) 1.15 - central_start = pdb_sequence.index(matched_pdb[0]) 1.16 - central_stop = pdb_sequence.index(matched_pdb[-1]) + 1 1.17 - central_pdb = pdb_sequence[central_start:central_stop] 1.18 - central_pdb = [m for m in central_pdb if hasattr(m, 'pdb_residue')] 1.19 + central_start = matched_pdb[0] 1.20 + central_stop = matched_pdb[-1] 1.21 + central_pdb = [] 1.22 + started = False 1.23 + for m in pdb_sequence: 1.24 + if m is central_start: 1.25 + started = True 1.26 + if started and hasattr(m, 'pdb_residue'): 1.27 + central_pdb.append(m) 1.28 + if m is central_stop: 1.29 + break 1.30 assert len(set(central_pdb) - set(matched_pdb)) <= max_waste_in_pdb 1.31 assert len(matched_pdb) >= min_match 1.32