Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/20636c0df58c
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:30:31 2012
Кодировка:

# HG changeset patch
# User Daniil Alexeyevsky
# Date 1292514981 -10800
# Node ID 20636c0df58c3f65bdde400ad5d09e31155dcc5f
# Parent 5d355141f37d324fa4b1cef2251ebcccac23b36c
Removed controversial methods of allpy.base.Alignment: length, height, identity

diff -r 5d355141f37d -r 20636c0df58c allpy/base.py
--- a/allpy/base.py Thu Dec 16 18:55:01 2010 +0300
+++ b/allpy/base.py Thu Dec 16 18:56:21 2010 +0300
@@ -306,55 +306,6 @@
columns.append(col)
return columns

- ## Unclean code follows
-
- def length(self):
- """Return width, ie length of each sequence with gaps."""
- return max([len(line) for line in self.body.values()])
-
- def height(self):
- """ The number of sequences in alignment (it's thickness). """
- return len(self.body)
-
- def identity(self):
- """ Calculate the identity of alignment positions for colouring.
-
- For every (row, column) in alignment the percentage of the exactly
- same residue in the same column in the alignment is calculated.
- The data structure is just like the Alignment.body, but istead of
- monomers it contains float percentages.
- """
- # Oh, God, that's awful! Absolutely not understandable.
- # First, calculate percentages of amino acids in every column
- contribution = 1.0 / len(self.sequences)
- all_columns = []
- for position in range(len(self)):
- column_percentage = {}
- for seq in self.body:
- if self.body[seq][position] is not None:
- aa = self.body[seq][position].code
- else:
- aa = None
- if aa in allpy.data.amino_acids:
- if aa in column_percentage.keys():
- column_percentage[aa] += contribution
- else:
- column_percentage[aa] = contribution
- all_columns.append(column_percentage)
- # Second, map these percentages onto the alignment
- self.identity_percentages = {}
- for seq in self.sequences:
- self.identity_percentages[seq] = []
- for seq in self.identity_percentages:
- line = self.identity_percentages[seq]
- for position in range(len(self)):
- if self.body[seq][position] is not None:
- aa = self.body[seq][position].code
- else:
- aa = None
- line.append(all_columns[position].get(aa))
- return self.identity_percentages
-
class Column(dict):
"""Column of alignment.

@@ -365,6 +316,8 @@
"""
pass

+ ## Unclean code follows
+
class Block(object):
""" Block of alignment