Created
January 2, 2015 16:57
-
-
Save amonshiz/0b5bbdbef61bc9072d73 to your computer and use it in GitHub Desktop.
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
module Bioinformatics.DNANucleotide ( | |
DNANucleotide (..), | |
charToDNANucleotide | |
) where | |
import Data.Char | |
import Data.List | |
data DNANucleotide = A | C | G | T deriving(Show, Eq, Ord, Read) | |
charToDNANucleotide :: Char -> DNANucleotide | |
charToDNANucleotide c = read [toUpper c] :: DNANucleotide |
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
module Bioinformatics.RNANucleotide ( | |
RNANucleotide (..), | |
charToRNANucleotide | |
) where | |
import Data.Char | |
import Data.List | |
data RNANucleotide = A | C | G | U deriving (Show, Eq, Ord, Read) | |
charToRNANucleotide :: Char -> RNANucleotide | |
charToRNANucleotide c = read [toUpper c] :: RNANucleotide |
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
import Bioinformatics.DNANucleotide as D | |
import Bioinformatics.RNANucleotide as R | |
dnaToRNA :: D.DNANucleotide -> R.RNANucleotide | |
dnaToRNA d | |
| d == D.A = R.A | |
| d == D.C = R.C | |
| d == D.G = R.G | |
| otherwise = R.U | |
mainDNAToRNA = do | |
dna <- getLine | |
putStrLn $ concat . map show . map dnaToRNA $ map D.charToDNANucleotide dna |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment