Skip to main content
. 2010 Oct 26;11(Suppl 8):S1. doi: 10.1186/1471-2105-11-S8-S1

Algorithm 3.

Algorithm 3 Stem generation (independent of the alphabet size |Σ|)

Input: pair of k-mers a, b
Output: set of stems (patterns with wildcards) shared by a and b
if if d(a, b) ≤ mthen
  Set stem = a
  Set i = 0 … d positions in the mismatch region of the stem as in b
  Place j1 = 0 … di wildcards inside the mismatch region
  Place j2 = 0 … m − max(di, j1 + i) wildcards outside the mismatch region
end if
ifd(a, b) >mthen
  Set stem = a
  Fix i = dmm positions in the mismatch region of the current stem as in b
  Place j = 0 … mi wild-cards in the remaining di positions in the mismatch region
end if
 Output resulting stems (patterns with wildcards)