# Position-dependent substitution cost matrix for sequence alignment

Many sequence alignment algorithms and those which measure similarity between sequences require specification of a cost matrix defined on the sequence alphabet. However, the cost incurred does not take position into account. Are there algorithms which take position in the sequence into account ? A generic entry in the cost matrix for such an algorithm would be of the form $Cost(P,Q,i)$ which specifies the cost for replacing $P$ in the $i$-th position of the string with $Q$.

The seqdist function of the TraMineR R package proposes a DHD (Dynamic Hamming Distance) edit method that computes dissimilarities using position dependent costs. Costs can be provided as a 3-dimensional matrix with the third dimension being the position. By default they are derived from the transition probabilities as proposed by Laurent Lesnard (2006)