Skip to content

Commit

Permalink
Change print Code of countUniqSeqs
Browse files Browse the repository at this point in the history
  • Loading branch information
lvaruzza committed Mar 2, 2010
1 parent de2a2dc commit 51cba39
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions countUniqSeqs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ countSeqs handle = do

doCountSeq :: Handle -> Handle -> IO ()
doCountSeq input output = do
counts <- execStateT (countSeqs input) M.empty
putStrLn "Counting"
counts <- execStateT (countSeqs input) M.empty

let lst = sortBy (applySnd2 compare) (M.toList counts)
putStrLn "Sorting"

hPutStr output $ foldl printEntry "" lst
where
printEntry buff (k, a) = buff ++ k ++ "\t" ++
(show a) ++ "\n"
let lst = sortBy (applySnd2 compare) (M.toList counts)

putStrLn "Printing"

forM_ lst $ \(k,a) -> do
hPutStr output $ k ++ "\t" ++ (show a) ++ "\n"

main = doFilter doCountSeq

0 comments on commit 51cba39

Please sign in to comment.