Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv, exit
- import re
- if len(argv) < 2:
- print("mising command-line argument")
- exit(1)
- pattern1 = re.compile(r'AGAT')
- pattern2 = re.compile(r'AATG')
- pattern3 = re.compile(r'TATC')
- with open(argv[1], "r") as f:
- count = 0
- contents = f.read()
- print(contents)
- print(contents[0:4])
- i = 0
- j = i + 4
- while contents[i:j]: # will read contents until end of file
- span = contents[i:j]
- #while contents[i+4:j+4] == span:
- while contents[i+4:j+4] == contents[i:j]:
- count += 1
- print("span " + contents + "repeats " + str(count) + " times" )
- i += 4
- j += 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement