allpy
changeset 831:afc8c5adb699
apply changes of rasmol_output to rasmol_homology
Changes 830:aee5173245b6 and 827:abb2aa401257 were applied
to rasmol_homology
author | boris (kodomo) <bnagaev@gmail.com> |
---|---|
date | Sat, 16 Jul 2011 19:59:16 +0400 |
parents | aee5173245b6 |
children | 0dc6d90af0cf |
files | utils/rasmol_homology.py |
diffstat | 1 files changed, 20 insertions(+), 4 deletions(-) [+] |
line diff
1.1 --- a/utils/rasmol_homology.py Sat Jul 16 17:07:19 2011 +0400 1.2 +++ b/utils/rasmol_homology.py Sat Jul 16 19:59:16 2011 +0400 1.3 @@ -3,6 +3,8 @@ 1.4 import optparse 1.5 from allpy import protein, structure, markups, homology 1.6 1.7 +flank_size = 5 #flanks' size 1.8 + 1.9 class Alignment(protein.Alignment, structure.AlignmentMixin): 1.10 pass 1.11 class Block(protein.Block, structure.BlockMixin): 1.12 @@ -80,15 +82,23 @@ 1.13 process_sequence(main_sequence, len(alignment.sequences)-1) 1.14 main_sequence.pdb_unload() 1.15 1.16 +def sequence2name(sequence): 1.17 + return 'str_%s' % sequence.name.replace('/','_').replace(':','_') 1.18 + 1.19 +sequence_names = [] 1.20 for sequence, chain_model in idmap.items(): 1.21 chain, model = chain_model 1.22 - write('define str_%s *:%s' % (sequence.name, chain)) 1.23 + write('define %s *:%s' % (sequence2name(sequence), chain)) 1.24 + sequence_names.append(sequence2name(sequence)) 1.25 1.26 write('select all') 1.27 write('color chain') 1.28 write('restrict none') 1.29 write('background [230, 240, 250]') 1.30 write('select none') 1.31 +write('select %s' % ', '.join(sequence_names)) 1.32 +write('backbone') 1.33 +write('pause') 1.34 1.35 for num, block in enumerate(blocks, 1): 1.36 name = 'block_%s' % num 1.37 @@ -100,24 +110,30 @@ 1.38 warn("Skipping %s of depth %s" % (name, len(block.sequences))) 1.39 continue 1.40 1.41 + with_flanks = [] 1.42 parts = [] 1.43 for sequence in block.sequences: 1.44 chain, model = idmap[sequence] 1.45 resi_from = monomer2id[block.columns[0][sequence]] 1.46 resi_to = monomer2id[block.columns[-1][sequence]] 1.47 + with_flanks.append('%i-%i:%s' % (resi_from-flank_size, resi_to+flank_size, chain)) 1.48 parts.append('%i-%i:%s' % (resi_from, resi_to, chain)) 1.49 1.50 selection = ','.join(parts) 1.51 - sequences = ', '.join(seq.name for seq in block.sequences) 1.52 + sequences = ', '.join(sequence2name(seq) for seq in block.sequences) 1.53 column_from = alignment.markups['number'][block.columns[0]] 1.54 column_to = alignment.markups['number'][block.columns[-1]] 1.55 1.56 write('') 1.57 - write('backbone') 1.58 + write('define with_flanks_%i %s' % (num, ','.join(with_flanks))) 1.59 write('define %s %s' % (name, selection)) 1.60 + write('select with_flanks_%i' % num) 1.61 + write('backbone 60') 1.62 write('select %s' % (name)) 1.63 write('echo %s %s %i-%i' % (name, sequences, column_from, column_to)) 1.64 - write('backbone 100') 1.65 + write('backbone 150') 1.66 write('pause') 1.67 + write('select with_flanks_%i' % num) 1.68 + write('backbone ') 1.69 1.70 # vim: set et ts=4 sts=4 sw=4: