Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open("text.txt", "r")
- input = f.read()
- matrix = [[.22,.22,.22,.33],[.22,.22,.22,.33],[.33,.33,.11,.22],[.22,.33,.11,.33],[.11,.22,.22,.44]]
- probability = 0
- output = ""
- for i in range(0, len(input) -4):
- temp = 0
- for idx,val in enumerate(input[0:5]):
- if (val == 'A'):
- temp += matrix[idx][0]
- elif (val == 'C'):
- temp += matrix[idx][1]
- elif (val == 'G'):
- temp += matrix[idx][2]
- elif (val == 'T'):
- temp += matrix[idx][3]
- if (temp > probability):
- output = input[0:5]
- probability = temp
- input = input[1:]
- print(output)
Add Comment
Please, Sign In to add comment