How to visualize taxonomic data based on mean relative abundance?
0
0
Entering edit mode
2.1 years ago
Amr ▴ 180

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 • 924 views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Would this work?

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

Login before adding your answer.

Traffic: 2445 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6