packages feed

biostockholm 0.2 → 0.2.1

raw patch · 5 files changed

+26/−24 lines, 5 filesdep ~attoparsec-conduitdep ~basedep ~biocorePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: attoparsec-conduit, base, biocore, blaze-builder-conduit, bytestring, conduit, containers

API changes (from Hackage documentation)

Files

benchmarks/benchmark_v0.2.hs view
@@ -1,18 +1,20 @@ {-# LANGUAGE OverloadedStrings #-} import Bio.Sequence.Stockholm import Bio.Sequence.Stockholm.Stream-import Control.Monad.Exception.Synchronous (Exceptional(..)) import System.IO (stdin) import qualified Data.Conduit as C import qualified Data.Conduit.Binary as CB import qualified Data.Conduit.List as CL +main :: IO () main = main_event +main_doc :: IO () main_doc = C.runResourceT $ CB.sourceHandle stdin C.$$ parseStockholm C.=$ CL.mapM_ printName     where       printName (Stockholm file _ _) = print (findAnn AC file) +main_event :: IO () main_event = C.runResourceT $ CB.sourceHandle stdin C.$$ parseEvents C.=$ CL.mapM_ printName     where       printName (EvGF "AC" name) = print name
biostockholm.cabal view
@@ -1,5 +1,5 @@ Name:                biostockholm-Version:             0.2+Version:             0.2.1 Synopsis:            Parsing and rendering of Stockholm files (used by Pfam, Rfam and Infernal). License:             BSD3 License-file:        LICENSE@@ -40,11 +40,11 @@       , containers         >= 0.2   && < 0.5       , bytestring         == 0.9.*       , deepseq            >= 1.1   && < 1.3-      , conduit            == 0.1.*+      , conduit            == 0.2.*       , attoparsec         == 0.10.*-      , attoparsec-conduit == 0.0.*+      , attoparsec-conduit == 0.2.*       , blaze-builder      == 0.3.*-      , blaze-builder-conduit == 0.0.*+      , blaze-builder-conduit == 0.2.*        , biocore            >= 0.1   && < 0.3 @@ -54,17 +54,15 @@   Main-is: runtests.hs   Ghc-Options: -Wall   Build-depends:-        base               >= 3     && < 5-      , containers         >= 0.2   && < 0.5-      , bytestring         == 0.9.*-      , conduit            == 0.1.*+        base+      , containers+      , bytestring+      , conduit       , zlib-conduit-      , transformers       >= 0.2--      , biocore            >= 0.1   && < 0.3+      , biocore +      , transformers       >= 0.2       , hspec              == 0.9.*       , HUnit       , QuickCheck-       , biostockholm
src/Bio/Sequence/Stockholm/Document.hs view
@@ -333,7 +333,7 @@       close (InsideStockholm annots seqs) = return [makeStockholm annots seqs]        push state (EvComment _) =-          return (state, C.Producing [])+          return (C.StateProducing state [])        push LookingForHeader EvHeader =           continue (emptyPA, M.empty)@@ -343,7 +343,7 @@       push (InsideStockholm _ _) EvHeader =           fail "parseDoc: unexpected header"       push (InsideStockholm annots seqs) EvEnd =-          return (LookingForHeader, C.Producing [makeStockholm annots seqs])+          return (C.StateProducing LookingForHeader [makeStockholm annots seqs])       push (InsideStockholm annots seqs) (EvSeqData label data_) =           continue (annots, insertDM (label, data_) seqs)       push (InsideStockholm annots seqs) (EvGF feat data_) =@@ -355,7 +355,7 @@       push (InsideStockholm annots seqs) (EvGR sq feat data_) =           continue (insertPA_GR sq (Ann (parseClmnFeature feat) data_) annots, seqs) -      continue (annots, seqs) = return (InsideStockholm annots seqs, C.Producing [])+      continue (annots, seqs) = return (C.StateProducing (InsideStockholm annots seqs) [])       {-# INLINE continue #-}  data ParseDoc = LookingForHeader
src/Bio/Sequence/Stockholm/Stream.hs view
@@ -60,16 +60,17 @@ eventParser = hash *> (ann <|> comment)           <|> end           <|> seqdata+              A.<?> "Event"     where       word = A.takeTill A8.isHorizontalSpace <* spaces       tillNextLine = A.takeLazyByteString        hash    = A8.char '#'-      comment = EvComment <$> tillNextLine-      end     = EvEnd     <$  A8.string "//" <* spaces-      seqdata = EvSeqData <$> word <*> tillNextLine+      comment = EvComment <$> tillNextLine A.<?> "Comment"+      end     = EvEnd     <$  A8.string "//" <* spaces A.<?> "End of Stockholm file (//)"+      seqdata = EvSeqData <$> word <*> tillNextLine A.<?> "Sequence data" -      ann = A8.string "=G" *> (gf <|> gc <|> gs <|> gr)+      ann = A8.string "=G" *> (gf <|> gc <|> gs <|> gr) A.<?> "Annotation"           where             gf = EvGF <$ A8.char 'F' <* spaces          <*> word <*> tillNextLine             gc = EvGC <$ A8.char 'C' <* spaces          <*> word <*> tillNextLine@@ -79,6 +80,7 @@ -- | Parse 'EvHeader'. headerParser :: A.Parser Event headerParser = EvHeader <$ A8.char '#' <* spaces <* mystring "STOCKHOLM 1.0" <* spaces+               A.<?> "Stockholm Header"     where       mystring (x:xs) = A8.char x *> mystring xs       mystring []     = pure ()
tests/runtests.hs view
@@ -85,7 +85,7 @@           liftIO (zipWithM_ (@?=) parsed2 parsed1)      describe "renderEvents/parseEvents" $ do-      prop "passes QuickCheck property" $ \(events :: [Event]) ->+      prop "passes QuickCheck property" $ forAll eventList $ \(events :: [Event]) ->         unsafePerformIO $ do           rendered <- C.runResourceT $ CL.sourceList events   C.$$ renderEvents C.=$ CL.consume           again    <- C.runResourceT $ CL.sourceList rendered C.$$ parseEvents C.=$ CL.consume@@ -192,13 +192,13 @@       , (2,  EvGR      <$> seqlabel <*> feature <*> arbitrary)       ]         where seqlabel = strict . unSL <$> arbitrary-              seqdata  = strict . unSD <$> arbitrary+              seqdata  = unSD <$> arbitrary               feature  = B.pack <$> listOf1 (elements alpha)               strict = B.concat . L.toChunks  eventList :: Gen [Event] eventList = sized $ \s -> frequency [ (100, single)-                                    , (s, (++) <$> single <*> (resize (s `div` 2) eventList)) ]+                                    , (s, (++) <$> single <*> (resize (s - 1) eventList)) ]     where       single = (\xs -> EvHeader : xs ++ [EvEnd]) <$> listOf arbitrary @@ -283,7 +283,7 @@                 (before, rest)          -> (EvHeader : before)            : separate rest           separate (x:xs) = [x] : separate xs           separate []     = []-          (<>) = B.append+          (<>) = L.append           glue (EvSeqData sq1 data1 : EvSeqData sq2 data2 : xs)               | sq1 == sq2 = glue (EvSeqData sq1 (data1 <> data2) : xs)           glue (EvGF feat1 data1 : EvGF feat2 data2 : xs)