Created
April 6, 2018 16:42
-
-
Save kgori/eaaa02e8c31fd4fb216d736a0c4be7b1 to your computer and use it in GitHub Desktop.
DNA reverse complement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def revcomp(s): | |
complements = dict( | |
A='T', C='G', G='C', T='A', | |
M='K', R='Y', W='W', S='S', | |
Y='R', K='M', V='B', H='D', | |
D='H', B='V', N='N' | |
) | |
return ''.join(complements[char] for char in s.upper()[::-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment