Method: BioDSL::Assemble#match

Defined in:
lib/BioDSL/seq/assemble.rb

#matchObject

Method to locate overlapping matches between two sequences.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/BioDSL/seq/assemble.rb', line 82

def match
  calc_overlap
  diff = calc_diff

  @offset1 = @entry1.length - @overlap - diff

  while @overlap >= @options[:overlap_min]
    mismatches_max = (@overlap * @options[:mismatches_max] * 0.01).round

    if (mismatches = match_C(@entry1.seq, @entry2.seq, @offset1, @offset2,
                             @overlap, mismatches_max)) && mismatches >= 0
      entry_merged          = entry_left + entry_overlap + entry_right
      entry_merged.seq_name = @entry1.seq_name +
        ":overlap=#{@overlap}:hamming=#{mismatches}" if @entry1.seq_name

      return entry_merged
    end

    diff > 0 ? diff -= 1 : @overlap -= 1

    @offset1 += 1
  end
end