allpy
view lib/project.py @ 91:c0689204093e
from_fasta with new monomer class and monomer_type
author | boris <bnagaev@gmail.com> |
---|---|
date | Wed, 20 Oct 2010 10:05:43 +0400 |
parents | ea3113da42ca |
children | 581c1f71c4ea |
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 """
16 """
17 Mandatory data:
18 * sequences -- list of Sequence objects. Sequences don't contain gaps
19 - see sequence.py module
20 * alignment -- dict
21 {<Sequence object>:[<Monomer object>,None,<Monomer object>]}
22 keys are the Sequence objects, values are the lists, which
23 contain monomers of those sequences or None for gaps in the
24 corresponding sequence of
25 alignment
27 """
29 """overloaded constructor
31 Project() -> new empty Project
32 Project(sequences, alignment) -> new Project with sequences and
33 alignment initialized from arguments
34 Project(fasta_file) -> new Project, read alignment and sequences
35 from fasta file
37 """
51 """ The number of sequences in alignment (it's thickness).
52 """
56 """ Calculate the identity of alignment positions for colouring.
58 For every (row, column) in alignment the percentage of the exactly
59 same residue in the same column in the alignment is calculated.
60 The data structure is just like the Project.alignment, but istead of
61 monomers it contains float percentages.
62 """
63 # Oh, God, that's awful! Absolutely not understandable.
64 # First, calculate percentages of amino acids in every column
80 # Second, map these percentages onto the alignment
94 @staticmethod
96 """
97 >>> import project
98 >>> sequences,alignment=project.Project.from_fasta(open("test.fasta"))
99 """