-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastaStat.hs
31 lines (25 loc) · 867 Bytes
/
fastaStat.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Main
where
import Bio.Sequence
import System
import Control.Monad (forM,liftM)
import Data.Array.Vector
import Statistics.Quantile
import Statistics.Function
-- seq2len :: Sequence a -> IO Double
seq2DoubleLen :: Sequence Unknown -> Double
seq2DoubleLen x = (fromIntegral (seqlength x)) :: Double
quartile n x = (continuousBy s n 4 x)
stat :: UArr Double -> (Double,Double,Double,Double,Double)
stat x = let mm = minMax x
in ((fstS mm),(quartile 1 x),(quartile 2 x),(quartile 3 x),(sndS mm))
main = do
[inputFile] <- getArgs
seqs <- (readFasta inputFile)
let lens = map seq2DoubleLen seqs
let (min,n25,n50,n75,max) = stat (toU lens)
putStrLn $ "min = " ++ (show min) ++
"\tN25 = " ++ (show n25) ++
"\tN50 = " ++ (show n50) ++
"\tN75 = " ++ (show n75) ++
"\tmax = " ++ (show max)