Created
December 23, 2015 01:00
-
-
Save anonymous/5138c61c41fb985c7837 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
sequence = 'TAAAGACTGCCGAGAGGCCAACACGAGTGCTAGAACGAGGGGCGTAAACGCGGGTCCGAT' | |
def skew(sequence): | |
c = 0 | |
g = 0 | |
min_skew = 0 | |
skew_list = [] | |
index = 0 | |
for i in sequence: | |
index += 1 | |
if i == 'C': | |
c += 1 | |
if i == 'G': | |
g += 1 | |
skew = g-c | |
if skew < min_skew: | |
skew_list = [index] | |
min_skew = skew | |
if skew == min_skew and index not in skew_list: | |
skew_list.append(index) | |
print(skew_list) | |
#with open('data.txt', 'r') as in_file: | |
#sequence = in_file.readline() | |
#skew(sequence) | |
skew(sequence) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment