| Module | Bio::Alignment::GAP |
| In: |
lib/bio/alignment.rb
(CVS)
|
Bio::Alignment::GAP is a set of class methods for gap-related position translation.
position without gaps are translated into the position with gaps.
| seq: | sequence |
| pos: | position with gaps |
| gap_regexp: | regular expression to specify gaps |
# File lib/bio/alignment.rb, line 2168 def gapped_pos(seq, pos, gap_regexp) olen = seq.gsub(gap_regexp, '').length pos = olen if pos >= olen pos = olen + pos if pos < 0 i = 0 l = pos + 1 while l > 0 and i < seq.length x = seq[i, l].gsub(gap_regexp, '').length i += l l -= x end i -= 1 if i > 0 i end