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

allpy

changeset 303:578bc81d5e62

Added explanation for algorithm to add gapped line to base Alignment
author Daniil Alexeyevsky <me.dendik@gmail.com>
date Thu, 16 Dec 2010 19:08:16 +0300
parents b92bfa04395e
children e5c8deea6f83
files allpy/base.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/allpy/base.py	Thu Dec 16 19:05:11 2010 +0300
     1.2 +++ b/allpy/base.py	Thu Dec 16 19:08:16 2010 +0300
     1.3 @@ -217,6 +217,13 @@
     1.4          not_gap = lambda (i, char): char != "-"
     1.5          no_gaps = line.replace("-", "")
     1.6          sequence = Sequence(no_gaps, name, description, source)
     1.7 +        # The following line has some simple magic:
     1.8 +        # 1. attach natural numbers to monomers
     1.9 +        # 2. delete gaps
    1.10 +        # 3. attach numbers again
    1.11 +        # This way we have a pair of numbers attached to monomer:
    1.12 +        # - it's position in alignment (the first attached number, j)
    1.13 +        # - it's position in sequence (the second attached number, i)
    1.14          for i, (j, char) in enumerate(filter(not_gap, enumerate(line))):
    1.15              self.column_at(j)[seq] = sequence[i]
    1.16          self.sequences.append(sequence)