Safe Haskell | None |
---|---|
Language | Haskell98 |
Collection of functions for global, local and multi-sequence alignment.
- align :: (Vector v a, Num s, Ord s) => AlignConfig a s -> v a -> v a -> Trace a s
- data AlignConfig a s
- alignConfig :: (a -> a -> s) -> s -> s -> AlignConfig a s
- type Step a = Either (Either a a) (a, a)
- data Trace a s
- traceScore :: Trace a s -> s
- trace :: Trace a s -> [Step a]
- windowedAlign :: (Num s, Eq s, Ord s) => AlignConfig a s -> Int -> [a] -> [a] -> [Step a]
- centerStar :: (Vector v a, Num s, Ord s, Ord i) => AlignConfig a s -> [(i, v a)] -> MultiTrace i a s
- data MultiStep a
- center :: MultiStep a -> Maybe a
- others :: MultiStep a -> [Maybe a]
- stepOfAll :: MultiStep a -> [Maybe a]
- data MultiTrace i a s
- centerIndex :: MultiTrace i a s -> i
- otherIndices :: MultiTrace i a s -> [i]
- allIndices :: MultiTrace i a s -> [i]
- multiTrace :: MultiTrace i a s -> [MultiStep a]
- debugAlign :: [Step Char] -> String
- debugMultiAlign :: [MultiStep Char] -> String
Global and local alignment
:: (Vector v a, Num s, Ord s) | |
=> AlignConfig a s | |
-> v a | Left sequence. |
-> v a | Right sequence. |
-> Trace a s |
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
data AlignConfig a s Source
:: (a -> a -> s) | Scoring function. |
-> s | Initial gap score. |
-> s | Gap score. |
-> AlignConfig a s |
Configures the scores used when aligning. The gap scores should be negative in order to be penalties.
traceScore :: Trace a s -> s Source
Align streams using sliding windows
:: (Num s, Eq s, Ord s) | |
=> AlignConfig a s | |
-> Int | Window size. |
-> [a] | Left stream. |
-> [a] | Right stream. |
-> [Step a] | Alignment result. |
Aligns long streams by performing alignment on windowed sections.
Multi-sequence alignment
centerStar :: (Vector v a, Num s, Ord s, Ord i) => AlignConfig a s -> [(i, v a)] -> MultiTrace i a s Source
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 be non-empty, and the indices to be unique.
others :: MultiStep a -> [Maybe a] Source
Parallel to otherIndices
.
data MultiTrace i a s Source
The result of a multi-sequence alignment.
centerIndex :: MultiTrace i a s -> i Source
otherIndices :: MultiTrace i a s -> [i] Source
allIndices :: MultiTrace i a s -> [i] Source
The center index followed by other indices.
multiTrace :: MultiTrace i a s -> [MultiStep a] Source
Debugging and demonstration
debugAlign :: [Step Char] -> String Source
Utility for displaying a Char-based alignment.
debugMultiAlign :: [MultiStep Char] -> String Source
Renders a char-based multi-alignment result to a string.