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

filter_taxa after tax_glom #1711

Open chrissy005 opened 11 months ago

chrissy005 commented 11 months ago

Hello,

I am trying to filter out genera that have relative abundances less than 10% after collapsing the ASVs into Genus using tax_glom. I am attempting to do this as follows:

1.subset core genera of interest

core.95prev.int <- com.rarefied.min.int.exclude.1.3.rooted %>% subset_taxa(Genus %in% core.genus.all.clusters.95.tosub)

2. Collapse ASVs at the genus level

core.95prev.int.genus <- tax_glom(core.95prev.int, taxrank = "Genus")

3. filter for relative abundances > 10%

total sample_sums(core.95prev.int.genus)

core.95prev.int.genus.exc10 = filter_taxa(core.95prev.int.genus, function(x) sum(x > total*0.10) > 0,TRUE)

While I had no troubles with 1 and 2, 3 results in the following error: Error: Unsupported class: phyloseq

Does this mean that it is not possible to apply this filtering step after a tax_glom?

How could I possibly filter a phyloseq after tax_glom?