avatar Bite 259. Reverse complement

In the majority of organisms, the genetic code is encoded in a double helical DNA with each of both strands providing essentially the same information. This offers redundancy to naturally occurring mutations. The four "letters" of the DNA are called bases and are abbreviated with the letters A, C, G and T. In the double helical DNA, A pairs with T and G pairs with C (called complementary DNA) and both strands run in opposite directions (denoted at 5' and 3').

Because of these strict rules of base pairing, the lower strand can easily be deduced from the upper strand as illustrated below:

              5' -----------> 3'
Upper strand:    ACGTCCCAAATT
Lower Strand:    TGCTGGGTTTAA
              3' <----------- 5'

By convention, DNA is always written from 5' to 3'. Therefore to recreate the lower strand from the upper strand, the reverse complement has to be generated.

Therefore, for the above depicted sequence 5' ACGTCCCAAATT 3', the reverse complement is 5' AATTTGGGACGT 3'.

In this bite you will create functions that return the reverse, the complement and the reverse complement of a DNA sequence. Please complete the functions below according to their docstrings. You can use an online converter to check your input.

Login and get coding
go back Intermediate level
Bitecoin 3X

47 out of 49 users completed this Bite.
Will you be Pythonista #48 to crack this Bite?
Resolution time: ~56 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.25 on a 1-10 difficulty scale.
» Up for a challenge? 💪

We use Python 3.8