Created
March 1, 2015 18:29
-
-
Save amonshiz/b577a7987cc55f9c0947 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
import qualified Bioinformatics.Protein as P | |
import qualified Bioinformatics.RNANucleotide as R | |
import qualified Data.Map as M | |
codonRNATable = M.fromListWith (++) . map (\(k,v) -> (v, [k])) $ M.toList P.rnaCodonTable | |
codonLookup :: P.AminoAcid -> [R.RNAString] | |
codonLookup = maybe [] id . (flip M.lookup codonRNATable) | |
codonMappings :: [P.AminoAcid] -> [[R.RNAString]] | |
codonMappings cs = [codonLookup P.Stop] ++ map codonLookup cs | |
rnaCombinations :: [P.AminoAcid] -> Int | |
rnaCombinations = foldl (\acc rs -> acc * length rs `mod` 1000000) 1 . codonMappings | |
main = do | |
aaChars <- getLine | |
putStrLn . show . rnaCombinations $ map P.charToAminoAcid aaChars |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment