def approx_pat_posi(pattern, text, d): posilist = [] lenp = len(pattern) lent = len(text) d = int(d) for i in xrange(lent - lenp + 1): if hamming_dist(text[i:i + lenp], pattern) <= d: posilist.append(str(i)) return ' '.join(posilist)
def maxfreq_mm(seq, k, d): k = int(k) d = int(d) seql = len(seq) freq_dict = defaultdict(int) for kmer in permutdna(k): for i in xrange(seql - k + 1): if hamming_dist(kmer, seq[i:i + k]) <= d: freq_dict[kmer] += 1 maxfreq = max(freq_dict.values()) for kmer in freq_dict: if freq_dict[kmer] == maxfreq: print kmer,