bioinformatics-toolkit-0.5.0: A collection of bioinformatics tools

Safe HaskellNone
LanguageHaskell2010

Bio.Data.Bed

Contents

Synopsis

Documentation

class BEDLike b where Source #

A class representing BED-like data, e.g., BED3, BED6 and BED12. BED format uses 0-based index (see documentation).

Minimal complete definition

chrom, chromStart, chromEnd, name, score, strand

Methods

chrom :: Lens' b ByteString Source #

Field lens

chromStart :: Lens' b Int Source #

chromEnd :: Lens' b Int Source #

name :: Lens' b (Maybe ByteString) Source #

score :: Lens' b (Maybe Double) Source #

strand :: Lens' b (Maybe Bool) Source #

size :: b -> Int Source #

Return the size of a bed region.

class BEDLike b => BEDConvert b where Source #

Minimal complete definition

asBed, fromLine, toLine

Methods

asBed :: ByteString -> Int -> Int -> b Source #

Construct bed record from chromsomoe, start location and end location

fromLine :: ByteString -> b Source #

Convert bytestring to bed format

toLine :: b -> ByteString Source #

Convert bed to bytestring

convert :: BEDLike b' => b' -> b Source #

data BEDExt bed a Source #

Constructors

BEDExt 

Fields

Instances

(Eq a, Eq bed) => Eq (BEDExt bed a) Source # 

Methods

(==) :: BEDExt bed a -> BEDExt bed a -> Bool #

(/=) :: BEDExt bed a -> BEDExt bed a -> Bool #

(Read a, Read bed) => Read (BEDExt bed a) Source # 

Methods

readsPrec :: Int -> ReadS (BEDExt bed a) #

readList :: ReadS [BEDExt bed a] #

readPrec :: ReadPrec (BEDExt bed a) #

readListPrec :: ReadPrec [BEDExt bed a] #

(Show a, Show bed) => Show (BEDExt bed a) Source # 

Methods

showsPrec :: Int -> BEDExt bed a -> ShowS #

show :: BEDExt bed a -> String #

showList :: [BEDExt bed a] -> ShowS #

(Default a, Read a, Show a, BEDConvert bed) => BEDConvert (BEDExt bed a) Source # 

Methods

asBed :: ByteString -> Int -> Int -> BEDExt bed a Source #

fromLine :: ByteString -> BEDExt bed a Source #

toLine :: BEDExt bed a -> ByteString Source #

convert :: BEDLike b' => b' -> BEDExt bed a Source #

BEDLike bed => BEDLike (BEDExt bed a) Source # 

_bed :: forall bed a bed. Lens (BEDExt bed a) (BEDExt bed a) bed bed Source #

_data :: forall bed a a. Lens (BEDExt bed a) (BEDExt bed a) a a Source #

bedToTree :: BEDLike b => (a -> a -> a) -> [(b, a)] -> BEDTree a Source #

sortedBedToTree :: (BEDLike b, Foldable f) => (a -> a -> a) -> Sorted (f (b, a)) -> BEDTree a Source #

Convert a set of sorted bed records to interval tree, with combining function for equal keys.

sizeOverlapped :: (BEDLike b1, BEDLike b2) => b1 -> b2 -> Int Source #

splitBed :: BEDConvert b => Int -> b -> [b] Source #

split a bed region into k consecutive subregions, discarding leftovers

splitBedBySize :: BEDConvert b => Int -> b -> [b] Source #

split a bed region into consecutive fixed size subregions, discarding leftovers

splitBedBySizeLeft :: BEDConvert b => Int -> b -> [b] Source #

split a bed region into consecutive fixed size subregions, including leftovers

splitBedBySizeOverlap Source #

Arguments

:: BEDConvert b 
=> Int

bin size

-> Int

overlap size

-> b 
-> [b] 

newtype Sorted b Source #

a type to imply that underlying data structure is sorted

Constructors

Sorted 

Fields

Instances

Eq b => Eq (Sorted b) Source # 

Methods

(==) :: Sorted b -> Sorted b -> Bool #

(/=) :: Sorted b -> Sorted b -> Bool #

Read b => Read (Sorted b) Source # 
Show b => Show (Sorted b) Source # 

Methods

showsPrec :: Int -> Sorted b -> ShowS #

show :: Sorted b -> String #

showList :: [Sorted b] -> ShowS #

sortBed :: BEDLike b => [b] -> Sorted (Vector b) Source #

sort BED, first by chromosome (alphabetical order), then by chromStart, last by chromEnd

intersectBed :: (BEDLike b1, BEDLike b2, Monad m) => [b2] -> ConduitT b1 b1 m () Source #

return records in A that are overlapped with records in B

intersectBedWith :: (BEDLike b1, BEDLike b2, Monad m) => (b1 -> [b2] -> a) -> [b2] -> ConduitT b1 a m () Source #

intersectSortedBed :: (BEDLike b1, BEDLike b2, Monad m) => Sorted (Vector b2) -> ConduitT b1 b1 m () Source #

return records in A that are overlapped with records in B

intersectSortedBedWith :: (BEDLike b1, BEDLike b2, Monad m) => (b1 -> [b2] -> a) -> Sorted (Vector b2) -> ConduitT b1 a m () Source #

isOverlapped :: (BEDLike b1, BEDLike b2) => b1 -> b2 -> Bool Source #

mergeBed :: (BEDConvert b, Monad m) => [b] -> ConduitT i b m () Source #

mergeBedWith :: (BEDLike b, Monad m) => ([b] -> a) -> [b] -> ConduitT i a m () Source #

mergeSortedBedWith :: (BEDLike b, Monad m) => ([b] -> a) -> Sorted (Vector b) -> ConduitT i a m () Source #

splitOverlapped :: BEDLike b => ([b] -> a) -> [b] -> [(BED3, a)] Source #

Split overlapped regions into non-overlapped regions. The input must be overlapped. This function is usually used with mergeBedWith.

hReadBed :: (BEDConvert b, MonadIO m) => Handle -> ConduitT i b m () Source #

Read records from a bed file handler in a streaming fashion.

hReadBed' :: (BEDConvert b, MonadIO m) => Handle -> m [b] Source #

Non-streaming version.

readBed :: (BEDConvert b, MonadIO m) => FilePath -> ConduitT i b m () Source #

Read records from a bed file in a streaming fashion.

readBed' :: (BEDConvert b, MonadIO m) => FilePath -> m [b] Source #

Non-streaming version.

hWriteBed' :: (BEDConvert b, MonadIO m) => Handle -> [b] -> m () Source #

writeBed' :: (BEDConvert b, MonadIO m) => FilePath -> [b] -> m () Source #

Utilities

fetchSeq :: (BioSeq DNA a, MonadIO m) => Genome -> ConduitT BED (Either String (DNA a)) m () Source #

retreive sequences

fetchSeq' :: (BioSeq DNA a, MonadIO m) => Genome -> [BED] -> m [Either String (DNA a)] Source #

motifScan :: (BEDLike b, MonadIO m) => Genome -> [Motif] -> Bkgd -> Double -> ConduitT b BED m () Source #

Identify motif binding sites

getMotifScore :: MonadIO m => Genome -> [Motif] -> Bkgd -> ConduitT BED BED m () Source #

Retrieve motif matching scores

getMotifPValue Source #

Arguments

:: Monad m 
=> Maybe Double

whether to truncate the motif score CDF. Doing this will significantly reduce memory usage without sacrifice accuracy.

-> [Motif] 
-> Bkgd 
-> ConduitT BED BED m () 

compareBed :: (BEDLike b1, BEDLike b2) => b1 -> b2 -> Ordering Source #

Compare bed records using only the chromosome, start and end positions. Unlike the `compare' from the Ord type class, this function can compare different types of BED data types.