adw96 / DivNet

diversity estimation under ecological networks
83 stars 18 forks source link

full phyloseq object and otu_table give different results #44

Closed adw96 closed 4 years ago

adw96 commented 4 years ago

Probably something to do with how otu_table are transposed by default

library(devtools)
library(tidyverse)
library(phyloseq)
install_github("adw96/DivNet")
library(DivNet)
packageVersion("DivNet") # 0.3.2

data("GlobalPatterns")
# since this is just an illustration, just get the most abundant 5 taxa
top_five_taxa = names(sort(taxa_sums(GlobalPatterns), decreasing = TRUE)[1:5])

# don't specify covariates
dv <- GlobalPatterns %>% prune_taxa(top_five_taxa, .) %>% divnet 
dv$fitted_z 

# this explicitly strips the sample_data
dv2 <- GlobalPatterns %>% prune_taxa(top_five_taxa, .) %>% otu_table %>% divnet 
dv2$fitted_z