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

# HG changeset patch
# User Daniil Alexeyevsky
# Date 1338370707 -14400
# Node ID 85166d4ce53a028146847de8a6791e6fe051caba
# Parent 56b6a55ce4632af56882c655e730ffb2c31eb46e
Removed Alignment.process() and the code that it used (see #99)

The code was documented to be removed in 1.4.1.

diff -r 56b6a55ce463 -r 85166d4ce53a allpy/base.py
--- a/allpy/base.py Wed May 30 13:38:41 2012 +0400
+++ b/allpy/base.py Wed May 30 13:38:27 2012 +0400
@@ -415,28 +415,6 @@
if sequence in column:
del column[sequence]

- def _merge(self, dst, new, merge):
- """Replace contents of `dst` with those of `new`.
-
- Replace contents of elements using function `merge(dst_el, new_le)`.
- """
- for el, new_el in zip(dst, new):
- merge(el, new_el)
- dst[len(dst):] = new[len(dst):]
- del dst[len(new):]
-
- def _replace_sequence_contents(self, new, copy_descriptions):
- """Replace contents of sequences with those of `new` alignment."""
- # XXX: we manually copy sequence contents here
- # XXX: we only copy, overlapping parts and link to the rest
- def merge_monomers(dst, new):
- dst.__class__ = new.__class__
- def merge_sequences(dst, new):
- if copy_descriptions:
- vars(dst).update(vars(new))
- self._merge(dst, new, merge_monomers)
- self._merge(self.sequences, new.sequences, merge_sequences)
-
def _replace_column_contents(self, new):
"""Replace column contents with those of `new` alignment.

@@ -458,41 +436,11 @@
for monomer, column in zip(monomers, non_gap_columns):
column[sequence] = monomer

- def _replace_contents(self, new, copy_descriptions, copy_contents):
- """Replace alignment contents with those of other alignment."""
- if copy_contents:
- self._replace_sequence_contents(new, copy_descriptions)
- self._replace_column_contents(new)
-
- def process(self, function, copy_descriptions=True, copy_contents=True):
- """Apply function to the alignment (or block); inject results back.
-
- - `function(block)` must return block with same line order.
- - if `copy_descriptions` is False, ignore new sequence names.
- - if `copy_contents` is False, don't copy sequence contents too.
-
- `function` (object) may have attributes `copy_descriptions` and
- `copy_contents`, which override the same named arguments.
- """
- deprecated(
- "aln.process() is deprecated and may cause damage to your"
- " alignment! It will be removed from 1.4.1 realease."
- " Use aln.realign() instead."
- )
- new = function(self)
- if hasattr(function, 'copy_descriptions'):
- copy_descriptions = function.copy_descriptions
- if hasattr(function, 'copy_contents'):
- copy_contents = function.copy_contents
- self._replace_contents(new, copy_descriptions, copy_contents)
-
def realign(self, function):
"""Realign self.

- I.e.: apply function to self to produce a new alignment, then update
- self to have the same gap patterns as the new alignment.
-
- This is the same as process(function, False, False)
+ * apply function to self to produce a new alignment,
+ * update self to have the same gap patterns as the new alignment.
"""
new = function(self)
self._replace_column_contents(new)