-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Data structures and helper functions for calculating alignments
--
-- Data structures and helper functions for calculating alignments
@package bioalign
@version 0.0.5
-- | Data structures and helper functions for calculating alignments
--
-- There are two ways to view an alignment: either as a list of edits
-- (i.e., insertions, deletions, or substitutions), or as a set of
-- sequences with inserted gaps.
--
-- The edit list approach is perhaps more restrictive model but doesn't
-- generalize to multiple alignments.
--
-- The gap approach is more general, and probably more commonly used by
-- other software (see e.g. the ACE file format).
module Bio.Alignment.AlignData
data Sequence
Seq :: SeqLabel -> SeqData -> (Maybe QualData) -> Sequence
type Gaps = [Offset]
type Alignment = [(Offset, Strand, Sequence, Gaps)]
-- | Gaps are coded as *s, this function removes them, and returns
-- the sequence along with the list of gap positions. note that gaps are
-- positioned relative to the *gapped* sequence (contrast to
-- stmassembler/Cluster.hs)
extractGaps :: SeqData -> (SeqData, Gaps)
insertGaps :: Char -> (SeqData, Gaps) -> SeqData
-- | An Edit is either the insertion, the deletion, or the replacement of a
-- character.
data Edit
Ins :: Chr -> Edit
Del :: Chr -> Edit
Repl :: Chr -> Chr -> Edit
-- | An alignment is a sequence of edits.
type EditList = [Edit]
-- | A substitution matrix gives scores for replacing a character with
-- another. Typically, it will be symmetric. It is type-tagged with the
-- alphabet - Nuc or Amino.
type SubstMx t a = (Chr, Chr) -> a
-- | A Selector consists of a zero element, and a funcition that chooses a
-- possible Edit operation, and generates an updated result.
type Selector a = [(a, Edit)] -> a
-- | The sequence element type, used in alignments.
type Chr = Word8
-- | Calculate a set of columns containing scores This represents the
-- columns of the alignment matrix, but will only require linear space
-- for score calculation.
columns :: Selector a -> a -> Sequence -> Sequence -> [[a]]
-- | Evaluate an Edit based on SubstMx and gap penalty
eval :: SubstMx t a -> a -> Edit -> a
-- | True if the Edit is a Repl.
isRepl :: Edit -> Bool
on :: (t1 -> t1 -> t) -> (t2 -> t1) -> t2 -> t2 -> t
showalign :: EditList -> [Char]
-- | turn an alignment into sequences with - representing gaps (for
-- checking, filtering out the - characters should return the
-- original sequences, provided - isn't part of the sequence
-- alphabet)
toStrings :: EditList -> (String, String)
instance Eq Sequence
instance Show Edit
instance Eq Edit
instance BioSeq Sequence