Method: String#compare_with
- Defined in:
- lib/viral_seq/string.rb
#compare_with(seq2) ⇒ Integer
compare two sequences as String objects, two sequence strings need to aligned first
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/viral_seq/string.rb', line 108 def compare_with(seq2) seq1 = self length = seq1.size diff = 0 (0..(length-1)).each do |position| nt1 = seq1[position] nt2 = seq2[position] diff += 1 unless nt1 == nt2 end return diff end |