align-0.1.0.0: Sequence alignment algorithms.

Safe HaskellNone

Data.Align

Synopsis

Documentation

alignSource

Arguments

:: (Vector v a, Num s, Eq 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

alignConfigSource

Arguments

:: (a -> a -> s)

Scoring function.

-> s

Initial gap penalty.

-> s

Gap penalty.

-> AlignConfig a s 

type Step a = Either (Either a a) (a, a)Source

Either an unmatched item or a match.

data Trace a s Source

The result of the alignment.

Instances

(Show a, Show s) => Show (Trace a s) 

trace :: Trace a s -> [Step a]Source

windowedAlignSource

Arguments

:: (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.

debugAlign :: [Step Char] -> StringSource

Utility for displaying a Char-based alignment.