ITS2 <- load_blast6("~/vsearchr/inst/extdata/ITS2_vsearch_CT.output/") ### Check for short but high ID alignments ITS2_95 <- filter(ITS2, pident >= 95.0) ggplot(ITS2_95, aes(length)) + geom_histogram()
ITS2_tax <- load_MTXA("~/vsearchr/inst/extdata/ITS2_CT_Amplicons.tax")
ITS2_join_95 <- tax_join(ITS2, ITS2_tax, min_id = 95.0, min_len = 300) ITS2_eval_95 <- ITS2_join_95 %>% group_by(sample) %>% summarize(reads = n()) %>% arrange(sample)
ITS2_tally <- tally_gen(ITS2_join_95)
### ITS2 ITS2_meta <- add_meta(ITS2_tally, "~/vsearchr/inst/extdata/CT_2015_key.csv") genus_summary_ITS2 <- ITS2_meta %>% group_by(genus) %>% summarize(mol_freq = n(), max_prop = max(gen_prop)) ITS2_final <- left_join(ITS2_meta, genus_summary_ITS2, by = "genus")
ggplot(filter(ITS2_final, max_prop >= 0.05), aes(x = date, y = reorder(genus, mol_freq), fill = gen_prop)) + geom_tile(width = 6, color = "black") + scale_fill_gradient(low = "gray95", high = "purple") + theme_bw(6) + ylab("Genus") + xlab("Sample") + labs(fill = "Proportional\nabundance") + facet_grid(~site) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) ggsave("~/vsearchr/inst/extdata/figures/ITS2_tileplot.pdf", width = 6.5, height = 4.5) ggsave("~/vsearchr/inst/extdata/figures/ITS2_tileplot.png", width = 6.5, height = 4.5)
micro_dat <- read_csv("~/vsearchr/inst/extdata/micro_dat_v2.csv", col_names = TRUE) %>% rename(micro_vol_prop = prop_vol, micro_ct_prop = prop_count) %>% filter(genus != "undet") %>% #filter(micro_prop >= 0.001) %>% group_by(site, date, genus) %>% summarize(micro_vol_prop = sum(micro_vol_prop), micro_ct_prop = sum(micro_ct_prop)) CT_genus_summary_micro <- micro_dat %>% group_by(genus) %>% summarize(micro_freq = n(), max_vol_prop = max(micro_vol_prop), max_ct_prop = max(micro_ct_prop)) CT_micro_join <- left_join(micro_dat, CT_genus_summary_micro, by = "genus") %>% add_meta_micro("~/vsearchr/inst/extdata/CT_2015_key.csv") %>% na.omit()
ITS2_final_genera <- ungroup(ITS2_final) %>% select(genus) %>% unique() micro_genera <- ungroup(micro_dat) %>% select(genus) %>% unique() genus_list <- full_join(ITS2_final_genera, micro_genera, by = "genus") #write_csv(genus_list, "~/vsearchr/inst/extdata/genus_list.csv") genus_traits <- read_csv("~/vsearchr/inst/extdata/genus_traits.csv", col_names = TRUE) ITS2_final_traits <- inner_join(ITS2_final, genus_traits, by = "genus") ggplot(filter(ITS2_final_traits), aes(x = form, y = gen_prop, fill = form)) + geom_bar(stat = "identity")
micro_anti_ITS2 <- anti_join(micro_dat, ITS2_tax, by = "genus") %>% ungroup() %>% select(genus) %>% unique()
mol_dat <- ITS2_final %>% ungroup() %>% select(sample, site, date, genus, gen_prop, max_prop, mol_freq) shared_sitedates <- inner_join(CT_micro_join, mol_dat, by = c("site", "date")) %>% select(site, date) %>% unique() ### join micromol_dat <- full_join(mol_dat, CT_micro_join, by = c("sample", "site", "date", "genus")) %>% semi_join(shared_sitedates, by = c("site", "date")) %>% replace_na(list(gen_prop = 0, micro_vol_prop = 0, micro_ct_prop = 0, mol_freq = 0, micro_freq = 0)) %>% mutate(shared = case_when( gen_prop == 0 & micro_ct_prop > 0 ~ "micro_only", gen_prop > 0 & micro_ct_prop == 0 ~ "mol_only", gen_prop > 0 | micro_ct_prop > 0 ~ "shared"), shared_log = case_when( shared == "shared" ~ 1, shared != "shared" ~ 0)) %>% select(sample, site, date, genus, gen_prop, max_prop, micro_vol_prop, micro_ct_prop, shared, shared_log, mol_freq, micro_freq) micromol_dat_genus_summary <- micromol_dat %>% group_by(genus) %>% summarize(max_micro_ct = max(micro_ct_prop), max_micro_vol = max(micro_vol_prop)) micromol_dat_final <- left_join(micromol_dat, micromol_dat_genus_summary, by = "genus") write_csv(micromol_dat_final, "~/Desktop/micro_mol_comparison_ITS2.csv")
ggplot(filter(CT_micro_join, max_vol_prop >= 0.05), aes(x = date, y = reorder(genus, micro_freq), fill = micro_vol_prop)) + geom_tile(width = 6, color = "black") + scale_fill_gradient(low = "gray95", high = "purple") + theme_bw(9) + ylab("Genus") + xlab("Sample") + labs(fill = "Proportional\nabundance") + facet_grid(~site) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) ggsave("~/vsearchr/inst/extdata/figures/micro_tileplot.pdf", width = 7.5, height = 4.5) ggsave("~/vsearchr/inst/extdata/figures/micro_tileplot.png", width = 7.5, height = 4.5)
### Bar plot of detections # ITS2 only ggplot(micromol_dat_final, aes(x = shared, fill = shared)) + geom_bar() + theme_gray(18) + scale_fill_discrete(name = NULL, labels = c("microscopy", "metabarcoding", "both")) + scale_x_discrete(labels = c("microscopy", "metabarcoding", "both")) + ylab("detections") + xlab(NULL) ggplot(filter(micromol_dat_final, gen_prop >= 0.05 | micro_vol_prop >= 0.05), aes(x = shared, fill = shared)) + geom_bar() + theme_gray(14) + scale_fill_discrete(name = NULL, labels = c("microscopy", "metabarcoding", "both")) + scale_x_discrete(labels = c("microscopy", "metabarcoding", "both")) + ylab("detections") + xlab(NULL) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_aggregate.pdf", width = 6.5, height = 4.5) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_aggregate.png", width = 6.5, height = 4.5) ### Scatter plot of abundances #### Grain count ggplot(micromol_dat_final, aes(x = sqrt(gen_prop), y = sqrt(micro_ct_prop), color = shared)) + geom_point(alpha = 0.7) + geom_smooth(method = "lm") + theme_gray(14) + geom_abline(intercept = 0, slope = 1, color = "gray40", linetype = "dashed") + scale_color_discrete(name = NULL, labels = c("microscopy", "metabarcoding", "both")) + xlab(expression(sqrt("read count"))) + ylab(expression(sqrt("grain count"))) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_abundance_ct.pdf", width = 6.5, height = 4) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_abundance_ct.png", width = 6.5, height = 4) #### Volume ggplot(micromol_dat_final, aes(x = sqrt(gen_prop), y = sqrt(micro_vol_prop), color = shared)) + geom_point(alpha = 0.7) + geom_smooth(method = "lm") + theme_gray(14) + geom_abline(intercept = 0, slope = 1, color = "gray40", linetype = "dashed") + scale_color_discrete(name = NULL, labels = c("microscopy", "metabarcoding", "both")) + xlab(expression(sqrt("read count"))) + ylab(expression(sqrt("grain volume"))) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_abundance_vol.pdf", width = 6.5, height = 4) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_abundance_vol.png", width = 6.5, height = 4) ### Scatter plot of frequencies ggplot(micromol_dat_final, aes(mol_freq, micro_freq, color = shared)) + geom_point(alpha = 0.2) + theme_gray(14) + geom_abline(intercept = 0, slope = 1, color = "gray40", linetype = "dashed") + scale_color_discrete(name = NULL, labels = c("microscopy", "metabarcoding", "both")) + stat_smooth(method = "lm") ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_freq.pdf", width = 6.5, height = 4) ggsave("~/vsearchr/inst/extdata/figures/micro_vs_mol_freq.png", width = 6.5, height = 4) ### Grouped barplot of agreement micromol_long <- micromol_dat_final %>% select(sample, site, date, genus, gen_prop, micro_vol_prop) %>% gather(metric, value, -sample, -site, -date, -genus) micromol_long_major <- micromol_dat_final %>% filter(gen_prop >= 0.05 | micro_ct_prop >= 0.05) %>% select(sample, site, date, genus, gen_prop, micro_vol_prop) %>% gather(metric, value, -sample, -site, -date, -genus) ggplot(micromol_long_major, aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy")) + ylab("proportional abundance") + facet_grid(sample ~ .) ggsave("~/vsearchr/inst/extdata/figures/C0820.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT1"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_8/20") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0820.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT2"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_9/17") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0917.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT3"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_7/27") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0727.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT4"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_6/12") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0612.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT5"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_7/8") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0708.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT6"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("C_7/16") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/C0716.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT7"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_8/31") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0831.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT8"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_9/3") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0903.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT9"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("C_9/10") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/C0910.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT10"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_9/2") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0902.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT11"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_7/15") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0715.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT12"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_7/2") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0702.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT13"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("B_5/27") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/B0527.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT14"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_7/7") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0707.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT15"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_5/13") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0513.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT16"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_6/4") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0604.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT17"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("C_8/13") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/C0813.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT18"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_7/23") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0723.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT19"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_8/10") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0810.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT20"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_8/13") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0813.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT21"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("B_6/17") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/B0617.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT22"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("B_9/23") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/B0923.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT23"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_6/18") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0618.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT24"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_6/11") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0611.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT25"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_5/28") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0528.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT26"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_6/30") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0630.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT27"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("B_6/24") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/B0624.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT28"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_5/22") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0522.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT29"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_9/14") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0914.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT30"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_9/21") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0921.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT31"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_6/10") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0610.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT32"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_8/3") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0803.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT33"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_8/25") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0825.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT34"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_5/29") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0529.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT35"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_7/22") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0722.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT36"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_8/7") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0807.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT37"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_6/25") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0625.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT38"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("B_8/4") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/B0804.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT39"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_7/30") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0730.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT40"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_8/19") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0819.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT41"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("B_6/3") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/B0603.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT42"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("C_9/18") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/C0918.pdf", width = 6.5, height = 6.5) # ggplot(filter(micromol_long_major, sample == "CT43"), aes(x = genus, y = value, fill = metric)) + # geom_bar(stat = "identity", position = "dodge") + # theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # ggtitle("A_7/13") + # geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + # scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + # ylab("proportional abundance") + # ggsave("~/vsearchr/inst/extdata/figures/A0713.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT44"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_6/26") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0626.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT45"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_8/28") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0828.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT46"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("C_6/19") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/C0619.pdf", width = 6.5, height = 6.5) ggplot(filter(micromol_long_major, sample == "CT47"), aes(x = genus, y = value, fill = metric)) + geom_bar(stat = "identity", position = "dodge") + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + ggtitle("A_7/20") + #geom_abline(intercept = 0.05, slope = 0, color = "gray40", linetype = "dashed") + scale_fill_discrete(name = NULL, labels = c("metabarcoding", "microcopy (vol)")) + ylab("proportional abundance") ggsave("~/vsearchr/inst/extdata/figures/A0720.pdf", width = 6.5, height = 6.5) ### Linear model of abundance lm1 <- lm(sqrt(micro_vol_prop) ~ sqrt(gen_prop), data = filter(micromol_dat_final, shared_log == 1)) summary(lm1) plot(lm1) ### Count proportion vs volume proportion ggplot(micromol_dat_final, aes(micro_ct_prop, micro_vol_prop)) + geom_point() + stat_smooth(method = "lm") ggplot(micromol_dat_final, aes(sqrt(micro_ct_prop), sqrt(micro_vol_prop))) + geom_point() + stat_smooth(method = "lm") + xlab("sqrt(count)") + ylab("sqrt(volume)") ggsave("~/Desktop/count_vs_volume.pdf") # Unique genera detected micro_genera_major <- tibble(unique(filter(micro_dat, micro_vol_prop >= 0.05)$genus)) %>% rename(genus = 1) mol_genera_major <- tibble(unique(filter(ITS2_final, gen_prop >= 0.05)$genus)) %>% rename(genus = 1) shared_genera_major <- inner_join(micro_genera_major, mol_genera_major)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.