Unweighted Unifrac looks weird

Dear all,

I have a question for you. I generated a beta diversity emperor in two different environments: in QIIME2 (2024.2) and in R. Despite for Bray-Curtis, Jaccard and Weighted Unifrac the plot is basically the same, there is a strange result for Unweighted Unifrac using R. I want to ask you for any suggestions what can be a cause of that.

unweighted_unifrac_emperor.qzv (980.5 KB)

Here is a script for R:

ps <- qza_to_phyloseq(
  features = paste0('/../../../analysis/',project_name,'/processing_data/qiime2_analysis/nb_classifier/filtered-table.qza'),
  tree = paste0('/../../../analysis/',project_name,'/processing_data/qiime2_analysis/diversity/phylogeny/rooted-tree.qza'), 
  metadata = paste0('/../../../analysis/',project_name,'/manifest_metadata/metadata.tsv'), 
  taxonomy = paste0('/../../../analysis/',project_name,'/processing_data/qiime2_analysis/nb_classifier/classified-rep-seqs.qza'))

ord = ordinate(ps, method="PCoA", distance = "uunifrac")

uunifrac <- plot_ordination(ps, ord, color = condition) + 
  geom_point(size = 4) + 
  stat_ellipse(aes_string(group = condition)) +
  ggtitle("Unweighted Unifrac") +
  scale_color_manual(values = allGroupsColors) +
  theme_classic(20) +
  theme(plot.title = element_text(color = "black", 
                                  size = 25, 
                                  hjust = 0.5,
                                  face = "bold"))

Do you have any ideas ?

Thank you very much!


Thank you for sharing your full graph and code!

I think you have found this bug in Phyloseq's UniFrac calculation:

You can calculate this distance in Qiime2, then import it into R.
Or use one of the R packages and does not have this bug, like rbiom

1 Like