library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
View(qpcr2b)
# exclude egg sample L5 because meltcurve indicated low quality sample
qpcr2b <- qpcr2b[!qpcr2b$Description == "L5", ]
View(qpcr2b)
qpcr.egg2 <- rbind(qpcr2a, qpcr2b)
qpcr.egg2 <- subset(qpcr.egg2, Type == "eggs")
qpcr.egg2$Description <- droplevels(qpcr.egg2$Description)
qpcr <- read.delim("./input_data/Ch3_qPCR_data2.txt", header = T)
ps <- readRDS("./phyobjects/ps.rds")
# split original data
qpcr2 <- qpcr
qpcr2a <- subset(qpcr2, Include == TRUE)
qpcr2b <- subset(qpcr2, Include == FALSE)
# impute negative samples to copy number 1 /g sample, and log(1)=0
qpcr2b$DNAcopies_gFM <- 1
qpcr2b$logDNA_gFM <- 0
# exclude egg sample L5 because meltcurve indicated low quality sample
qpcr2b <- qpcr2b[!qpcr2b$Description == "L5", ]
# merge revised data
qpcr2 <- rbind(qpcr2a, qpcr2b)
qpcr2 <- subset(qpcr2, Type != "eggs") # exclude eggs samples (7)
qpcr2 <- subset(qpcr2, Timepoint != 30) # exclude pilot samples (2)
qpcr2 <- subset(qpcr2, Timepoint != 22) # exclude CF LnDs t=22 (3)
qpcr2 <- subset(qpcr2, !Description %in% c("26.K","39.M"))
qpcr2$Description <- droplevels(qpcr2$Description)
qpcr2 <- qpcr2[,-c(2:6,9)]
# meta data
qpcr.meta <- meta(ps)
qpcr.meta1 <- subset(qpcr.meta, Description %in% qpcr2$Description)
# merge qPCR and meta data
qpcr2 <- merge(qpcr.meta1, qpcr2, by = "Description")
qpcr2$Treatment <- droplevels(qpcr2$Treatment)
qpcr2$Type <- droplevels(qpcr2$Type)
qpcr2$Timepoint <- droplevels(qpcr2$Timepoint)
# remove isolation duplicates
qpcr2 <- subset(qpcr2, Duplicate == "no")
# exclude containers 6 and 7 because contaminated by fungal overgrowth.
qpcr2 <- subset(qpcr2, !ContainerID %in% c("6","7"))
# subset per diet
qpcr.s <- qpcr2[, c("ContainerID", "Diet", "Treatment", "Timepoint", "Type","logDNA_gFM")]
## chicken feed substrates
qpcr.cf0 <- subset(qpcr.s, Diet == "CF" & Timepoint == 0 & Treatment != "Ss/E")
qpcr.cf0$Treatment <- droplevels(qpcr.cf0$Treatment)
## chicken feed day 15
qpcr.cf <- subset(qpcr.s, Diet == "CF" & Timepoint == 15 & Treatment != "Ss/E")
qpcr.cf$Treatment <- droplevels(qpcr.cf$Treatment)
## chicken manure
qpcr.cm0 <- subset(qpcr.s, Diet == "CM" & Timepoint == 0)
qpcr.cm <- subset(qpcr.s, Diet == "CM" & Timepoint == 15)
# summarise data: mean, sd, se
qpcr.m <- reshape2::melt(qpcr.s)
qpcr.sum <- ddply(qpcr.m, .(Diet, Treatment, Type, Timepoint, variable),
summarise, mean = mean(value), sd = sd(value),
se = se(value), n = length(value))
qpcr.sum$group2 <- interaction(qpcr.sum$Diet, qpcr.sum$Treatment,
qpcr.sum$Type, qpcr.sum$Timepoint, drop = T)
theme_qpcr <- theme_classic() +
theme(panel.grid.major = element_line(colour = "grey80"),
panel.spacing = unit(.5,"lines"),
panel.border = element_rect(color = "black", fill = NA, size = .5),
strip.background = element_blank(),
strip.placement = "outside",
text = element_text(size=15))
labs_qpcr <- as_labeller(c(
"0" = "day 0", "15" = "day 15",
CF = "chicken feed", CM = "chicken manure"))
qpcr.egg2 <- rbind(qpcr2a, qpcr2b)
qpcr.egg2 <- subset(qpcr.egg2, Type == "eggs")
qpcr.egg2$Description <- droplevels(qpcr.egg2$Description)
# add meta data
qpcr.meta2 <- subset(qpcr.meta, Description %in% qpcr.egg2$Description)
qpcr.egg2 <- merge(qpcr.meta2, qpcr.egg2, by = "Description")
qpcr.egg2$Treatment <- droplevels(qpcr.egg2$Treatment)
qpcr.egg2$Treatment <- revalue(qpcr.egg2$Treatment,
c("E"="untreated", "Es" = "disinfected"))
qpcr.egg2 <- subset(qpcr.egg2, Duplicate == "no")
# summarise
qpcr.egg.s2 <- qpcr.egg2[,c("Treatment", "Block", "logDNA_gFM")]
qpcr.egg.m2 <- reshape2::melt(qpcr.egg.s2)
qpcr.egg.sum2 <- ddply(qpcr.egg.m2, .(Treatment, variable), summarise,
mean = mean(value), median = median(value),
sd = sd(value), se = se(value),
n = length(value))
View(qpcr.egg.sum2)
wilcox.test(qpcr.egg.m2$value ~ qpcr.egg.m2$Treatment)
Q.egg2 <- ggplot(data = qpcr.egg.m2, aes(x = Treatment, y = value, colour = Treatment)) +
geom_boxplot(size = .8, outlier.alpha = 0, col = "grey60") +
geom_point(position = position_jitter(width = 0.1, height = 0), col = "black") +
labs(y = "log(16S rRNA gene copies/ g FM)", x = "treatment") +
scale_y_continuous(limits = c(0, 10), n.breaks = 6) +
theme_qpcr + theme(legend.position = "none")
Q.egg2
ggsave(plot = Q.egg2, "./figures/Eggs_qPCR_boxplot_revised.png", w = 4, h = 6)
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
Q.eb
ggsave(plot = Q.eb, "./figures/qPCR_errorbar_revised.png", w = 10, h = 6)
ggsave(plot = Q.eb, "./figures/qPCR_errorbar_revised.pdf", h = 200, w = 320, u = "mm")
theme_qpcr <- theme_classic() +
theme(panel.grid.major = element_line(colour = "grey80"),
panel.spacing = unit(.5,"lines"),
panel.border = element_rect(color = "black", fill = NA, size = .5),
strip.background = element_blank(),
strip.placement = "outside",
text = element_text(size=20))
labs_qpcr <- as_labeller(c(
"0" = "day 0", "15" = "day 15",
CF = "chicken feed", CM = "chicken manure"))
Q.eb <- ggplot(qpcr.emm, aes(x = Treatment, y = emmean, group = Type)) +
geom_col(position = position_dodge(), aes(y=emmean), fill="white") +
geom_col(position = position_dodge(),
aes(y=emmean, fill=Treatment, alpha = Type), colour = "black") +
scale_fill_manual(values = c("#440154FF", "#31688EFF", "#35B779FF", "gold")) +
scale_alpha_manual(values = c(1,.3)) +
geom_errorbar(aes(ymin = emmean - SE, ymax = emmean + SE), width = .2,
position=position_dodge(width = .9)) +
labs(y = "log(16S rRNA gene copies/ g FM)", x = "treatment") +
scale_y_continuous(limits = c(0, 15), n.breaks = 4) +
facet_grid(Diet ~ Timepoint, labeller = labs_qpcr) +
theme_qpcr
Q.eb
ggsave(plot = Q.eb, "./figures/qPCR_errorbar_revised.png", w = 10, h = 6)
ggsave(plot = Q.eb, "./figures/qPCR_errorbar_revised.pdf", h = 200, w = 320, u = "mm")
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
Q.egg2 <- ggplot(data = qpcr.egg.m2, aes(x = Treatment, y = value, colour = Treatment)) +
geom_boxplot(size = .8, outlier.alpha = 0, col = "grey60") +
geom_point(position = position_jitter(width = 0.1, height = 0), col = "black") +
labs(y = "log(16S rRNA gene copies/ g FM)", x = "treatment") +
scale_y_continuous(limits = c(0, 10), n.breaks = 6) +
theme_qpcr + theme(legend.position = "none")
Q.egg2
ggsave(plot = Q.egg2, "./figures/Eggs_qPCR_boxplot_revised.png", w = 4, h = 6)
ggsave(plot = Q.egg2, "./figures/Eggs_qPCR_boxplot_revised.pdf", w = 160, h = 160, u = "mm")
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
View(qpcr.egg.m2)
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
anova(ph.gm0)
data.frame(anova(ph.gm0))
# model output
car::Anova(ph.gm1)
data.frame(car::Anova(ph.gm0))
View(mcors.sum)
View(mcors.sum3)
View(mcors.sum)
View(aov.cf)
View(cml.kw05)
# add omnibus test p-value to significant taxa from multiple comparisons
## between treatments of chicken manure
kw.cm.p <- subset(cml.kw05, select = 1:2, OTU %in% levels(cml.wx05$OTU))
rm(kw.cm.p)
# add omnibus test p-value to significant taxa from multiple comparisons
## between treatments of chicken manure
kw.cml.p <- subset(cml.kw05, select = 1:2, OTU %in% levels(cml.wx05$OTU))
View(kw.cml.p)
View(cml.wx05)
View(cm3.sig2)
cml.sig <- base::merge(kw.cml.p[,2], cm3.sig2[,c(1,17)], by = "OTU")
View(kw.cml.p)
cml.sig <- base::merge(kw.cml.p[,2], cm3.sig2[,c(1,17)], by = OTU)
cml.sig <- base::merge(kw.cml.p, cm3.sig2[,c(1,17)], by = "OTU")
View(cml.sig)
cml.sig <- base::merge(kw.cml.p, cm3.sig2[,c(1,17)], by = "OTU", all.y = F)
View(cml.sig)
cml.sig <- unique(base::merge(kw.cml.p, cm3.sig2[,c(1,17)], by = "OTU", all.y = F))
View(cml.sig)
cml.sig <- unique(base::merge(cm3.sig2[,c(1,17)], kw.cml.p, by = "OTU", all.y = F))
cml.sig <- unique(base::merge(cm3.sig2[,c(1,17)], kw.cml.p, by = "OTU"))
View(cml.sig)
View(m.cml)
View(m.cml)
View(cml.wx)
cml.wx.t <- data.frame(t(cml.wx))
View(cml.wx.t)
colnames(cml.wx.t)
colnames(cml.wx.t) <- c("S.E_Si.E",   "S.E_Si.Es", "S.E_Ss.E",
"Si.E_Si.Es", "Si.E_Ss.E", "Si.Es_Ss.E")
cml.wx.t$OTU <- rownames(cml.wx.t)
cml.sig <- base::merge(cml.sig, cml.wx.t, by = "OTU")
View(cml.sig)
cml.sig[,3:9] <- round(cml.sig[,3:9], digits = 3)
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(sciplot) # for se() function
library(reshape2)
library(scales)
library(knitr)
library(ggrepel)
library(nlme)
library(lme4)
library(apeglm)
library(pheatmap)
library(picante)
library(emmeans)
library(multcomp)
library(multcompView)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
# colour palettes
library(RColorBrewer)
library(viridis)
sessionInfo()
GGAlly::gglegend(pLeg)
GGally::gglegend(pLeg)
pNMDS.leg
packrat::init()
renv::init()
library(phyloseq)
library(microbiome)
library(microbiomeutilities) # format_to_besthit()
library(ggpubr) # ggarrange()
library(plyr)
library(dplyr)
library(ape)
library(vegan)
library(sciplot) # for se() function
library(reshape2)
library(knitr)
library(nlme)
library(lme4)
library(picante)
library(emmeans)
library(purrr) # functions for lists
library(car) # Anova() function (for glmer)
library(tinytex)
library(magrittr)
library(viridis)
sessionInfo()
renv::install("multcompView")
library(multcompView)
library(ape)
library(car)
library(dplyr)
library(emmeans)
library(ggpubr)
library(knitr)
library(lme4)
library(magrittr)
library(microbiome)
library(microbiomeutilities)
library(multcompView)
library(nlme)
library(phyloseq)
library(picante)
library(plyr)
library(purrr)
library(reshape2)
library(sciplot)
library(tinytex)
library(vegan)
library(viridis)
sessionInfo()
View(contam.otu2)
contam.sum <- ddply(contam.otu2, ~ Domain + Phylum + Class + Order +
Family + Genus, summarise,
"number of ASVs" = length(OTU),
"number of reads" = sum(reads),
"% total reads" = sum(freq))
View(contam.sum)
View(contam.sum)
contam.sum <- contam.sum[order(contam.sum$'number of reads', decreasing = T),]
View(contam.sum)
View(contam.sum)
contam.sum1 <- slice_max(contam.sum, order_by = "number of reads", n = 30)
View(contam.sum1)
contam.sum1 <- slice_max(contam.sum, order_by = 'number of reads', n = 30)
contam.sum <- ddply(contam.otu2, ~ Domain + Phylum + Class + Order +
Family + Genus, summarise,
"nASV" = length(OTU),
"reads" = sum(reads),
"freq" = sum(freq))
contam.sum1 <- slice_max(contam.sum, order_by = reads, n = 30)
contam.sum2 <- slice_min(contam.sum, order_by = reads, n = 15)
View(contam.sum2)
contam.sum2 <- slice_min(contam.sum, order_by = reads, n = 25)
rm(contam.sum1, contam.sum2)
# export table
write.csv(contam.sum, "./tables/Supplementary_Table_S4.csv")
# export table
write.csv(contam.sum, "./tables/Supplementary_Table_S4.csv")
contam.sum <- contam.sum[order(contam.sum$reads, decreasing = T),]
# export table
write.csv(contam.sum, "./tables/Supplementary_Table_S4.csv")
contam.sum <- ddply(contam.otu2, ~ Domain + Phylum + Class + Order +
Family + Genus, summarise,
"number of ASVs" = length(OTU),
"number of reads" = sum(reads),
"% of total reads" = sum(freq))
contam.sum <- contam.sum[order(contam.sum$reads, decreasing = T),]
contam.sum <- contam.sum[order(contam.sum$'number of reads', decreasing = T),]
# export table
write.csv(contam.sum, "./tables/Supplementary_Table_S4.csv")
rm(list = ls())
gc()
ps <- read_phyloseq(otu.file = "./input_data/Schreven_Ch4_seqdata.biom1",
taxonomy.file = NULL,
metadata.file = "./input_data/Schreven_Ch4_mapping_file.csv",
type = "biom")
# tree file
treefile_p1 <- read.tree("./input_data/Schreven_Ch4_seqdata_tree.tre")
# merge tree into phyloseq
ps <- merge_phyloseq(ps, treefile_p1)
ps
# order factor levels
ps.meta <- meta(ps)
ps.meta$Type <- factor(ps.meta$Type, levels(ps.meta$Type)[c(6,3,1,2,5,4)])
sample_data(ps) <- ps.meta
# Result: 188 contaminant OTUs
visContam <- read.delim("./input_data/Schreven_Ch4_contaminant_OTU_by_plot.txt")
