-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Sequence alignment algorithms. -- @package align @version 0.1.1.2 -- | Collection of functions for global, local and multi-sequence -- alignment. module Data.Align -- | Aligns two sequences. -- --
--   >>> :{
--   let tr = align
--              (alignConfig (\a b -> if a == b then 1 else (-0.25 :: Double)) 
--                           (-0.5) (-1))
--              (Data.Vector.fromList "dopple")
--              (Data.Vector.fromList "applied")
--   in do
--      print $ traceScore tr
--      putStrLn . debugAlign . trace $ tr
--   :}
--   1.25
--   doppl-e-
--   -applied
--   
align :: (Vector v a, Num s, Ord s) => AlignConfig a s -> v a -> v a -> Trace a s data AlignConfig a s -- | Configures the scores used when aligning. The gap scores should be -- negative in order to be penalties. alignConfig :: (a -> a -> s) -> s -> s -> AlignConfig a s -- | Either an unmatched item or a match. type Step a = Either (Either a a) (a, a) -- | The result of the alignment. data Trace a s traceScore :: Trace a s -> s trace :: Trace a s -> [Step a] -- | Aligns long streams by performing alignment on windowed sections. windowedAlign :: (Num s, Eq s, Ord s) => AlignConfig a s -> Int -> [a] -> [a] -> [Step a] -- | Align multiple sequences using the Center Star heuristic method by -- Chin, Ho, Lam, Wong and Chan (2003). -- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.7448&rep=rep1&type=pdf. -- Assumes the list of sequences to have length > 1, and the indices -- to be unique. centerStar :: (Vector v a, Num s, Ord s, Ord i) => AlignConfig a s -> [(i, v a)] -> MultiTrace i a s -- | A step in a multi-sequence alignment. data MultiStep a -- | Nothing means gap insertion. center :: MultiStep a -> Maybe a -- | Parallel to otherIndices. others :: MultiStep a -> [Maybe a] -- | The center step followed by other steps. stepOfAll :: MultiStep a -> [Maybe a] -- | The result of a multi-sequence alignment. data MultiTrace i a s centerIndex :: MultiTrace i a s -> i otherIndices :: MultiTrace i a s -> [i] -- | The center index followed by other indices. allIndices :: MultiTrace i a s -> [i] multiTrace :: MultiTrace i a s -> [MultiStep a] -- | Utility for displaying a Char-based alignment. debugAlign :: [Step Char] -> String -- | Renders a char-based multi-alignment result to a string. debugMultiAlign :: [MultiStep Char] -> String instance (Show a, Show s) => Show (Trace a s) -- | Browse the source of this module to see usage examples. module Data.Align.Demo sampleGlobalConfig :: Eq a => AlignConfig a Double testIn1 :: [Char] testIn2 :: [Char] alignedGlobal :: Trace Char Double debug :: Trace Char s -> IO () printAlignedGlobal :: IO () -- | Example from -- https://www.biostat.wisc.edu/bmi576/lectures/multiple-alignment.pdf nucs :: [[Char]] alignNuc :: Eq a => [a] -> [a] -> Trace a Double alignedNucPairs :: [Trace Char Double] printAlignedNucPairs :: IO () alignedNucStar :: MultiTrace Integer Char Double printAlignedNucStar :: IO ()