david-barnett / microViz

R package for microbiome data visualization and statistics. Uses phyloseq, vegan and the tidyverse. Docker image available.
https://david-barnett.github.io/microViz/
GNU General Public License v3.0
101 stars 11 forks source link

phylogenetic tree disappeared after tax_transform() step #143

Closed Leran10 closed 4 months ago

Leran10 commented 6 months ago

Hi,

I'm trying to plot ordination plot, so I used the below code:

ps0 %>%
  tax_fix() %>%
  phyloseq_validate() %>%
  tax_transform("clr", rank = "Genus") %>%
  dist_calc(dist = "wunifrac") %>%
  ord_calc(constraints = c("male", "smoke", "antibiotic_use")) %>%
  ord_plot(color = "diagnosis_mod", plot_taxa = 1:5, size = 2)

However I got the error message said:

Error in access(physeq, "phy_tree", errorIfNULL) : 
  phy_tree slot is empty

I found that after tax_transform() step, the phy_tree slot gone.

Any idea about this?

Thanks! Leran

david-barnett commented 6 months ago

Hi Leran

After aggregation at genus level, the features in the aggregated otu table no longer match the phylogenetic tree tip labels. So the phylogenetic tree is discarded intentionally.

So, you cannot aggregate abundances by taxonomy before using unifrac distances.

Cheers David

david-barnett commented 4 months ago

assuming this issue is resolved, feel free to open new issue if not :)