-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathreverse-complement.py
executable file
·17 lines (15 loc) · 1.18 KB
/
reverse-complement.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def reverse_complement(s):
result = ""
for c in s:
result = complement(c) + result
return result
def complement(c):
if (c == 'A'):
return 'T'
if (c == 'T'):
return 'A'
if (c == 'G'):
return 'C'
if (c == 'C'):
return 'G'
print reverse_complement("TAGAGTGTTCGGTGGACCTTCCGTCAGGAAACCCTGCTTAGGGGACGTACGCTCGCGTACTCCCGAAAGGTCGGCGAAAAGGCAACACCTACTCGATTGCCACATCCACGGCACCACACCATGTCCGACAGGAGGAACCAGCATTCGGGATCTACTACTGGAGCACCAGCTCCCTCGTACCCAGCGACAGCTGAGCATGGTTACGGACCCCAGTCTGCATCCTGCGATATGCGAGAGATATAGTGACTATAGAACTGGCGTATATCGGCAGAACACCCCCAGACGGAAATAGATGTTTGCGTCTGGAGTGTACGGCGTCAATCCCTCGCTTGATAATATCGCCGGGAAAAATGGATGGGACTATATCTCATCCACGAACAGGTTACGGCAACATCCGACATCGGGATAACTAACGCTTGACTGCACGCCCAACAAGACGCCAAAGTAGAGCTGCACTAGCTCCGGCGACCAATCAGAGTCGACCAAGCCCCATCTCTGGACGCGTGTGATGTACAATGGAGTTAATGAGACTCGTTCGCTGAAAAAGGCACGCACAATGGACATATATCCCCAGCCAGGGGTGTATTTTCTGCGTACCATAGACGTAGGTGATTTGACTTGGCACATCCCACCTGAAAATTAATAGATTTCAGCTTTTATCCTGCATAGTAACGCGTTCTGCGTGATACTTTCTTGTATCCCCCCGCGAAAAGCCCCTTCTCAACCATCACGTATACCGGGGAACGCATGACTAGTCCCCTGGTGAGAGGGTATTCTAACTACTAGTTTTGTCGTTATAAGCAGTAGTGGATGCCGGACTAGGCAGGACTTTTGAATATATAAGCGAAAAGATGAGATGCAATTCATTATTCTATCATGTGCCGACCACGTT")