Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Created March 13, 2015 02:18
Show Gist options
  • Save amonshiz/da2e34e9c4618d99aecd to your computer and use it in GitHub Desktop.
Save amonshiz/da2e34e9c4618d99aecd to your computer and use it in GitHub Desktop.
import qualified Bioinformatics.Protein as P
import qualified Data.Map as M
import Control.Applicative
calculateProteinMass :: String -> Maybe Double
calculateProteinMass aas = sum <$> (sequence $ map (flip M.lookup P.monoisotopicMasses . P.charToAminoAcid) aas)
main = do
aas <- getLine
-- putStrLn . show . calculateProteinMass $ map P.charToAminoAcid aas
putStrLn . show $ calculateProteinMass aas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment