BiobaseInfernal 0.5.3.1 → 0.5.4.0
raw patch · 5 files changed
+40/−26 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Biobase.Infernal: vhAnnotation :: VerboseHit -> [ByteString]
+ Biobase.Infernal.VerboseHit: vhAnnotation :: VerboseHit -> [ByteString]
+ Biobase.Infernal.VerboseHit.Internal: aliAnnotation :: AliGo -> [ByteString]
- Biobase.Infernal: VerboseHit :: (Int, Int) -> (Int, Int) -> ByteString -> Strand -> Double -> Double -> Double -> Int -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> VerboseHit
+ Biobase.Infernal: VerboseHit :: (Int, Int) -> (Int, Int) -> ByteString -> Strand -> Double -> Double -> Double -> Int -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> [ByteString] -> VerboseHit
- Biobase.Infernal.VerboseHit: VerboseHit :: (Int, Int) -> (Int, Int) -> ByteString -> Strand -> Double -> Double -> Double -> Int -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> VerboseHit
+ Biobase.Infernal.VerboseHit: VerboseHit :: (Int, Int) -> (Int, Int) -> ByteString -> Strand -> Double -> Double -> Double -> Int -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> [ByteString] -> VerboseHit
- Biobase.Infernal.VerboseHit.Internal: AliGo :: ByteString -> ByteString -> Char -> AliGo
+ Biobase.Infernal.VerboseHit.Internal: AliGo :: ByteString -> ByteString -> Char -> [ByteString] -> AliGo
Files
- Biobase/Infernal/VerboseHit.hs +11/−8
- Biobase/Infernal/VerboseHit/Export.hs +6/−4
- Biobase/Infernal/VerboseHit/Import.hs +12/−10
- Biobase/Infernal/VerboseHit/Internal.hs +4/−3
- BiobaseInfernal.cabal +7/−1
Biobase/Infernal/VerboseHit.hs view
@@ -1,10 +1,12 @@ {-# LANGUAGE RecordWildCards #-} --- | Provides a datatype for cmsearch verbose output.+-- | Provides a datatype for cmsearch verbose output. The Import/Export system+-- now allows for primitive annotations using "##" as the first two characters.+-- Annotations are only accepted for individual hits. module Biobase.Infernal.VerboseHit where -import qualified Data.ByteString.Char8 as BS+import Data.ByteString.Char8 as BS import Text.Printf @@ -14,17 +16,18 @@ data VerboseHit = VerboseHit { vhTarget :: (Int,Int) -- ^ part of target sequence (start counting at 1) , vhQuery :: (Int,Int) -- ^ which part of the CM/stk do we align to- , vhCM :: BS.ByteString -- ^ the CM for this alignment+ , vhCM :: ByteString -- ^ the CM for this alignment , vhStrand :: Strand -- ^ should be either '+' or '-' , vhScore :: Double -- ^ bit score , vhEvalue :: Double -- ^ number of hits we expect to find with 'score' or higher for 'targetSequence' length , vhPvalue :: Double -- ^ ? , vhGC :: Int -- ^ ?- , vhScaffold :: BS.ByteString -- ^ scaffold, chromosome, ... (the name of the sequence, not the sequence data!)- , vhWuss :: BS.ByteString -- ^ fancy secondary structure annotation using wuss notation- , vhConsensus :: BS.ByteString -- ^ query consensus (upper: highly, lower: weak/no)- , vhScoring :: BS.ByteString -- ^ represents where positive and negative scores come from- , vhSequence :: BS.ByteString -- ^ the target sequence which aligns to the model+ , vhScaffold :: ByteString -- ^ scaffold, chromosome, ... (the name of the sequence, not the sequence data!)+ , vhWuss :: ByteString -- ^ fancy secondary structure annotation using wuss notation+ , vhConsensus :: ByteString -- ^ query consensus (upper: highly, lower: weak/no)+ , vhScoring :: ByteString -- ^ represents where positive and negative scores come from+ , vhSequence :: ByteString -- ^ the target sequence which aligns to the model+ , vhAnnotation :: [ByteString] -- ^ any annotations that could be associated (# lines) } deriving (Show,Read) type Strand = Char
Biobase/Infernal/VerboseHit/Export.hs view
@@ -27,7 +27,7 @@ -- TOOD How to append the last line "//" to the finished stream, if at least -- one element was printed? -eneeByteString :: Monad m => Enumeratee [VerboseHit] BS.ByteString m a+eneeByteString :: Monad m => Enumeratee [VerboseHit] ByteString m a eneeByteString = eneeByteStrings ><> mapChunks BS.concat -- | This transformer keeps a 1-1 relationship between each 'VerboseHit' and@@ -35,17 +35,19 @@ -- individual 'VerboseHit's are to be annotated. eneeByteStrings :: Monad m => Enumeratee [VerboseHit] [ByteString] m a-eneeByteStrings = unfoldConvStream f (AliGo BS.empty BS.empty '?') where+eneeByteStrings = unfoldConvStream f (AliGo BS.empty BS.empty '?' []) where f acc = do h <- I.head let na = newAcc acc h- return (fst na , return . BS.unlines $ snd na ++ [showVerboseHit h])+ return ( fst na+ , return . BS.unlines $ snd na ++ P.map (append "## ") (vhAnnotation h) ++ [showVerboseHit h]+ ) -- | Given the current state "a" and verbose hit "h", determine if any state -- switches have to be emitted. newAcc a@(AliGo{..}) h@VerboseHit{..}- | otherwise = ( AliGo vhCM vhScaffold vhStrand, ls )+ | otherwise = ( AliGo vhCM vhScaffold vhStrand [], ls ) where ls = [ "//" | aliCM /= BS.empty && aliCM /= vhCM ] ++ [ "CM: " `BS.append` vhCM | aliCM /= vhCM ] ++ [ ">" `BS.append` vhScaffold `BS.append` "\n" | aliScaffold /= vhScaffold ] ++
Biobase/Infernal/VerboseHit/Import.hs view
@@ -35,25 +35,26 @@ -- accumulator to keep track of the current CM, scaffold and strand. eneeVerboseHit :: (Functor m, Monad m) => Enumeratee BS.ByteString [VerboseHit] m a-eneeVerboseHit = enumLinesBS ><> I.filter (not . BS.null) ><> unfoldConvStream f (AliGo BS.empty BS.empty '?') where+eneeVerboseHit = enumLinesBS ><> I.filter (not . BS.null) ><> unfoldConvStream f (AliGo BS.empty BS.empty '?' []) where f acc = do h' <- tryHead case h' of Nothing -> return (acc, []) (Just h)- | "CM: " `BS.isInfixOf` h -> return (acc{aliCM = BS.copy $ BS.drop 4 h}, [])- | ">" `BS.isInfixOf` h -> return (acc{aliScaffold = BS.copy $ BS.drop 1 h}, [])- | " Plus" `BS.isInfixOf` h -> return (acc{aliStrand = '+'}, [])- | " Minus" `BS.isInfixOf` h -> return (acc{aliStrand = '-'}, [])- | " Query" `BS.isInfixOf` h -> do- x <- qs h (aliCM acc) (aliScaffold acc) (aliStrand acc)- return (acc,x)+ | "##" `isPrefixOf` h -> return (acc{aliAnnotation = aliAnnotation acc ++ [BS.drop 2 h]},[])+ | "CM: " `isInfixOf` h -> return (acc{aliCM = BS.copy $ BS.drop 4 h, aliAnnotation = []}, [])+ | ">" `isInfixOf` h -> return (acc{aliScaffold = BS.copy $ BS.drop 1 h, aliAnnotation = []}, [])+ | " Plus" `isInfixOf` h -> return (acc{aliStrand = '+', aliAnnotation = []}, [])+ | " Minus" `isInfixOf` h -> return (acc{aliStrand = '-', aliAnnotation = []}, [])+ | " Query" `isInfixOf` h -> do+ x <- qs h (aliCM acc) (aliScaffold acc) (aliStrand acc) (aliAnnotation acc)+ return (acc{aliAnnotation = []},x) | otherwise -> return (acc,[]) -- | Parses one CM query result. -qs :: Monad m => BS.ByteString -> BS.ByteString -> BS.ByteString -> Char -> Iteratee [BS.ByteString] m [VerboseHit]-qs query cm scaf pm = do+qs :: Monad m => ByteString -> ByteString -> ByteString -> Char -> [ByteString] -> Iteratee [ByteString] m [VerboseHit]+qs query cm scaf pm anno = do let q = fromRight . parseOnly qt $ query s <- I.head >>= return . fromRight . parseOnly sepg l <- fourLines $ sel4 q@@ -71,6 +72,7 @@ , vhConsensus = cpy $ l!!1 , vhScoring = cpy $ l!!2 , vhSequence = cpy $ l!!3+ , vhAnnotation = anno } where cpy = BS.copy . BS.concat
Biobase/Infernal/VerboseHit/Internal.hs view
@@ -3,15 +3,16 @@ module Biobase.Infernal.VerboseHit.Internal where -import qualified Data.ByteString.Char8 as BS+import Data.ByteString.Char8 as BS -- | State for import and export functions data AliGo = AliGo- { aliCM :: BS.ByteString- , aliScaffold :: BS.ByteString+ { aliCM :: ByteString+ , aliScaffold :: ByteString , aliStrand :: Char+ , aliAnnotation :: [ByteString] } deriving (Show)
BiobaseInfernal.cabal view
@@ -1,5 +1,5 @@ name: BiobaseInfernal-version: 0.5.3.1+version: 0.5.4.0 author: Christian Hoener zu Siederdissen maintainer: choener@tbi.univie.ac.at homepage: http://www.tbi.univie.ac.at/~choener/@@ -15,6 +15,12 @@ Provides import and export facilities for Infernal/Rfam data formats. We include Stockholm, CM, verbose Infernal results, and tabulated Infernal results. Some small tools are included.+ .+ The VerboseHit format is slightly extended to allow simple+ annotations. This extension should be backward-compatible with+ standard-compliant parsers.+ .+ . . With the BioHaskell library split, this package is officially back! And the package is not feature-complete yet, take the