The reverse complement of a DNA sequence signifies the contents of the opposite strand in a DNA molecule. DNA molecules are constructed as such because each nucleotide has a complementary nucleotide on the other strand to which a non-covalent bond exists.

Method 1
Method 1 of 2:

By Hand

  1. As you pass over each nucleotide, add its complementary nucleotide to the next line, beginning the complemented string from the left-hand side of the page. Remember, guanine (G) bonds to cytosine (C) and adenine (A) bonds to thymine (T).
    Advertisement
Method 2
Method 2 of 2:

Programmatically (Python 2)

  1. This article assumes that the input is in FASTA format, with a single sequence per file. The following steps also assume that all nucleotides are ATGC bases.
  2. For FASTA format:
    • Discard the first line of the file.
    • Remove all remaining newlines and other trailing whitespace.
     def 
     init 
     ( 
     sequence 
     ): 
     with 
     open 
     ( 
     argv 
     [ 
     1 
     ]) 
     as 
     input 
     : 
     sequence 
     = 
     "" 
     . 
     join 
     ([ 
     line 
     . 
     strip 
     () 
     for 
     line 
     in 
     input 
     . 
     readlines 
     ()[ 
     1 
     :]]) 
     return 
     sequence 
    
  3.  complement 
     = 
     { 
     'A' 
     : 
     'T' 
     , 
     'C' 
     : 
     'G' 
     , 
     'G' 
     : 
     'C' 
     , 
     'T' 
     : 
     'A' 
     } 
    
  4. Reverse the resulting vector.
     def 
     reverse_complement 
     ( 
     seq 
     ): 
     bases 
     = 
     [ 
     complement 
     [ 
     base 
     ] 
     for 
     base 
     in 
     seq 
     ] 
     bases 
     = 
     reversed 
     ( 
     bases 
     ) 
     return 
     bases 
    
  5. =
     result 
     = 
     reverse_complement 
     ( 
     seq 
     ) 
     print 
     '' 
     . 
     join 
     ( 
     result 
     ) 
    
    Advertisement

Expert Q&A

Ask a Question

      Advertisement

      Tips

      • If you're calculating the reverse complement by hand, be sure to double check! It can be easy to miss a base pair or use the wrong complement, especially if you're reading a long sequence on paper.
      Advertisement

      References

      1. StackOverflow: Reverse complement of DNA strand using Python - Source of original programmatic solution that handles non-ATGC base pairs. Solution by Gabriel . Licensed under a CC-By-SA 3.0 license .

      About this article

      Thanks to all authors for creating a page that has been read 16,149 times.

      Did this article help you?

      Advertisement