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

allpy

changeset 444:36095a51e4c0

Tested and fixed Block.process(*, False, False) In this ivokation process only copies gap patterns, not sequence names. It is equivalent to calling Block._replace_column_contents. Previously this function assumed self is Alignment and that each monomer in self.sequences is visible in columns. This is false for Blocks.
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Tue, 15 Feb 2011 22:45:34 +0300
parents 63ea2a072f8d
children d8c507743f12
files allpy/base.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/allpy/base.py	Tue Feb 15 22:32:14 2011 +0300
     1.2 +++ b/allpy/base.py	Tue Feb 15 22:45:34 2011 +0300
     1.3 @@ -322,10 +322,10 @@
     1.4              if column == {}:
     1.5                  self.columns[n:n+1] = []
     1.6  
     1.7 -    def _wipe(self):
     1.8 -        """Make all positions gaps (but keep sequences intact)."""
     1.9 +    def _wipe_row(self, sequence):
    1.10 +        """Turn all row positions into gaps (but keep sequences intact)."""
    1.11          for column in self.columns:
    1.12 -            for sequence in list(column):
    1.13 +            if sequence in column:
    1.14                  del column[sequence]
    1.15  
    1.16      def _merge(self, dst, new, merge):
    1.17 @@ -353,19 +353,22 @@
    1.18      def _replace_column_contents(self, new):
    1.19          """Replace column contents with those of `new` alignment.
    1.20  
    1.21 -        Synonym: copy gap patterns from `new` to `self`.
    1.22 +        In other words: copy gap patterns from `new` to `self`.
    1.23  
    1.24          `self.sequences` and `new.sequences` should have the same contents.
    1.25          """
    1.26 -        self._wipe()
    1.27 -        not_gap = lambda (a,b): a != None
    1.28 -        for sequence, new_row in zip(self.sequences, new.rows_as_lists()):
    1.29 -            assert len(sequence) == len(filter(None, new_row.sequence))
    1.30 +        for row, new_row in zip(self.rows_as_lists(), new.rows_as_lists()):
    1.31 +            sequence = row.sequence
    1.32 +            monomers = filter(None, row)
    1.33 +            print monomers
    1.34 +            print filter(None, new_row)
    1.35 +            assert len(monomers) == len(filter(None, new_row))
    1.36 +            self._wipe_row(sequence)
    1.37              non_gap_columns = [column
    1.38                  for column, monomer in zip(self.columns, new_row)
    1.39                  if monomer
    1.40              ]
    1.41 -            for monomer, column in zip(sequence, non_gap_columns):
    1.42 +            for monomer, column in zip(monomers, non_gap_columns):
    1.43                  column[sequence] = monomer
    1.44  
    1.45      def _replace_contents(self, new, copy_descriptions, copy_contents):