Created
October 6, 2023 18:41
-
-
Save daviddamilola/1d83f73a4d74d2a8d3168abc2d7bc6b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def indexOfPatternMatch (pattern, genome): | |
indexes = [] | |
patternLength = len(pattern) | |
for (index, _) in enumerate(genome): | |
if genome[index:(patternLength+index)] == pattern: | |
indexes.append(index) | |
return " ".join(str(item) for item in indexes) | |
def loadGenome(path, pattern): | |
file = open(path, 'r') | |
genome = "".join(file.readlines()) | |
return indexOfPatternMatch(pattern ,genome) | |
print(loadGenome('./Downloads/Vibrio_cholerae.txt', 'CTTGATCAT')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment