view test/usecase1.py @ 1116:45da1d3a60c3
pair_cores/web: add note about support by Ministry of Education and Science
author |
Boris Nagaev <bnagaev@gmail.com> |
date |
Wed, 28 Nov 2012 00:35:35 +0400 |
parents |
af1de9132035 |
children |
08d892230e8c |
line source
3 from allpy import protein
4 from allpy import processors
6 # Create sequences from string representation of sequence body
7 sequence_1 = protein.Sequence.from_string("mkstf", name="E2E4")
8 sequence_2 = protein.Sequence.from_string("mstkfff", description="Longer sequence")
10 # Create alignment from sequences
11 alignment = protein.Alignment()
12 alignment.append_sequence(sequence_1)
13 alignment.append_sequence(sequence_2)
14 alignment.realign(processors.Muscle())
16 # For each sequence, print number of gaps and non-gaps in alignment
17 for row in alignment.rows():
20 for column in alignment.columns:
25 print "%s: %s gaps, %s non-gaps" % (row.sequence.name, gaps, monomers)
27 # Print number of gaps in each column
29 for column in alignment.columns:
31 for sequence in alignment.sequences:
32 if sequence not in column:
34 gaps.append(column_gaps)
35 print " ".join(map(str, gaps))
37 # Write alignment to file
38 alignment.to_file(sys.stdout)