I have two triangular 2D matrices and want to determine if their contents are statistically different.
Let's say I have a collection of 5 different species and two proteins from the 5 species. Let's call the first protein 'A
' and second 'B
'. I'm interested in testing if protein A
is more or less similar across these species than protein B
. To determine how similar A
proteins are, I generated an alignment of all 5 protein A homologs (A1..A5
) and calculated the proportion of amino acids that are shared between them. This generated a triangular matrix (M1
) where the diagonal is 1 because A1 = A1
, A2 = A2
, etc. All other comparisons are between 0 (no similarity) and 1 (identical). I then did the same thing for protein B
, comparing the 5 protein B homologs (B1..B5
) to generate a second triangular matrix (M2
).
How do I test if protein A
in M1
is statistically more/less similar among species than protein B
in M2
. I would like to report a P-value.
The closest thing I've found to this is the Mantel test. However, it tests if M1
and M2
are correlated, not whether they are different.
Ideally, I'd like to use R to run the test.
Here are example matrices for M1
(protein A
) and M2
(protein B
):
M1 <- matrix(c(1, 0.9, 0.8, 0.7, 0.6,
NA, 1, 0.7, 0.6, 0.5,
NA, NA, 1, 0.1, 0.8,
NA, NA, NA, 1, 0.9,
NA, NA, NA, NA, 1),
ncol = 5)
colnames(M1) <- c("A1", "A2", "A3", "A4", "A5")
rownames(M1) <- c("A1", "A2", "A3", "A4", "A5")
A1 A2 A3 A4 A5
A1 1.0 NA NA NA NA
A2 0.9 1.0 NA NA NA
A3 0.8 0.7 1.0 NA NA
A4 0.7 0.6 0.1 1.0 NA
A5 0.6 0.5 0.8 0.9 1
M2 <- matrix(c(1, 0.8, 0.7, 0.6, 0.5,
NA, 1, 0.6, 0.5, 0.4,
NA, NA, 1, 0.1, 0.7,
NA, NA, NA, 1, 0.8,
NA, NA, NA, NA, 1),
ncol = 5)
colnames(M2) <- c("B1", "B2", "B3", "B4", "B5")
rownames(M2) <- c("B1", "B2", "B3", "B4", "B5")
B1 B2 B3 B4 B5
B1 1.0 NA NA NA NA
B2 0.8 1.0 NA NA NA
B3 0.7 0.6 1.0 NA NA
B4 0.6 0.5 0.1 1.0 NA
B5 0.5 0.4 0.7 0.8 1