Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data BamRaw
- bamRaw :: FileOffset -> Bytes -> BamRaw
- virt_offset :: BamRaw -> FileOffset
- raw_data :: BamRaw -> Bytes
- data BamRec = BamRec {}
- unpackBam :: BamRaw -> BamRec
- nullBamRec :: BamRec
- getMd :: BamRec -> Maybe [MdOp]
- data Cigar = !CigOp :* !Int
- data CigOp
- alignedLength :: Vector v Cigar => v Cigar -> Int
- newtype Nucleotides = Ns {}
- data Vector_Nucs_half a
- type Extensions = [(BamKey, Ext)]
- data Ext
- extAsInt :: Int -> BamKey -> BamRec -> Int
- extAsString :: BamKey -> BamRec -> Bytes
- setQualFlag :: Char -> BamRec -> BamRec
- deleteE :: BamKey -> Extensions -> Extensions
- insertE :: BamKey -> Ext -> Extensions -> Extensions
- updateE :: BamKey -> Ext -> Extensions -> Extensions
- adjustE :: (Ext -> Ext) -> BamKey -> Extensions -> Extensions
- isPaired :: BamRec -> Bool
- isProperlyPaired :: BamRec -> Bool
- isUnmapped :: BamRec -> Bool
- isMateUnmapped :: BamRec -> Bool
- isReversed :: BamRec -> Bool
- isMateReversed :: BamRec -> Bool
- isFirstMate :: BamRec -> Bool
- isSecondMate :: BamRec -> Bool
- isAuxillary :: BamRec -> Bool
- isSecondary :: BamRec -> Bool
- isFailsQC :: BamRec -> Bool
- isDuplicate :: BamRec -> Bool
- isSupplementary :: BamRec -> Bool
- isTrimmed :: BamRec -> Bool
- isMerged :: BamRec -> Bool
- isAlternative :: BamRec -> Bool
- isExactIndex :: BamRec -> Bool
- type_mask :: Int
- progressBam :: MonadIO m => String -> Refs -> Int -> (String -> IO ()) -> Enumeratee [BamRaw] [BamRaw] m a
- data Word32
Documentation
Bam record in its native encoding along with virtual address.
Instances
IsBamRec BamRaw Source # | |
Defined in Bio.Bam.Writer pushBam :: BamRaw -> BgzfTokens -> BgzfTokens Source # |
bamRaw :: FileOffset -> Bytes -> BamRaw Source #
Smart constructor. Makes sure we got a at least a full record.
virt_offset :: BamRaw -> FileOffset Source #
internal representation of a BAM record
nullBamRec :: BamRec Source #
Cigar line in BAM coding Bam encodes an operation and a length into a single integer, we keep those integers in an array.
Instances
Eq Cigar Source # | |
Ord Cigar Source # | |
Show Cigar Source # | |
Storable Cigar Source # | |
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 Nucleotides
s 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.
Instances
data Vector_Nucs_half a Source #
A vector that packs two Nucleotides
into one byte, just like Bam does.
Instances
type Extensions = [(BamKey, Ext)] Source #
A collection of extension fields. A BamKey
is actually two ASCII
characters.
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.
isProperlyPaired :: BamRec -> Bool Source #
isUnmapped :: BamRec -> Bool Source #
isMateUnmapped :: BamRec -> Bool Source #
isReversed :: BamRec -> Bool Source #
isMateReversed :: BamRec -> Bool Source #
isFirstMate :: BamRec -> Bool Source #
isSecondMate :: BamRec -> Bool Source #
isAuxillary :: BamRec -> Bool Source #
isSecondary :: BamRec -> Bool Source #
isDuplicate :: BamRec -> Bool Source #
isSupplementary :: BamRec -> Bool Source #
isAlternative :: BamRec -> Bool Source #
isExactIndex :: BamRec -> Bool Source #
progressBam :: MonadIO m => String -> Refs -> Int -> (String -> IO ()) -> Enumeratee [BamRaw] [BamRaw] m a Source #
A simple progress indicator that prints sequence id and position.
32-bit unsigned integer type
Instances
Bounded Word32 | Since: base-2.1 |
Enum Word32 | Since: base-2.1 |
Defined in GHC.Word | |
Eq Word32 | Since: base-2.1 |
Integral Word32 | Since: base-2.1 |
Data Word32 | Since: base-4.0.0.0 |
Defined in Data.Data 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 | Since: base-2.1 |
Ord Word32 | Since: base-2.1 |
Read Word32 | Since: base-2.1 |
Real Word32 | Since: base-2.1 |
Defined in GHC.Word toRational :: Word32 -> Rational # | |
Show Word32 | Since: base-2.1 |
Ix Word32 | Since: base-2.1 |
Lift Word32 | |
PrintfArg Word32 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Word32 -> FieldFormatter # parseFormat :: Word32 -> ModifierParser # | |
Storable Word32 | Since: base-2.1 |
Bits Word32 | Since: base-2.1 |
Defined in GHC.Word (.&.) :: Word32 -> Word32 -> Word32 # (.|.) :: Word32 -> Word32 -> Word32 # xor :: Word32 -> Word32 -> Word32 # complement :: Word32 -> Word32 # shift :: Word32 -> Int -> Word32 # rotate :: Word32 -> Int -> Word32 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # | |
FiniteBits Word32 | Since: base-4.6.0.0 |
Defined in GHC.Word finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int # | |
Unbox Word32 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Word32 | |
Defined in Data.Primitive.Types alignment# :: Word32 -> Int# indexByteArray# :: ByteArray# -> Int# -> Word32 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Word32#) writeByteArray# :: MutableByteArray# s -> Int# -> Word32 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word32 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Word32 readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Word32#) writeOffAddr# :: Addr# -> Int# -> Word32 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Word32 -> State# s -> State# s | |
Hashable Word32 | |
Defined in Data.Hashable.Class | |
Vector Vector Word32 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Word32 -> m (Vector Word32) basicUnsafeThaw :: PrimMonad m => Vector Word32 -> m (Mutable Vector (PrimState m) Word32) basicLength :: Vector Word32 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word32 -> Vector Word32 basicUnsafeIndexM :: Monad m => Vector Word32 -> Int -> m Word32 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Word32 -> Vector Word32 -> m () | |
MVector MVector Word32 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Word32 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word32 -> MVector s Word32 basicOverlaps :: MVector s Word32 -> MVector s Word32 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Word32) basicInitialize :: PrimMonad m => MVector (PrimState m) Word32 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Word32 -> m (MVector (PrimState m) Word32) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Word32 -> Int -> m Word32 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Word32 -> Int -> Word32 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Word32 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Word32 -> Word32 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Word32 -> MVector (PrimState m) Word32 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Word32 -> MVector (PrimState m) Word32 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Word32 -> Int -> m (MVector (PrimState m) Word32) | |
data Vector Word32 | |
Defined in Data.Vector.Unboxed.Base | |
data MVector s Word32 | |
Defined in Data.Vector.Unboxed.Base |