view test/usecase1.py @ 350:0411fa851bba
Fixed references to base interface according to previous changes (closes #12)
author |
Daniil Alexeyevsky <me.dendik@gmail.com> |
date |
Fri, 21 Jan 2011 15:00:23 +0300 |
parents |
38888b46c342 |
children |
dd94230c6f08 |
line source
1 from allpy import protein
3 # Create sequences from string representation of sequence body
4 sequence_1 = protein.Sequence.from_string("mkstf", name="E2E4")
5 sequence_2 = protein.Sequence.from_string("mstkfff", description="Longer sequence")
7 # Create alignment from sequences
8 alignment = protein.Alignment()
9 alignment.append_sequence(sequence_1)
10 alignment.append_sequence(sequence_2)
11 alignment.realign("muscle")
13 # For each sequence, print number of gaps and non-gaps in alignment
14 for row in alignment.rows():
17 for column in alignment.columns:
22 print "%s: %s gaps, %s non-gaps" % (row.sequence.name, gaps, monomers)
24 # Print number of gaps in each column
26 for column in alignment.columns:
28 for sequence in alignment.sequences:
29 if sequence not in column:
31 gaps.append(column_gaps)
32 print " ".join(map(str, gaps))
34 # Write alignment to file
35 alignment.to_fasta(open("new_file.fasta", "w"))