flower-0.2: src/Metrics.hs
-- Calculate various characteristics on sequence quality module Metrics where import Bio.Sequence.SFF -- import Test.QuickCheck -- | Take the fractional parts of the flows, and sum their squares (the "K²" metric) quals :: [Flow] -> Flow quals q = floor $ (100 - 2*(sqrt $ (/fromIntegral (length q)) $ sum $ map (fromIntegral . (^2) . (flip (-) 50) . (`mod` 100) . (+50)) $ q)) prop_quals :: [Flow] -> Bool prop_quals fs = let q = quals fs in q <= 100 && q >= 0