Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
#I then need to add up GP and VG strains seperately
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Repeate for VG
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#
#Lets join the three datasets back together
#Barcoding_othersGP$Experiment <- recode_factor(Barcoding_othersGP$Experiment, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Experiment
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
#Barcoding_othersVG$Experiment <- recode_factor(Barcoding_othersVG$Experiment, "VG" = "VG","GP" = "VG")
Strain <- Barcoding_othersVG$Experiment
Barcoding_othersVG <- cbind(Strain, Barcoding_othersVG)
Barcoding_others <- rbind(Barcoding_othersVG, Barcoding_othersGP)
#colnames(Barcoding_others)[1]  <- ('Strain')
Barcoding_others$Strain <- recode_factor(Barcoding_others$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_Simplified <- rbind(Barcoding_abundant, Barcoding_others)
nrow(Barcoding_abundant)
nrow(Barcoding_others)
nrow(Barcoding_Simplified)
#Subselect C samples for VG
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Population))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
View(Barcoding_othersGP)
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
View(Barcoding_othersGP)
#
#Lets join the three datasets back together
Barcoding_othersGP$Experiment <- recode_factor(Barcoding_othersGP$Experiment, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Experiment
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
Barcoding_othersGP$Population <- recode_factor(Barcoding_othersGP$Population, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Population
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
Barcoding_othersVG$Population <- recode_factor(Barcoding_othersVG$Population, "VG" = "VG","GP" = "VG")
Strain <- Barcoding_othersVG$Population
Barcoding_othersVG <- cbind(Strain, Barcoding_othersVG)
Barcoding_others <- rbind(Barcoding_othersVG, Barcoding_othersGP)
#colnames(Barcoding_others)[1]  <- ('Strain')
Barcoding_others$Strain <- recode_factor(Barcoding_others$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_Simplified <- rbind(Barcoding_abundant, Barcoding_others)
nrow(Barcoding_abundant)
nrow(Barcoding_others)
nrow(Barcoding_Simplified)
#Subselect C samples for VG
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Population))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
View(Barcoding_others)
View(VG_C)
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
View(VG_C)
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Population))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
#I then need to add up GP and VG strains seperately
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Repeate for VG
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
View(Barcoding_othersGP)
Barcoding_othersGP$Population <- recode_factor(Barcoding_othersGP$Population, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Population
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
View(Barcoding_othersGP)
Barcoding_othersGP$Strain <- recode_factor(Barcoding_othersGP$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
#I then need to add up GP and VG strains seperately
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Repeate for VG
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#
#Lets join the three datasets back together
Barcoding_othersGP$Population <- recode_factor(Barcoding_othersGP$Population, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Population
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
Barcoding_othersGP$Strain <- recode_factor(Barcoding_othersGP$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_othersVG$Population <- recode_factor(Barcoding_othersVG$Population, "VG" = "VG","GP" = "VG")
Strain <- Barcoding_othersVG$Population
Barcoding_othersVG <- cbind(Strain, Barcoding_othersVG)
Barcoding_othersVG$Strain <- recode_factor(Barcoding_othersVG$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_others <- rbind(Barcoding_othersVG, Barcoding_othersGP, Barcoding_abundant)
Barcoding_Simplified <- rbind(Barcoding_othersVG, Barcoding_othersGP, Barcoding_abundant)
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
View(VG_C)
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "#B85633", "brown", "darkgoldenrod1", "deeppink"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
#Change order of strains factor
Barcoding_Simplified$Strain <- factor(Barcoding_Simplified$Strain, levels = c("GP2-4_40", "GP2-4_27", "GP2-4_57", "Other_GP", "VG1-2_103", "VG1-2_74", "VG1-2_81", "Other_VG"))
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
#Plot the data as pie-charts
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "brown", "darkgoldenrod1", "deeppink", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
"coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "brown", "darkgoldenrod1", "deeppink", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("Blue", "aquamarine", "darkmagenta", "gray14", "brown", "darkgoldenrod1", "deeppink", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=9)) +
theme(text=(element_text(size=10))) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=20)) +
theme(text=(element_text(size=20))) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=20)) +
theme(text=(element_text(size=20))) +
theme(axis.text=(element_text(size=20, colour = "Black"))) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=20)) +
theme(text=(element_text(size=20))) +
theme(axis.text=(element_text(size=20, colour = "Black"))) +
theme(legend.title=element_text(size=20)) +
theme_void()
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=20)) +
theme(text=(element_text(size=20))) +
theme(axis.text=(element_text(size=20, colour = "Black"))) +
theme(legend.title=element_text(size=20))
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme(legend.text=element_text(size=10)) +
theme(text=(element_text(size=10))) +
theme(axis.text=(element_text(size=10, colour = "Black"))) +
theme(legend.title=element_text(size=10))
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
VG_Cu <- subset.data.frame(Barcoding_Simplified, grepl('Copper', Barcoding_Simplified$Treatment))
VG_Cu <- subset.data.frame(VG_Cu, grepl('VG', VG_Cu$Experiment))
VG_Cu <- subset.data.frame(VG_Cu, !grepl('RO5AC', VG_Cu$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_Cu, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_Cu.pdf")
dev.off()
Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
#Need to clone start values to Cu
Clone1 <- subset.data.frame(Barcoding_abundant, grepl('0', Barcoding_abundant$Timepoint))
Clone1$Treatment <- recode_factor(Clone0$Treatment, "Control" = "Copper")
Barcoding_abundant <- rbind(Barcoding_abundant, Clone1)
#I then need to add up GP and VG strains seperately
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Repeate for VG
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#
#Lets join the three datasets back together
Barcoding_othersGP$Population <- recode_factor(Barcoding_othersGP$Population, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Population
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
Barcoding_othersGP$Strain <- recode_factor(Barcoding_othersGP$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_othersVG$Population <- recode_factor(Barcoding_othersVG$Population, "VG" = "VG","GP" = "VG")
Strain <- Barcoding_othersVG$Population
Barcoding_othersVG <- cbind(Strain, Barcoding_othersVG)
Barcoding_othersVG$Strain <- recode_factor(Barcoding_othersVG$Strain, "VG" = "Other_VG","GP" = "Other_GP")
#Merge all 3 df
Barcoding_Simplified <- rbind(Barcoding_othersVG, Barcoding_othersGP, Barcoding_abundant)
#Change order of strains factor
Barcoding_Simplified$Strain <- factor(Barcoding_Simplified$Strain, levels = c("GP2-4_40", "GP2-4_27", "GP2-4_57", "Other_GP", "VG1-2_103", "VG1-2_74", "VG1-2_81", "Other_VG"))
#colnames(Barcoding_others)[1]  <- ('Strain')
#Barcoding_others$Strain <- recode_factor(Barcoding_others$Strain, "VG" = "Other_VG","GP" = "Other_GP")
#Barcoding_Simplified <- rbind(Barcoding_abundant, Barcoding_others)
#nrow(Barcoding_abundant)
#nrow(Barcoding_others)
#nrow(Barcoding_Simplified)
#Subselect C samples for VG
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
#Subselect C samples for VG
VG_Cu <- subset.data.frame(Barcoding_Simplified, grepl('Copper', Barcoding_Simplified$Treatment))
VG_Cu <- subset.data.frame(VG_Cu, grepl('VG', VG_Cu$Experiment))
VG_Cu <- subset.data.frame(VG_Cu, !grepl('RO5AC', VG_Cu$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_Cu, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_Cu.pdf")
dev.off()
#First i want to add up all strains that are irrelevant (i.e. low abundat in each population)
#GP2-4_40, GP2-4_27, GP2-4_57, VG1-2_103, VG1-2_74, VG1-2_81
Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Clone1 <- subset.data.frame(Barcoding_abundant, grepl('0', Barcoding_abundant$Timepoint))
Clone1$Treatment <- recode_factor(Clone0$Treatment, "Control" = "Copper")
Barcoding_abundant <- rbind(Barcoding_abundant, Clone1)
View(Clone0)
View(Clone1)
Barcoding_abundant <- subset.data.frame(Barcoding, grepl('GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
#I then need to add up GP and VG strains seperately
Barcoding_othersGP <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersGP <- subset.data.frame(Barcoding_othersGP, grepl('^GP', Barcoding_othersGP$Strain))
#Sum up the others by population
Barcoding_othersGP <- ddply(Barcoding_othersGP, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Repeate for VG
#I then need to add up GP and VG strains seperately
Barcoding_othersVG <- subset.data.frame(Barcoding, !grepl('RO5AC|GP2-4_40|GP2-4_27|GP2-4_57|VG1-2_103|VG1-2_74|VG1-2_81', Barcoding$Strain))
Barcoding_othersVG <- subset.data.frame(Barcoding_othersVG, grepl('^VG', Barcoding_othersVG$Strain))
#Sum up the others by population
Barcoding_othersVG <- ddply(Barcoding_othersVG, c("Experiment", "Treatment", "Population", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#Lets mock do the same for the abundant once to get the same format on the dataframes
Barcoding_abundant <- ddply(Barcoding_abundant, c("Strain", "Experiment", "Population", "Treatment", "Timepoint", "Replicate"), summarise,
Relative_abundance = sum(Relative_abundance))
#
#Lets join the three datasets back together
Barcoding_othersGP$Population <- recode_factor(Barcoding_othersGP$Population, "VG" = "GP","GP" = "GP")
Strain <- Barcoding_othersGP$Population
Barcoding_othersGP <- cbind(Strain, Barcoding_othersGP)
Barcoding_othersGP$Strain <- recode_factor(Barcoding_othersGP$Strain, "VG" = "Other_VG","GP" = "Other_GP")
Barcoding_othersVG$Population <- recode_factor(Barcoding_othersVG$Population, "VG" = "VG","GP" = "VG")
Strain <- Barcoding_othersVG$Population
Barcoding_othersVG <- cbind(Strain, Barcoding_othersVG)
Barcoding_othersVG$Strain <- recode_factor(Barcoding_othersVG$Strain, "VG" = "Other_VG","GP" = "Other_GP")
#Merge all 3 df
Barcoding_Simplified <- rbind(Barcoding_othersVG, Barcoding_othersGP, Barcoding_abundant)
#Change order of strains factor
Barcoding_Simplified$Strain <- factor(Barcoding_Simplified$Strain, levels = c("GP2-4_40", "GP2-4_27", "GP2-4_57", "Other_GP", "VG1-2_103", "VG1-2_74", "VG1-2_81", "Other_VG"))
#Need to clone start values to Cu
Clone1 <- subset.data.frame(Barcoding_Simplified, grepl('0', Barcoding_Simplified$Timepoint))
Clone1$Treatment <- recode_factor(Clone0$Treatment, "Control" = "Copper")
Barcoding_Simplified <- rbind(Barcoding_Simplified, Clone1)
#colnames(Barcoding_others)[1]  <- ('Strain')
#Barcoding_others$Strain <- recode_factor(Barcoding_others$Strain, "VG" = "Other_VG","GP" = "Other_GP")
#Barcoding_Simplified <- rbind(Barcoding_abundant, Barcoding_others)
#nrow(Barcoding_abundant)
#nrow(Barcoding_others)
#nrow(Barcoding_Simplified)
#Subselect C samples for VG
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
#Subselect C samples for VG
VG_Cu <- subset.data.frame(Barcoding_Simplified, grepl('Copper', Barcoding_Simplified$Treatment))
VG_Cu <- subset.data.frame(VG_Cu, grepl('VG', VG_Cu$Experiment))
VG_Cu <- subset.data.frame(VG_Cu, !grepl('RO5AC', VG_Cu$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_Cu, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_Cu.pdf")
dev.off()
Barcoding_Simplified <- rbind(Barcoding_othersVG, Barcoding_othersGP, Barcoding_abundant)
#Change order of strains factor
Barcoding_Simplified$Strain <- factor(Barcoding_Simplified$Strain, levels = c("GP2-4_40", "GP2-4_27", "GP2-4_57", "Other_GP", "VG1-2_103", "VG1-2_74", "VG1-2_81", "Other_VG"))
#Need to clone start values to Cu
Clone1 <- subset.data.frame(Barcoding_Simplified, grepl('0', Barcoding_Simplified$Timepoint))
Clone1$Treatment <- recode_factor(Clone1$Treatment, "Control" = "Copper")
Barcoding_Simplified <- rbind(Barcoding_Simplified, Clone1)
#colnames(Barcoding_others)[1]  <- ('Strain')
#Barcoding_others$Strain <- recode_factor(Barcoding_others$Strain, "VG" = "Other_VG","GP" = "Other_GP")
#Barcoding_Simplified <- rbind(Barcoding_abundant, Barcoding_others)
#nrow(Barcoding_abundant)
#nrow(Barcoding_others)
#nrow(Barcoding_Simplified)
#Subselect C samples for VG
VG_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
VG_C <- subset.data.frame(VG_C, grepl('VG', VG_C$Experiment))
VG_C <- subset.data.frame(VG_C, !grepl('RO5AC', VG_C$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_C.pdf")
dev.off()
#Subselect C samples for VG
VG_Cu <- subset.data.frame(Barcoding_Simplified, grepl('Copper', Barcoding_Simplified$Treatment))
VG_Cu <- subset.data.frame(VG_Cu, grepl('VG', VG_Cu$Experiment))
VG_Cu <- subset.data.frame(VG_Cu, !grepl('RO5AC', VG_Cu$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(VG_Cu, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_VG_Cu.pdf")
dev.off()
#Subselect C samples for GP
GP_C <- subset.data.frame(Barcoding_Simplified, grepl('Control', Barcoding_Simplified$Treatment))
GP_C <- subset.data.frame(GP_C, grepl('GP', GP_C$Experiment))
GP_C <- subset.data.frame(GP_C, !grepl('RO5AC', GP_C$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(GP_C, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_GP_C.pdf")
dev.off()
#Subselect C samples for GP
GP_Cu <- subset.data.frame(Barcoding_Simplified, grepl('Copper', Barcoding_Simplified$Treatment))
GP_Cu <- subset.data.frame(GP_Cu, grepl('GP', GP_Cu$Experiment))
GP_Cu <- subset.data.frame(GP_Cu, !grepl('RO5AC', GP_Cu$Population))
#Plot the data as bar or pie-charts (coord_polar)
ggplot(GP_Cu, aes(x = "", y = Relative_abundance, fill = Strain)) +
geom_col() +
#coord_polar(theta = "y") +
scale_color_manual(values=c("#2166AC", "#4393C3", "#92C5DE", "gray14", "#B2182B", "#D6604D", "#F4A582", "#B85633"), aesthetics = c("colour", "fill")) +
facet_grid(rows = vars(Timepoint), cols = vars(Replicate)) +
theme_void()
dev.copy(pdf, "Plots/Fig_GP_Cu.pdf")
dev.off()
