Method: Bio::Alignment::EnumerableExtension#convert_unmatch
- Defined in:
- lib/bio/alignment.rb
#convert_unmatch(match_char = '.') ⇒ Object
This is the BioPerl’s AlignI::unmatch like method.
Changes second to last sequences’ sites match_char(default: ‘.’) to original sites’ characters.
Note that it is a destructive method.
For Hash, please use it carefully because the order of the sequences is inconstant.
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 |
# File 'lib/bio/alignment.rb', line 690 def convert_unmatch(match_char = '.') #(BioPerl) AlignI::unmatch like method len = alignment_length firstseq = nil each_seq do |s| unless firstseq then firstseq = s else (0...len).each do |i| if s[i..i] == match_char then s[i..i] = (firstseq[i..i] or match_char) end end end end self end |