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

tax_glom problem #1606

Open aff30 opened 2 years ago

aff30 commented 2 years ago

Hi,

I am working on this filtering step of a microbiome data and when I am using the tax_glom I am losing taxa. psf3 <- psf3 %>% tax_fix(unknowns = c("Incertae Sedis")) # When I check the phyloseq object before the tax_glom I have the following:

phyloseq-class experiment-level object otu_table() OTU Table: [ 12430 taxa and 717 samples ] sample_data() Sample Data: [ 717 samples by 2 sample variables ] tax_table() Taxonomy Table: [ 12430 taxa by 6 taxonomic ranks ]

psf3 <- tax_glom(psf3, "Genus") #I am losing taxa in this step #why? after using the tax_glom, I get that:

phyloseq-class experiment-level object otu_table() OTU Table: [ 270 taxa and 717 samples ] sample_data() Sample Data: [ 717 samples by 2 sample variables ] tax_table() Taxonomy Table: [ 270 taxa by 6 taxonomic ranks ]

Then, when I try to check the taxa_sums or do any other step, I get:

taxa_sums(pst) Error in access(object, "otu_table", errorIfNULL) : otu_table slot is empty.

Could you please help me with that? Thank you so much!

gmteunisse commented 2 years ago

I assume that you are losing some taxa (and their counts) in tax_glom because you haven't set NArm = F. In any case, you expect to have less taxa after tax_glom, as it merges taxa at a specified taxonomic rank - perhaps you have very few Genus annotations in your data?

Lastly, you use taxa_sums(pst) in your example, but your data is called psf3. Does this resolve your error?