allpy
diff allpy/base.py @ 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 | 88631907f23d |
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)