view test/usecase1.py @ 1168:b556c96c6719
blocks3d/www Makefile: never check certificates of github, they are too confusing for wget
| author |
Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
| date |
Mon, 26 May 2014 17:20:29 +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)