Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sdouglas
Created July 26, 2011 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdouglas/1107043 to your computer and use it in GitHub Desktop.
Save sdouglas/1107043 to your computer and use it in GitHub Desktop.
DNA reverse complement
import string
complement = string.maketrans('ACGTacgt','TGCATGCA')
def rcomp(s):
"""Returns the reverse complement of the sequence in s."""
return s.translate(complement)[::-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment