Skip to content

Instantly share code, notes, and snippets.

@natdempk
Created October 31, 2019 23:51
Show Gist options
  • Save natdempk/8010443b8cd82bf44ac5f3af0d313904 to your computer and use it in GitHub Desktop.
Save natdempk/8010443b8cd82bf44ac5f3af0d313904 to your computer and use it in GitHub Desktop.
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