I'm doing some research about methods for distance-based comparison of composition of biological sequences (genes, proteins).
Suppose I have two strings (named X and Y) of different lengths, but from a finite alphabet (A, C, T, G):
X = 'ACGT' Y = 'ACGTA'
The difference between two strings can be quantified by calculating distance between their transition matrices. To do so, we can calculate how many times each letter from the alphabet is present in each string. We obtain two vectors representing letter counts for the sequences:
x = [1,1,1,1] y = [2,1,1,1]
Then I can calculate Euclidean distance:
d(x,y) = [(1-2)^2 + (1-1)^2 + (1-1)^2 + (1-1)^2]^0.5 = 1^0.5 = 1
I can't figure out how to calculate the mahalanobis distance. I would be grateful if someone could employ my example and show me how to calculate the mahalanobis distance.