Module 8
Complement
Finding the complementary base for each position.
Base pairing
In DNA, A pairs with T, and G pairs with C. The complement of a sequence replaces each base with its pair.
Python
seq = "ATGC"
complement = seq.replace("A", "t").replace("T", "A").replace("t", "T")
complement = complement.replace("G", "c").replace("C", "G").replace("c", "C")
print(complement)→ TACG
Your task
Compute complement
- Compute the complement of ATGC using replace.