Hi all, I need to analyze some metagenomic data from microbiome in human in two conditions: antibiotics and non antibiotics. I have two data set, one abundance table and one ID table (with ID and treatment: antibiotic/non antibiotic).
#abundance table:
df
name ssp1 ssp2 ssp3 ssp4
1 0 0.002 0 0.002
2 0 0.0006 0 0
3 0 0.0007 0 0.005
4 0 0.009 0 0.0002
5 0 4E-05 0 2E-05
6 0 6E-05 0 0 0
I generated a shanon diversity table :
shannon=diversity(df, "shannon")
df_shanon <- data.frame(sample=names(shannon),value=shannon,measure=rep("Shannon", length(shannon)))
and I added the group so it looks like:
name group value
1 antibiotic 1.2926065
2 non_antibiotic 1.1550706
3 non_antibiotic 0.9115583
4 non_antibiotic 1.4000118
5 antibiotic 1.2459668
6 antibiotic 1.3967217
I wold like to generate a kind of abundance plot considering the two groups. I found plot_richness()
quite interesting but I do not have a phyloseq
object. Can someone give me a hand on this?
Thanks!
Thank you very much for your advise, but as in my data frame
df
thename
is thecol.names
I do not have to remove the first col (if I do that, I'll miss the information for thessp1
. However, what is themeasure
variable?That makes sense (that the name column in your
df
is thecol.names
). Themeasure
variable is missing in thedf
. Sorry! You just need to add a column with a character variable sayingShannon
for all the observations and you can give as column namemeasure
.Try that and please let me know if it worked.
Cheers, António