BiobaseInfernal-0.5.0.0: Infernal data structures and tools

Biobase.Infernal.VerboseHit.Export

Description

Exports VerboseHit results back into text. As a likely scenario is a pipeline where hits are to be filtered out, this provides enumeratee's that handle additional annotations as required by the file format for CMs, scaffolds, and strand information. If you just need a way to show the data, use printVerboseHit.

Synopsis

Documentation

showVerboseHit :: VerboseHit -> ByteStringSource

Takes a list of VerboseHits and produces a list of bytestrings. Unlining those bytestrings produces a file that is in essence an Infernal verbose-hit output file and should be parse-able by ours and other importers.

TODO block length (for the alignment of query/sequenc) ?!

TODO is there a more elegant treatment of the eof condition than asking at every verbose hit that is created?

Convert a VerboseHit to a string, ready for printing as in the input file.

showCM :: ByteString -> ByteStringSource

CM information, ready for printing.

showScaffold :: ByteString -> ByteStringSource

Scaffold information

showStrand :: Char -> ByteStringSource

Strand information

data HitStream a Source

Turning a list of VerboseHits back into lines of characters is, in principle, not too hard. But just before we actually stream out, we might want to inject arbitrary data into the stream. This is done via StreamInsertion. The other constructors merely wrap certain data.

One way to, say, tag verbose hits is like this (note the output type of eeHitToStream):

 tag [s@(StreamVerboseHit _)] = [StreamInsertion (), s]
 tag xs = xs

Instances

Show a => Show (HitStream a) 

eeHitToStream :: Monad m => Enumeratee VerboseHit [HitStream z] m aSource

This enumeratee turns VerboseHits into a HitStream. Each VerboseHit can emit one or more elements, depending on if the CM, scaffold, or strand changes.

TODO try to rewrite use Control.Monad.State

eeFlattenStream :: Monad m => Enumeratee [HitStream z] (HitStream z) m aSource

Flattens a stream from a list of lists to a single list. After this point, you probably want to insert elements into the stream, then flatten again.