joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
582 stars 187 forks source link

PCoA in phyloseq and #1266

Open SgtVil opened 4 years ago

SgtVil commented 4 years ago

Hello dear bioinformaticians colleagues, I have encountered something "weird", I'm using both ade4 and plot_ordination in my routine, and just found out that ord(physeq) and dudi.pco(psmelt(physeq)) don't give the same eigenvalues.

In my example : dist.MCS= distance(MCS, "bray") ord.MCS= ordinate(MCS, dist.MCS, method = "PCoA") plot_ordination(ord.MCS, physeq = MCS, color = "Protocol") plot_scree(ord.MCS)

image

and then with ade4 : PCoA_final = vegdist(data.frame(MCS_all[-15,6:13]), method = "bray")%>% dudi.pco(., scannf = F) ; screeplot(PCoA_final) PCoA_final$eig [1] 4.287225e-02 2.893476e-03 6.300411e-04 3.046212e-04 1.480106e-04 5.491330e-05 3.615130e-05 2.550372e-05 [9] 1.645926e-05 6.421314e-06 return image

and if I'm using betadisper in vegan with the same distance matrix i get Eigenvalues for PCoA axes: (Showing 8 of 17 eigenvalues) PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 0.6571192 0.0363443 0.0055128 0.0028974 0.0020176 0.0013222 0.0007222 0.0004615

I'm guessing it's normal but I'm wondering which value am I suppose to use ? It's also possible that I'm mixing up eigenvalues, inertia (from screeplot results) and axis % in plot_ordination.

Thanks for your time and help.

Of note, PCoA plots return the same infos in term of coordinate.

SgtVil commented 4 years ago

Update :

I found that Axis% is actually Eigenvalue(i)/sum(Eigenvalue), and it actually makes sens. So betadisper and your function give the same values. However, ade4 doesn't give the same