def similarity(self, self_start, self_end, other_start, other_end, other):
    """
      Compute the number of matching bases in the subsequences self[start, end]
      and other[o_start, o_end]. Note that the subsequences must be the same
      length.

      :param self_start:  start index for sub-sequence in self
      :param self_end:    end index for sub-sequence in self
      :param other_start: start index for subsequence in other sequence
      :param other_end:   end index for subsequence in other sequence
      :param other:       other sequence to compare to this.
    """
    assert(self_end - self_start == other_end - other_start)
    count = 0
    for i in range(0, self_end - self_start + 1):
      if (self.sequenceData[self_start + i] ==
         other.sequenceData[other_start + i]):
        count += 1
    return count