Commit 21fedf48 authored by magali's avatar magali
Browse files

nouvelle figure stats family

parent 6a3eef90
Pipeline #48326 failed with stage
in 7 minutes and 9 seconds
......@@ -211,7 +211,7 @@ p <- plot_composition(frogs.data, "Kingdom", "Bacteria", "Phylum",numberOfTaxa =
p<- p + facet_wrap(~Group, scales = "free_x", nrow = 1) +
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Phylum Composition")
p <- p + ggtitle("Phylum Composition")+ theme(legend.text = element_text(size=12))
plot(p)
```
......@@ -484,13 +484,13 @@ Le nombre d'étoiles codent le niveau de significativité, les comparaisons non-
```{r 08-Family stats,fig.width=12,fig.height=8, eval = TRUE}
```{r 08-Family stats,fig.width=14,fig.height=11, eval = TRUE}
#Select groups
frogs.data_quat <- subset_samples(frogs.data, Group %in% c("STDD-H2O","HFD-H2O","HFD-AB"))
## Select only some families
families <- c("Bacteroidaceae","Bacteroidales S24-7 group", "Clostridiales vadinBB60 group", "Desulfovibrionaceae","Lachnospiraceae" , "Porphyromonadaceae", "Prevotellaceae", "Rikenellaceae","Ruminococcaceae", "Streptococcaceae")
families <- c("Bacteroidaceae","Bacteroidales S24-7 group", "Clostridiales vadinBB60 group", "Desulfovibrionaceae","Lachnospiraceae" , "Porphyromonadaceae", "Prevotellaceae", "Rikenellaceae","Ruminococcaceae", "Streptococcaceae","Erysipelotrichaceae", "Christensenellaceae", "Enterococcaceae")
phy <- frogs.data_quat %>% subset_taxa(Family %in% families) %>% tax_glom(taxrank="Family") #agglomerate at family level
## Transform count to relative abundances
......@@ -517,9 +517,49 @@ p <- p + stat_compare_means(aes(label = ..p.signif..), method = "wilcox.test", p
label.y.npc = c(0.90),
size = 7,
fontface = "bold")
p <- p + theme(strip.text.x = element_text(size = 12))
plot(p)
```
```{r 08-Family stats bis,fig.width=6,fig.height=7, eval = TRUE}
#Select groups
frogs.data_cinq <- subset_samples(frogs.data, Group %in% c("STDD-H2O","HFD-H2O","HFD-AB"))
## Select only some families
families <- c("Rikenellaceae", "Bifidobacteriaceae","Erysipelotrichaceae", "Streptococcaceae")
phy <- frogs.data_cinq %>% subset_taxa(Family %in% families) %>% tax_glom(taxrank="Family") #agglomerate at family level
## Transform count to relative abundances
depth <- sample_sums(frogs.data_cinq)[1]
plotdata<-psmelt(phy) %>%
mutate(Abundance = Abundance / depth,
Group = factor(Group, labels = c("STDD-H2O","HFD-H2O","HFD-AB")))
p <- ggplot(plotdata,aes(x = Group,y=Abundance, color = Group, Group = Group, fill = Group)) +
stat_boxplot(geom = "errorbar", width = 0.5) +
geom_boxplot(outlier.alpha = 1,
outlier.size = 0.8) +
facet_wrap(~Family, scales = "free_y", ncol = 2) +
scale_color_manual(values = c("STDD-H2O" = "#f1948a", "HFD-H2O" = "#52be80", "HFD-AB" = "#f7dc6f"), guide = "none") +
# theme_classic() + ## fond blanc
labs(x = NULL)+ theme_classic() +
scale_fill_manual(breaks = c("STDD-H2O","HFD-H2O","HFD-AB"),
values=c("#f1948a","#52be80","#f7dc6f"))+ theme(axis.text.x = element_blank())
## Compare reference level T0 to all other levels using a wilcoxon test and adjust p-values using the holm correction.
p <- p + stat_compare_means(aes(label = ..p.signif..), method = "wilcox.test", p.adjust.method = "holm", ref.group = "STDD-H2O", hide.ns = T,
label.y.npc = c(0.90),
size = 7,
fontface = "bold")
p <- p +
theme(strip.text.x = element_text(size = 14))
plot(p)
```
##### Kruskal test
Test de Kruskal (Anova non paramétrique) pour chaque Family pour tester si les abondances sont similaires (pour la Family) entre les différents groupes.
......@@ -708,7 +748,7 @@ p <- plot_composition(frogs.data, "Phylum", "Actinobacteria", "Family",numberOfT
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Actinobacteria")
p <- p + ggtitle("Composition within Actinobacteria")+ theme(legend.text = element_text(size=12))
plot(p)
```
......@@ -734,7 +774,7 @@ p <- plot_composition(frogs.data, "Phylum", "Bacteroidetes", "Family",numberOfTa
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Bacteroidetes")
p <- p + ggtitle("Composition within Bacteroidetes")+ theme(legend.text = element_text(size=12))
plot(p)
```
......@@ -760,11 +800,33 @@ p <- plot_composition(frogs.data, "Phylum", "Firmicutes", "Family",numberOfTaxa
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Firmicutes")
p <- p + ggtitle("Composition within Firmicutes")+ theme(legend.text = element_text(size=12))
plot(p)
```
```{r 17bis-composition-firmicutes,fig.width=9,fig.height=5, eval=TRUE}
library(paletteer)
p <- plot_composition(frogs.data, "Phylum", "Firmicutes", "Family",numberOfTaxa = 10, fill = "Family")
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Firmicutes") + scale_fill_paletteer_d("ggthemes::gdoc")+ theme(legend.text = element_text(size=12))
plot(p)
```
```{r 17ter-composition-firmicutes,fig.width=9,fig.height=5, eval=TRUE}
library(paletteer)
p <- plot_composition(frogs.data, "Phylum", "Firmicutes", "Family",numberOfTaxa = 10, fill = "Family")
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Firmicutes") + scale_fill_paletteer_d("ggthemes::calc")+ theme(legend.text = element_text(size=12))
plot(p)
```
```{r 17.2-composition-firmicutes,fig.width=9,fig.height=5, eval=TRUE}
p <- plot_composition(frogs.data, "Phylum", "Firmicutes", "Family",numberOfTaxa = 15, fill = "Family")
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
......@@ -797,7 +859,7 @@ p <- plot_composition(frogs.data, "Phylum", "Proteobacteria", "Family",numberOfT
p <- p + facet_wrap(~Group, scales = "free_x", nrow = 1)+
theme(strip.text.x = element_text(size = 14, color = "black")) +
scale_y_continuous(label = scales::percent)+ theme(axis.text.x = element_blank())
p <- p + ggtitle("Composition within Proteobacteria")
p <- p + ggtitle("Composition within Proteobacteria")+ theme(legend.text = element_text(size=12))
plot(p)
```
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment