-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Iteratee-based FASTA parser -- -- Enumeratees for FASTA-handling and convenience functions. In a typical -- application, the user should write an enumeratee to extract -- information to allow for efficient low-memory handling of queries. -- -- Facilities for fast, efficient linear scans are provided. These -- functions are not yet stable and could move to another library, if -- more data sources require efficient scans. -- -- The library is, in general, in a preview state. In cases where -- you need to scan large FASTA files fast and with low memory overhead, -- the enumeratees should, however, already be useable enough. @package BiobaseFasta @version 0.0.0.2 module Biobase.Fasta data Fasta Fasta :: Fasta module Biobase.Fasta.Import -- | This is the type of the conversion function from FASTA data to the -- data z. Make certain that all input is used strictly! -- BangPatterns are the easiest to do. In order, the function expects the -- current FASTA header, then a data segment, and finally the starting -- position of the data segment within the full FASTA data. -- -- If you need the conversion to run in constant time, do not use the -- convenience functions and replace the final conversion to a strict -- stream by your own conversion (or output) function. type FastaFunction z = FastaHeader -> StartPos -> WindowSize -> PeekSize -> FastaData -> z -- | Starting position in FASTA entry. type StartPos = Int -- | Current header (the line starting with >) type FastaHeader = ByteString -- | FASTA data type FastaData = ByteString -- | Window type WindowSize = Int -- | How many characters to peek forward type PeekSize = Int -- | Takes a bytestring sequence, applies f to each bytestring of -- windowsize and returns the results z. rollingIter :: (Monad m, Functor m, Nullable z, Monoid z) => (StartPos -> WindowSize -> PeekSize -> FastaData -> z) -> WindowSize -> PeekSize -> Enumeratee ByteString z m a -- | Outer enumeratee. See the two convenience functions for how to use it -- (just like any enumeratee, basically). -- -- The fasta function f manipulates small stretches of fasta -- data and has arguments: fasta header, fasta data, start position (all -- filled by eneeFasta). -- -- Next we have the window size, how many characters to read at once, -- -- followed by the the number of characters to read in addition. -- -- The work is actually done by rollingIter. eneeFasta :: (Monad m, Functor m, Nullable z, NullPoint z, Monoid z) => FastaFunction z -> WindowSize -> PeekSize -> Enumeratee ByteString z m a -- | From an uncompressed file. fromFile :: (Monoid z, Nullable z) => FastaFunction z -> Int -> Int -> FilePath -> IO z -- | From a gzip-compressed file. fromFileZip :: (Monoid z, Nullable z) => FastaFunction z -> Int -> Int -> FilePath -> IO z