Skip to content

Instantly share code, notes, and snippets.

@asvnpr
Last active February 1, 2017 04:21
Show Gist options
  • Save asvnpr/32fa84b0e8d8547273b823dbb9c97384 to your computer and use it in GitHub Desktop.
Save asvnpr/32fa84b0e8d8547273b823dbb9c97384 to your computer and use it in GitHub Desktop.
reverse DNA compliment. no condition checking nor extra variables
#! /usr/bin/env python3
#from http://rosalind.info/problems/revc/
s = open("Downloads/rosalind_revc.txt", "r").read()
#added new line to dic since it's present in downloaded datasets
comp = {'A':'T', 'T':'A', 'C':'G', 'G':'C', '\n':''}
for c in s[::-1]:
print(comp[c], end='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment