bio-0.4.8: A bioinformatics library

Bio.Location.OnSeq

Contents

Description

Data types for functorially lifting sequence positions and locations onto named sequences. These are useful for taking functions that work with sequence positions and locations and associating them specific, named sequences.

Synopsis

Data types

type SeqName = SeqDataSource

Sequence name, as in a Sequence

data OnSeq a Source

Data type for an object associated with a specific, named sequence

Constructors

OnSeq 

Fields

onSeqName :: !SeqName
 
onSeqObj :: !a
 

Instances

Functor OnSeq 
Eq a => Eq (OnSeq a) 
Ord a => Ord (OnSeq a) 
Show a => Show (OnSeq a) 

Utility functions

withSeqDataSource

Arguments

:: Monad m 
=> (SeqData -> a -> m b)

Function using sequence data

-> (SeqName -> m SeqData)

Lookup sequence by name

-> OnSeq a

Object with named sequence

-> m b 

Looks up a sequence by name and applies a function to it

andSameSeq :: (a -> b -> Bool) -> OnSeq a -> OnSeq b -> BoolSource

Tests a predicate when two objects are on the same sequence, returning False if they are on different sequences.

onSameSeq :: (Error e, MonadError e m) => (a -> b -> m c) -> OnSeq a -> OnSeq b -> m cSource

Performs an action when two objects are on the same sequence and produces an error otherwise.

Sequence collections indexed by name

type OnSeqs a = Map SeqName aSource

Data type for a collection of objects indexed by sequence name

perSeq :: Monoid b => (a -> b -> c) -> OnSeq a -> OnSeqs b -> cSource

Lifts a function on an underlying object to look up the sequence name in a name-indexed collection.

perSeqUpdate :: Monoid b => (a -> b -> b) -> OnSeq a -> OnSeqs b -> OnSeqs bSource

Lifts a function that updates an underlying object to look up the named sequence and update a named-index collection.

withNameAndSeq :: Monad m => (SeqName -> a -> b -> m c) -> OnSeq a -> OnSeqs b -> m cSource

Lifts a function on underlying objects to look up a sequence in a name-indexed collection