module Bio.RNAdistanceParser (
parseRNAdistance,
readRNAdistance,
module Bio.RNAdistanceData
) where
import Bio.RNAdistanceData
import Bio.ViennaRNAParserLibrary
import Text.ParserCombinators.Parsec
genParserRNAdistance :: GenParser Char st RNAdistance
genParserRNAdistance = do
string ("f: ")
distance <- many1 (noneOf " ")
optional (many1 space)
eof
return $ RNAdistance (readInt distance)
parseRNAdistance :: [Char] -> Either ParseError RNAdistance
parseRNAdistance input = parse genParserRNAdistance "genParseRNAdistance" input
readRNAdistance :: String -> IO (Either ParseError RNAdistance)
readRNAdistance filePath = parseFromFile genParserRNAdistance filePath