view test/usecase3.py @ 1026:ca2cf2377bed
blocks_to_pymol(): use all blocks, not only the first one
Residue numbers are grouped in Pymol script.
(For example, "1-5,7" instead of "1,2,3,4,5,7".)
Otherwise, Pymol could produce segfault as a result of too long list.
Maybe, the problem remains, since even grouped list may be too long...
author |
Boris Nagaev <bnagaev@gmail.com> |
date |
Thu, 15 Mar 2012 23:17:23 +0400 |
parents |
e7d60bf1dfd8 |
children |
08d892230e8c |
line source
2 from allpy import protein
3 from allpy.processors import Left
4 from allpy.util import open
7 if __name__ == "__main__":
9 infile = open(sys.argv[2])
10 outfile = open(sys.argv[3])
12 # This accepts ranges in form "0:5,7:12,1:-1"
13 ranges = [map(int, range.split(':')) for range in ranges.split(',')]
15 alignment = protein.Alignment().append_file(sys.stdin)
16 for begin, end in ranges:
17 columns = alignment.columns[begin:end]
18 protein.Block.from_alignment(alignment, columns=columns).realign(Left())
19 alignment.remove_gap_columns()
20 alignment.to_file(sys.stdout)
22 # vim: set et ts=4 sts=4 sw=4: