-- | Simple wrapper around the fold function. -- -- TODO same TODOs as for RNAEval module Main where import Control.Monad import Control.Monad.ST import Text.Printf import Biobase.RNA import Biobase.Structure.DotBracket import Biobase.Vienna.Default import Biobase.Vienna.Modification.NonStandard import BioInf.RNAFold.EnergyInt import Data.PrimitiveArray {- This is needed for debugging import Data.List.Split printArr a = g a where (_,n) = snd $ bounds a f x | x > 999 = " x" | x < -999 = "-999" | otherwise = printf "%4d" x g t = mapM_ (\xs -> mapM_ putStr xs >> putStrLn"") $ splitEvery (n+1) $ map f $ toList t -} -- | given a sequence, fold it and print all results. doFold trnr cnt = do let inp = mkPrimary cnt let tbls@(weak,strong,m,m1,external) = fold trnr inp let bts = backtrack trnr inp tbls 0 -- print $ external ! (0,length cnt -1) {- print "strong" printArr strong print "external" printArr external -} putStrLn cnt if null bts then putStrLn $ replicate (length cnt) '.' ++ " ( 0.00)" else mapM_ (\(s,e) -> printf "%s (%6.2f)\n" (dotbracket s) (fromIntegral e / 100 :: Double)) bts return () main = do let trnr = nonStandardMax . fst $ turner2004GH -- default energy tables cnts <- liftM lines $ getContents mapM_ (doFold trnr) cnts