-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrosalind_reverse_complement.py
14 lines (10 loc) · 1.19 KB
/
rosalind_reverse_complement.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def reverseComplement(sequence):
seq= sequence
seq_backward = seq[::-1]
base_partners = {"A":"T", "C":"G", "G":"C", "T":"A"}
seq_converted = ""
for char in seq_backward: #Loop through and look up the complement to create the new sequence
seq_converted += base_partners[char]
return seq_converted
seq = 'CGCTGCAGAACGTAACGCGTTCGTCTATTCACAGTTGATTTTCATTAGATCGCGCTAAGCTGTTTTCCAACACATCGGTAATGCTCACAGGTAATCATGATCCGTCGGGTGGAACATCCTGACTTTTTAAGGGATGCAGTGGCTCTGTCGTATCAACTTACGTTTTATCTAACTTCCATGTTTTTGACATCCCAAAGGGGGCTCGCTGCCTCGCAATGTACCATCTGGATACGTCGAAAGTACAATAAGATTATAGAAGCGCTTTTATGACCACTCGGAAAGAGAGCACGATGGGCCCGAGCTCGGAGTCGAGGTATCTGGGGGAAGTTGACTACCCAGGGACGCATCGCAGGAGACTTCGATCTTCGGGTTACTCTAAGCTGATAACACCGGGGTCCGTACTCACTTACTACGTCCGCTGCGTCGCGCAGCGCTAGGAAGAGCTCTTCAGGTTTCGGGGTGGGACGATATCGCCACTCTTGTGATCCCGTATGTAATATGAAAAGGTGACCTGACGGGCGGGTGACCTTTCACAATGCCACAAGACACGCTTTATCTAACCTCAATAGTGACAGCAGAGCGCCAAGAACGAACCCGGAAGGCTCGGCTACTAGGAATCGCAGGTCGTCTGAGGCTTATCCCAGGTGTCTGGCCATAGCGGGTCAAGGATACTAAGAAATGTATCCCGTATTCTCCCATTATAAGCGGCACCTATTTGTCAGGGTAAGCGTATTTTTTCCTCGGAGGTGGGAGGCTAAATTAGATTGACCTGTTGTGTGTCTACTTATTAACAGCTAAACATGGGGTGCTGGCATTTCTCTAACGACCACAGATT'
print reverseComplement(seq)