Skip to content

Instantly share code, notes, and snippets.

@taisukeoe
Last active August 29, 2015 14:10
Show Gist options
  • Save taisukeoe/d63cd82c2d7a5f8a1cd6 to your computer and use it in GitHub Desktop.
Save taisukeoe/d63cd82c2d7a5f8a1cd6 to your computer and use it in GitHub Desktop.
for rosalind
package hemplant.rosalind.dna
sealed abstract trait Nucleotide{
def complementary:Nucleotide = Nucleotide.complementary(this)
}
case object A extends Nucleotide
case object T extends Nucleotide
case object G extends Nucleotide
case object C extends Nucleotide
object Nucleotide{
def apply:Char => Nucleotide = {
case 'A' => A
case 'T' => T
case 'G' => G
case 'C' => C
}
def complementary:Nucleotide => Nucleotide = {
case A => T
case G => C
case C => G
case T => A
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment