Chapter 15 Supp table 3
Paired Wilcoxon statistical tests of different comparisons based on the observed ASVs, Chao1 (Estimated total number of ASVs), and Shannon metrics of the 16S data based on ASVs. Within each test P-values were adjusted by the Holm-Bonferroni method.
15.1 Libraries
Change some metadata categories
#Change -80 to baseline in storage conditions
sample_data(physeq)[,"Storageconditions"] <- gsub(
pattern = "-80", replacement = "Baseline",
x = as.vector(unlist(sample_data(physeq)[,"Storageconditions"]))
)
#Storage temp change to categorical names
sample_data(physeq)[,"Storagetemp"] <- gsub(
pattern = "-80", replacement = "Baseline",
x = as.vector(unlist(sample_data(physeq)[,"Storagetemp"]))
)
sample_data(physeq)[,"Storagetemp"] <- gsub(
pattern = "4", replacement = "Fridge",
x = as.vector(unlist(sample_data(physeq)[,"Storagetemp"]))
)
sample_data(physeq)[,"Storagetemp"] <- gsub(
pattern = "20", replacement = "RT",
x = as.vector(unlist(sample_data(physeq)[,"Storagetemp"]))
)
#Bufferused_and_Storageconditions change to categorical names
sample_data(physeq)[,"Bufferused_and_Storageconditions"] <- gsub(
pattern = "-80", replacement = "Baseline",
x = as.vector(unlist(sample_data(physeq)[,"Bufferused_and_Storageconditions"]))
)
sample_data(physeq)[,"Bufferused_and_Storageconditions"] <- gsub(
pattern = "4", replacement = "Fridge",
x = as.vector(unlist(sample_data(physeq)[,"Bufferused_and_Storageconditions"]))
)
sample_data(physeq)[,"Bufferused_and_Storageconditions"] <- gsub(
pattern = "20", replacement = "RT",
x = as.vector(unlist(sample_data(physeq)[,"Bufferused_and_Storageconditions"]))
)
15.1.1 Paired wilcox tests
#Calculate alpha stats
#Produce data frame of all alpha diversity values
alpha_df <- phyloseq::estimate_richness(physeq = physeq, measures = c("Observed","Chao1","Shannon"))
#Bufferused
#Using default P value adjusment method of holm (Holm-Bonferroni method)
observed_stats <- pairwise.wilcox.test(alpha_df$Observed, phyloseq::sample_data(physeq)$Bufferused)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1, phyloseq::sample_data(physeq)$Bufferused)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon, phyloseq::sample_data(physeq)$Bufferused)
#Write out data
write.table("Bufferused", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Storageconditions
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Storageconditions)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Storageconditions)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Storageconditions)
#Write out data
write.table("Storageconditions", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Participant number
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Patientnumber)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Patientnumber)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Patientnumber)
#Write out data
write.table("Participant number", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Storagetemp
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Storagetemp)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Storagetemp)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Storagetemp)
#Write out data
write.table("Storagetemp", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Bufferused_and_Storageconditions
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
#Write out data
write.table("Bufferused and Storageconditions", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Bufferused_and_Storageconditions
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Bufferused_and_Storageconditions)
#Write out data
write.table("Bufferused and Storageconditions", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
#Participant number and Bufferused
observed_stats <- pairwise.wilcox.test(alpha_df$Observed,
phyloseq::sample_data(physeq)$Patientnumber_and_Bufferused)
chao_stats <- pairwise.wilcox.test(alpha_df$Chao1,
phyloseq::sample_data(physeq)$Patientnumber_and_Bufferused)
shannon_stats <- pairwise.wilcox.test(alpha_df$Shannon,
phyloseq::sample_data(physeq)$Patientnumber_and_Bufferused)
#Write out data
write.table("Participant number and Bufferused", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table("Observed", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(observed_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Chao1", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(chao_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)
write.table("Shannon", file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = FALSE, row.names = FALSE)
write.table(shannon_stats$p.value, file = "./data/wilcox_16s.tsv",
sep = "\t", quote=FALSE, append = TRUE, col.names = NA)