Created
November 1, 2019 00:06
-
-
Save natdempk/31fc44cb3c195cf015113f2bb859be5f to your computer and use it in GitHub Desktop.
This file contains 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
import sequtils | |
from strutils import join | |
proc toRna*(dna: string): string = | |
result = toSeq(dna) | |
.map(c => ( | |
case c: | |
of 'A': | |
return "U" | |
of 'T': | |
return "A" | |
of 'C': | |
return "G" | |
of 'G': | |
return "C" | |
else: | |
raise newException(ValueError, "invalid DNA character detected") | |
)).join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment