view test/usecase1.py @ 520:1785e40b2a2d
blocks3d(): add primary_cliques parameter
if primary_cliques parameter is set,
blocks3d() returns self-overlapping raw cliques (as blocks)
instead of set of self-non-overlapping blocks (default)
it could be used for debugging and testing
author |
boris (kodomo) <bnagaev@gmail.com> |
date |
Sat, 26 Feb 2011 18:05:10 +0300 |
parents |
0435d9cc18d3 |
children |
07b5351b0b56 |
line source
1 from allpy import protein
2 from allpy import processors
4 # Create sequences from string representation of sequence body
5 sequence_1 = protein.Sequence.from_string("mkstf", name="E2E4")
6 sequence_2 = protein.Sequence.from_string("mstkfff", description="Longer sequence")
8 # Create alignment from sequences
9 alignment = protein.Alignment()
10 alignment.append_sequence(sequence_1)
11 alignment.append_sequence(sequence_2)
12 alignment.process(processors.Muscle())
14 # For each sequence, print number of gaps and non-gaps in alignment
15 for row in alignment.rows():
18 for column in alignment.columns:
23 print "%s: %s gaps, %s non-gaps" % (row.sequence.name, gaps, monomers)
25 # Print number of gaps in each column
27 for column in alignment.columns:
29 for sequence in alignment.sequences:
30 if sequence not in column:
32 gaps.append(column_gaps)
33 print " ".join(map(str, gaps))
35 # Write alignment to file
36 alignment.to_file(open("new_file.fasta", "w"))