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 file:
- contents = file.read()
- i = 0
- j = 4
- while contents[i:j]:
- #this works.... save it... prints one string of 4 per line
- print(contents[i:j])
- i += 4
- j += 4
- while contents[i:j]:
- if contents[i:j] == contents[i+4:j+4]:
- index = 1
- count = 1
- while contents[i:j] == contents[i+4*index:j+4*index]:
- i += 1
- j += 1
- count += 1
- index += 1
- print(str(contents[i:j]) + " count is: " + count)
- matchcount = 0
- i = 0
- j = 4
- while contents[i:j]:
- pattern = contents[i:j] #pattern = re.compile(pattern?)
- if pattern == contents[i+4:j+4]:
- matches = pattern.finditer(f'{contents}') # no longer commented out
- for match in matches:
- mcount += 1
- j += 1
Advertisement
Add Comment
Please, Sign In to add comment