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/
567 stars 187 forks source link

How to filter out ASVs on a per-sample basis, based on some relative abundance threshold? #1722

Open J-W-Romero opened 5 months ago

J-W-Romero commented 5 months ago

Hello,

I suspect there is a simple solution to this question but I have struggled to figure it out, and have not found exactly what I'm looking for after some searching.

I want to filter out ASVs from each sample in my phyloseq object that do not meet a relative abundance threshold, i.e. for each sample in my object, remove all ASVs that individually make up <1% of the total reads in that sample. It would also be helpful to record or display what proportion of each sample this filtered-out group of ASVs makes up (e.g., do all the ASVs removed by this filtering comprise 5% of total sample reads? 10%? etc.).

I have tried some of the examples using genefilter_sample and filterfun_sample but I must be overlooking something.

Thanks in advance for any suggestions or examples to follow.