allpy
view lib/project.py @ 98:3d40d7b9a123
lib::project::muscle_align
project::save_fasta
sequence::operator==
fixes
test -- alignment done
author | boris <bnagaev@gmail.com> |
---|---|
date | Wed, 20 Oct 2010 23:33:29 +0400 |
parents | 7dd461d17f96 |
children | ffc102ed0249 |
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 """
17 """
18 Mandatory data:
19 * sequences -- list of Sequence objects. Sequences don't contain gaps
20 - see sequence.py module
21 * alignment -- dict
22 {<Sequence object>:[<Monomer object>,None,<Monomer object>]}
23 keys are the Sequence objects, values are the lists, which
24 contain monomers of those sequences or None for gaps in the
25 corresponding sequence of
26 alignment
28 """
30 """overloaded constructor
32 Project() -> new empty Project
33 Project(sequences, alignment) -> new Project with sequences and
34 alignment initialized from arguments
35 Project(fasta_file) -> new Project, read alignment and sequences
36 from fasta file
38 """
52 """ The number of sequences in alignment (it's thickness).
53 """
57 """ Calculate the identity of alignment positions for colouring.
59 For every (row, column) in alignment the percentage of the exactly
60 same residue in the same column in the alignment is calculated.
61 The data structure is just like the Project.alignment, but istead of
62 monomers it contains float percentages.
63 """
64 # Oh, God, that's awful! Absolutely not understandable.
65 # First, calculate percentages of amino acids in every column
81 # Second, map these percentages onto the alignment
95 @staticmethod
97 """
98 >>> import project
99 >>> sequences,alignment=project.Project.from_fasta(open("test.fasta"))
100 """
139 @staticmethod
141 """
142 Constructs new alignment from sequences
143 Add gaps to right end to make equal lengthes of alignment sequences
144 """
154 """
155 Saves alignment to given file
156 Splits long lines to substrings of length=long_line
157 To prevent this, set long_line=None
158 """
169 """
170 Simple align ths alignment using sequences (muscle)
171 uses old Monomers and Sequences objects
172 """