allpy
view lib/project.py @ 119:d67140e313f4
lib:: graph fix some bugs
1. bug occured when line from some node to itself presents
2. control of input lines added (concerned with 1.)
3. drop_if_count
4. fast_cliques: 2 fixes and one forgotten test (caused fail)
author | boris <bnagaev@gmail.com> |
---|---|
date | Sat, 23 Oct 2010 21:32:52 +0400 |
parents | 62e38970ffa2 |
children | 0b366ce3257f |
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 """
20 """
21 Mandatory data:
22 * sequences -- list of Sequence objects. Sequences don't contain gaps
23 - see sequence.py module
24 * alignment -- dict
25 {<Sequence object>:[<Monomer object>,None,<Monomer object>]}
26 keys are the Sequence objects, values are the lists, which
27 contain monomers of those sequences or None for gaps in the
28 corresponding sequence of
29 alignment
31 """
33 """overloaded constructor
35 Project() -> new empty Project
36 Project(sequences, alignment) -> new Project with sequences and
37 alignment initialized from arguments
38 Project(fasta_file) -> new Project, read alignment and sequences
39 from fasta file
41 """
55 """ The number of sequences in alignment (it's thickness).
56 """
60 """ Calculate the identity of alignment positions for colouring.
62 For every (row, column) in alignment the percentage of the exactly
63 same residue in the same column in the alignment is calculated.
64 The data structure is just like the Project.alignment, but istead of
65 monomers it contains float percentages.
66 """
67 # Oh, God, that's awful! Absolutely not understandable.
68 # First, calculate percentages of amino acids in every column
84 # Second, map these percentages onto the alignment
98 @staticmethod
100 """
101 >>> import project
102 >>> sequences,alignment=project.Project.from_fasta(open("test.fasta"))
103 """
142 @staticmethod
144 """
145 Constructs new alignment from sequences
146 Add gaps to right end to make equal lengthes of alignment sequences
147 """
157 """
158 Saves alignment to given file
159 Splits long lines to substrings of length=long_line
160 To prevent this, set long_line=None
161 """
165 """
166 Simple align ths alignment using sequences (muscle)
167 uses old Monomers and Sequences objects
168 """
193 """
194 returns list of columns of alignment
195 sequence or sequences:
196 if sequence is given, then column is (original_monomer, monomer)
197 if sequences is given, then column is dict (original_monomer, {sequence: monomer})
198 if both of them are given, it is an error
199 original (Sequence type):
200 if given, this filters only columns represented by original sequence
201 """