biohazard-1.0.1: bioinformatics support library

Safe Haskell None Haskell2010

Bio.Bam.Index

Synopsis

# Documentation

data BamIndex a Source #

Full index, unifying BAI and CSI style. In both cases, we have the binning scheme, parameters are fixed in BAI, but variable in CSI. Checkpoints are created from the linear index in BAI or from the loffset field in CSI.

Constructors

 BamIndex Fieldsminshift :: !IntMinshift parameter from CSIdepth :: !IntDepth parameter from CSIunaln_off :: !Int64Best guess at where the unaligned records startextensions :: aRoom for stuff (needed for tabix)refseq_bins :: !(Vector Bins)Records for the binning index, where each bin has a list of segments belonging to it.refseq_ckpoints :: !(Vector Ckpoints)Known checkpoints of the form (pos,off) where off is the virtual offset of the first record crossing pos.

Instances

 Show a => Show (BamIndex a) Source # MethodsshowsPrec :: Int -> BamIndex a -> ShowS #show :: BamIndex a -> String #showList :: [BamIndex a] -> ShowS #

Reads any index we can find for a file. If the file name has a .bai or .csi extension, we read it. Else we look for the index by adding such an extension and by replacing the extension with these two, and finally in the file itself. The first file that exists and can actually be parsed, is used.

readBaiIndex :: MonadIO m => Iteratee Bytes m (BamIndex ()) Source #

Read an index in BAI or CSI format, recognized automatically. Note that TBI is supposed to be compressed using bgzip; it must be decompressed before being passed to readBaiIndex.

readTabix :: MonadIO m => Iteratee Bytes m TabIndex Source #

Reads a Tabix index. Note that tabix indices are compressed, this is taken care of.

data Region Source #

Constructors

 Region Fieldsrefseq :: !Refseq start :: !Int end :: !Int

Instances

 Source # Methods(==) :: Region -> Region -> Bool #(/=) :: Region -> Region -> Bool # Source # Methods(<) :: Region -> Region -> Bool #(<=) :: Region -> Region -> Bool #(>) :: Region -> Region -> Bool #(>=) :: Region -> Region -> Bool #max :: Region -> Region -> Region #min :: Region -> Region -> Region # Source # MethodsshowsPrec :: Int -> Region -> ShowS #showList :: [Region] -> ShowS #

newtype Subsequence Source #

A mostly contiguous subset of a sequence, stored as a set of non-overlapping intervals in an IntMap from start position to end position (half-open intervals, naturally).

Constructors

 Subsequence (IntMap Int)

Instances

 Source # MethodsshowList :: [Subsequence] -> ShowS #

eneeBamRefseq :: Monad m => BamIndex b -> Refseq -> Enumeratee [BamRaw] [BamRaw] m a Source #

Seeks to a given sequence in a Bam file and enumerates only those records aligning to that reference. We use the first checkpoint available for the sequence. This requires an appropriate index, and the file must have been opened in such a way as to allow seeking. Enumerates over the BamRaw records of the correct sequence only, doesn't enumerate at all if the sequence isn't found.

eneeBamUnaligned :: Monad m => BamIndex b -> Enumeratee [BamRaw] [BamRaw] m a Source #

Seeks to the part of a Bam file that contains unaligned reads and enumerates those. Sort of the dual to eneeBamRefseq. We use the best guess at where the unaligned stuff starts. If no such guess is available, we decode everything.