Hello,
I'm trying to take the correlation of two distance matrices and get
the r2 value
ex)
Ndisc PS1 Ntet Nsito NcB NcA PS3 NcC
NiB NiA
PS1
0.08945
Ntet 0.08601
0.02020
Nsito 0.09361 0.02780
0.02260
NcB 0.09479 0.03258 0.02914
0.03674
NcA 0.09363 0.03142 0.02798 0.03558
0.02190
PS3 0.09145 0.02924 0.02580 0.03340 0.02446
0.02330
NcC 0.08919 0.02698 0.02354 0.03114 0.02220 0.02104
0.01670
NiB 0.09749 0.03802 0.03458 0.04218 0.04336 0.04220 0.04002
0.03776
NiA 0.09571 0.03624 0.03280 0.04040 0.04158 0.04042 0.03824 0.03598
0.02170
PS2 0.09234 0.03287 0.02943 0.03703 0.03821 0.03705 0.03487 0.03261
0.03289 0.03111
and
Ndisc PS1 Ntet NcB NcA NcC PS3
Nsito PS2 NiB
PS1
2.981494
Ntet 2.949046
1.003718
NcB 3.212256 1.266928
1.178326
NcA 3.531725 1.586397 1.497795
1.217055
NcC 3.111421 1.166093 1.077491 0.944637
1.264106
PS3 3.115273 1.169945 1.081343 1.000991 1.320460
0.900156
Nsito 2.994152 1.131330 1.098882 1.362092 1.681561 1.261257
1.265109
PS2 2.843805 1.228361 1.195913 1.459123 1.778592 1.358288 1.362140
1.241019
NiB 2.805537 1.375615 1.343167 1.606377 1.925846 1.505542 1.509394
1.388273 1.237926
NiA 2.752269 1.322347 1.289899 1.553109 1.872578 1.452274 1.456126
1.335005 1.184658 1.018210
The problem is that these matrices are the endpoint of an extensive
simulation involving phylogenetic trees and the order of the columns
and rows shifts around according to how they were ordered in the
tree. I used cophenetic.phylo to get the distance matrix and now I
need to find a way to reorder or sort the columns and rows such that
the two matrices match and cor is taking the correlation of the
corresponding column and row and not just the one in the same
position. I don't want to sort the values in the columns and rows but
the entire column and their associated rows. I've looked at order ,
sort, and match and can't figure out a way to do it based on the
alphanumeric name of the columns. Does anyone have any suggestions?
Sincerely,
Betty
--
Betty Gilbert
lgilbert@berkeley.edu
Taylor Lab
Plant and Microbial Biology
321 Koshland Hall
U.C. Berkeley
Berkeley, Ca 94720
[[alternative HTML version deleted]]