+ # str.patmatch(pattern[, start|[start, stop][, max_mis[, max_ins[, max_del]]]])
+ # -> Match
+ # str.patmatch(pattern[, start|[start, stop][, max_mis[, max_ins[, max_del]]]]) { |match|
+ # block
+ # }
+ # -> Match
+ #
+ # ------------------------------------------------------------------------------
+ # Method to iterate through a sequence from a given start position to the end of
+ # the sequence or to a given stop position to locate a pattern allowing for a
+ # maximum number of mismatches, insertions, and deletions. Insertions are
+ # nucleotides found in the pattern but not in the sequence. Deletions are
+ # nucleotides found in the sequence but not in the pattern.
+ def patmatch(pattern, start = 0, max_mismatches = 0, max_insertions = 0, max_deletions = 0)
+ self.patscan(pattern, start, max_mismatches, max_insertions, max_deletions) do |m|
+ if block_given?
+ yield m
+ else
+ return m
+ end
+
+ break
+ end
+
+ if block_given?
+ yield nil
+ else
+ return nil
+ end
+ end
+
+ # ------------------------------------------------------------------------------
+ # str.patscan(pattern[, start|[start, stop][, max_mis[, max_ins[, max_del]]]])