METATETARD - Transmission experiment

Displaying the results of a simple analysis

# Warning turned off for rendering

library(ggplot2)
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Folders, Themes, colors
source("prelude.R")

# Setting up directories
data_dir <- paste0(data_dir_path,"xptransmission")
output_dir <- paste0(output_dir_path,"Figure6_transmission")
setwd(data_dir)

tt<-read.table("table_transmission.csv",header=TRUE,sep=";")
tt <- tt %>% as_tibble(tt)
# This table presents the number of OTUs filtered with a minimum abundance and their occurence in the different samples
DT::datatable(tt)
tt3<- tt %>% gather("Both.parents","Mother.only","Father.only","Eggs.only",key="Category",value="Nb.OTUs")
setwd(output_dir)
ggplot(tt3,aes(x=Cross,y=Nb.OTUs,fill=reorder(Category,Nb.OTUs)))+geom_bar(stat="identity",color="black",size=0.2)+facet_wrap(~Min.Abundance)+theme_npgray()+theme(axis.text.x=element_text(size=9),strip.background=element_rect(fill="white",size=1,colour="black"))+scale_fill_manual(name="Transmission",values=c("#ca0020","#f4a582","#92c5de","#0571b0"),limits=c("Eggs.only","Mother.only","Father.only","Both.parents"),labels=c("Eggs","Female","Male","M+F"))

# This plot represent the number of OTUs of a given minimal abundance (1, 5, 10, 50) and their occurences in eggs only (red), female and eggs (orange), male and eggs (light blue),  male and female and eggs (dark blue). The majority of OTUs found in eggs are also found in feces or skin samples of both parents.
# Saving plot to pdf file
ggsave("plot_tt.pdf",width=20,height=15,units="cm",dpi="print")