allpy
view lib/project.py @ 96:9b91b49b9ef0
lib::alignment::from_sequences
author | boris <bnagaev@gmail.com> |
---|---|
date | Wed, 20 Oct 2010 22:24:59 +0400 |
parents | a2f3926f5077 |
children | 7dd461d17f96 |
line source
1 #!/usr/bin/python
3 """
4 "I will not use abbrev."
5 "I will always finish what I st"
6 - Bart Simpson
8 """
15 """
16 Mandatory data:
17 * sequences -- list of Sequence objects. Sequences don't contain gaps
18 - see sequence.py module
19 * alignment -- dict
20 {<Sequence object>:[<Monomer object>,None,<Monomer object>]}
21 keys are the Sequence objects, values are the lists, which
22 contain monomers of those sequences or None for gaps in the
23 corresponding sequence of
24 alignment
26 """
28 """overloaded constructor
30 Project() -> new empty Project
31 Project(sequences, alignment) -> new Project with sequences and
32 alignment initialized from arguments
33 Project(fasta_file) -> new Project, read alignment and sequences
34 from fasta file
36 """
50 """ The number of sequences in alignment (it's thickness).
51 """
55 """ Calculate the identity of alignment positions for colouring.
57 For every (row, column) in alignment the percentage of the exactly
58 same residue in the same column in the alignment is calculated.
59 The data structure is just like the Project.alignment, but istead of
60 monomers it contains float percentages.
61 """
62 # Oh, God, that's awful! Absolutely not understandable.
63 # First, calculate percentages of amino acids in every column
79 # Second, map these percentages onto the alignment
93 @staticmethod
95 """
96 >>> import project
97 >>> sequences,alignment=project.Project.from_fasta(open("test.fasta"))
98 """
137 @staticmethod
139 """
140 Constructs new alignment from sequences
141 Add gaps to right end to make equal lengthes of alignment sequences
142 """