Reverse complement

The reverse complement of a DNA string is formed by reversing the string and taking the complement of each symbol.

We must reverse the string in addition to taking complements because of the directionality of DNA: DNA replication and transcription occurs from the 3' end to the 5' end, and the 3' end of one strand is opposite from the 5' end of the complementary strand. Thus, if we were to simply take complements, then we would be reading the second strand in the wrong direction.

Reverse Complement