def search_matches(pattern, k, d):
	kmers = pattern_to_number.list_kmer(k)
	matches = []
	for kmer in kmers:
		if score_kmer(kmer, pattern, d) == 1:
	return matches	
Пример #2
def mutate_bases(word, m):
	"""returns every possible mutation of word with number of possible mutations m""" 
	legal_mutations =[]
	possibilities = pattern_to_number.list_kmer(len(word))
	for i in possibilities:
		if count_mismatches(i, word) <= m:
	return legal_mutations
Пример #3
def median_string(dna, k):
	Iterates through every possible kmer of length k and returns a kmer that minimizes d(pattern, dna).
	This is a faster version of the motif_finding problem.
	kmers = pattern_to_number.list_kmer(k)
	best_pattern = kmers[0]
	for kmer in kmers:
		if d(kmer, dna) < d(best_pattern, dna):
			best_pattern = kmer
	return best_pattern
Пример #4
def number_to_pattern(index, k):
	list_of_kmers = pattern_to_number.list_kmer(k)
	return list_of_kmers[index]