biohazard-0.6.13: bioinformatics support library

Safe HaskellNone
LanguageHaskell2010

Bio.Bam.Rec

Description

Parsers and Printers for BAM and SAM. We employ an Iteratee interface, and we strive to support everything possible in BAM. So far, the implementation of the nucleotides is somewhat lacking: we do not have support for ambiguity codes, and the "=" symbol is not understood.

Synopsis

Documentation

data BamRaw Source #

Bam record in its native encoding along with virtual address.

bamRaw :: FileOffset -> Bytes -> BamRaw Source #

Smart constructor. Makes sure we got a at least a full record.

data BamRec Source #

internal representation of a BAM record

Constructors

BamRec 

data Cigar Source #

Cigar line in BAM coding Bam encodes an operation and a length into a single integer, we keep those integers in an array.

Constructors

!CigOp :* !Int infix 9 

Instances

Eq Cigar Source # 

Methods

(==) :: Cigar -> Cigar -> Bool #

(/=) :: Cigar -> Cigar -> Bool #

Ord Cigar Source # 

Methods

compare :: Cigar -> Cigar -> Ordering #

(<) :: Cigar -> Cigar -> Bool #

(<=) :: Cigar -> Cigar -> Bool #

(>) :: Cigar -> Cigar -> Bool #

(>=) :: Cigar -> Cigar -> Bool #

max :: Cigar -> Cigar -> Cigar #

min :: Cigar -> Cigar -> Cigar #

Show Cigar Source # 

Methods

showsPrec :: Int -> Cigar -> ShowS #

show :: Cigar -> String #

showList :: [Cigar] -> ShowS #

Storable Cigar Source # 

Methods

sizeOf :: Cigar -> Int #

alignment :: Cigar -> Int #

peekElemOff :: Ptr Cigar -> Int -> IO Cigar #

pokeElemOff :: Ptr Cigar -> Int -> Cigar -> IO () #

peekByteOff :: Ptr b -> Int -> IO Cigar #

pokeByteOff :: Ptr b -> Int -> Cigar -> IO () #

peek :: Ptr Cigar -> IO Cigar #

poke :: Ptr Cigar -> Cigar -> IO () #

alignedLength :: Vector v Cigar => v Cigar -> Int Source #

extracts the aligned length from a cigar line This gives the length of an alignment as measured on the reference, which is different from the length on the query or the length of the alignment.

newtype Nucleotides Source #

A nucleotide base in an alignment. Experience says we're dealing with Ns and gaps all the type, so purity be damned, they are included as if they were real bases.

To allow Nucleotidess to be unpacked and incorporated into containers, we choose to represent them the same way as the BAM file format: as a 4 bit wide field. Gaps are encoded as 0 where they make sense, N is 15. The contained Word8 is guaranteed to be 0..15.

Constructors

Ns 

Fields

Instances

Bounded Nucleotides Source # 
Enum Nucleotides Source # 
Eq Nucleotides Source # 
Ord Nucleotides Source # 
Read Nucleotides Source # 
Show Nucleotides Source # 
Ix Nucleotides Source # 
Storable Nucleotides Source # 
Unbox Nucleotides Source # 
Vector Vector Nucleotides Source # 
Vector Vector_Nucs_half Nucleotides # 
MVector MVector Nucleotides Source # 
Show (Vector_Nucs_half Nucleotides) # 
data Vector Nucleotides Source # 
data MVector s Nucleotides Source # 

type Extensions = [(BamKey, Ext)] Source #

A collection of extension fields. The key is actually only two Chars, but that proved impractical. (Hmm... we could introduce a Key type that is a 16 bit int, then give it an instance IsString... practical?)

data Ext Source #

Instances

Eq Ext Source # 

Methods

(==) :: Ext -> Ext -> Bool #

(/=) :: Ext -> Ext -> Bool #

Ord Ext Source # 

Methods

compare :: Ext -> Ext -> Ordering #

(<) :: Ext -> Ext -> Bool #

(<=) :: Ext -> Ext -> Bool #

(>) :: Ext -> Ext -> Bool #

(>=) :: Ext -> Ext -> Bool #

max :: Ext -> Ext -> Ext #

min :: Ext -> Ext -> Ext #

Show Ext Source # 

Methods

showsPrec :: Int -> Ext -> ShowS #

show :: Ext -> String #

showList :: [Ext] -> ShowS #

deleteE :: BamKey -> Extensions -> Extensions Source #

Deletes all occurences of some extension field.

insertE :: BamKey -> Ext -> Extensions -> Extensions Source #

Blindly inserts an extension field. This can create duplicates (and there is no telling how other tools react to that).

updateE :: BamKey -> Ext -> Extensions -> Extensions Source #

Deletes all occurences of an extension field, then inserts it with a new value. This is safer than insertE, but also more expensive.

adjustE :: (Ext -> Ext) -> BamKey -> Extensions -> Extensions Source #

Adjusts a named extension by applying a function.

progressBam :: MonadIO m => String -> Refs -> Int -> (String -> IO ()) -> Enumeratee [BamRaw] [BamRaw] m a Source #

A simple progress indicator that prints sequence id and position.

data Word32 :: * #

32-bit unsigned integer type

Instances

Bounded Word32 
Enum Word32 
Eq Word32 

Methods

(==) :: Word32 -> Word32 -> Bool #

(/=) :: Word32 -> Word32 -> Bool #

Integral Word32 
Data Word32 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word32 -> c Word32 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word32 #

toConstr :: Word32 -> Constr #

dataTypeOf :: Word32 -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word32) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word32) #

gmapT :: (forall b. Data b => b -> b) -> Word32 -> Word32 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r #

gmapQ :: (forall d. Data d => d -> u) -> Word32 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Word32 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 #

Num Word32 
Ord Word32 
Read Word32 
Real Word32 
Show Word32 
Ix Word32 
Lift Word32 

Methods

lift :: Word32 -> Q Exp #

Hashable Word32 

Methods

hashWithSalt :: Int -> Word32 -> Int #

hash :: Word32 -> Int #

ToJSON Word32 
ToJSONKey Word32 
FromJSON Word32 
FromJSONKey Word32 
Storable Word32 
Bits Word32 
FiniteBits Word32 
Binary Word32 

Methods

put :: Word32 -> Put #

get :: Get Word32 #

putList :: [Word32] -> Put #

Prim Word32 
Random Word32 

Methods

randomR :: RandomGen g => (Word32, Word32) -> g -> (Word32, g) #

random :: RandomGen g => g -> (Word32, g) #

randomRs :: RandomGen g => (Word32, Word32) -> g -> [Word32] #

randoms :: RandomGen g => g -> [Word32] #

randomRIO :: (Word32, Word32) -> IO Word32 #

randomIO :: IO Word32 #

Unbox Word32 
Vector Vector Word32 
MVector MVector Word32 
ReadableChunk [Word32] Word32 Source # 

Methods

readFromPtr :: MonadIO m => Ptr Word32 -> Int -> m [Word32] Source #

data Vector Word32 
data MVector s Word32