This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to visualize taxonomic data based on mean relative abundance?

How to visualize taxonomic data based on mean relative abundance?

This code visualize the data but I want to visualize based on the mean relative abundance > 1% in all samples

dat2 %>% ggplot(aes (x = sample,y = count))+ geom_bar(aes (fill=sample), stat = "identity",position = "fill")

Thanks

relative_abundance taxa.mean.plot mean_relative_abundance ggplot2 taxonomic

I'm not sure I totally understand, but if count = mean relative abundance, then you can use dplyr to filter for count > 1% as follows:

dat3 = dat2 %>%
     filter(count > 1)

You can then continue with ggplot2.

No because relative abundance is to take the percentage of every count among all counts for example: if we have 3 samples sample1 = 5 , sample 2 = 10, and sample 3 = 12 then their relative abundance for sample 1 will be (5/5+2+10), for sample 2 will be 10/5+10+12 and for sample 3 will be 12/12+5+10

Would this work?

dat3 = dat2 %>%
     mutate(MRA = count/(sum(count)) %>%
     filter(MRA > .01)

0 answers

No answers yet.

Log in to answer this question.