Пример #1
0
def checkCandidate(candidate, results, peptide):
    rna_complement = genome.transpose_rna(genome.reversecomplement(candidate))
    rna = genome.transpose_rna(candidate)
    if genome.encodeProtein(rna) == peptide:
        results.append(candidate)
    elif genome.encodeProtein(rna_complement) == peptide:
        results.append(candidate)
k = 10
d = 3

inFile = open('dataset_8_6.txt', 'r')
#inFile.readline()
text = inFile.readline().strip()
# k = int(inFile.readline().strip())
# d = int(inFile.readline().strip())
inFile.close()

i=0
results={}

while i <= len(text) - k:
    section = text[i:i + k]
    dict = set()
    generateMatches(section, dict, d)
    addMatchesToResults(results, dict)
    i += 1

for (k, v) in results.items():
    complement = genome.reversecomplement(k)
    if (complement in results) and (k < complement):
        results[k] += results[complement]
        results[complement] += v

highestFrequency = max(results.values())
for i in [k for k, v in results.items() if v == highestFrequency]:
    print i,