From 4ca975bf810043ea31e8feff9c639f3733209090 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Sun, 1 Nov 2020 16:46:42 +0000 Subject: [PATCH] added boxplot_stat.R to output plots for all sample types --- boxplot_stat.R | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 boxplot_stat.R diff --git a/boxplot_stat.R b/boxplot_stat.R new file mode 100644 index 0000000..b271c1d --- /dev/null +++ b/boxplot_stat.R @@ -0,0 +1,71 @@ +#!/usr/bin/Rscript +getwd() +setwd("~/git/mosaic_2020/") +getwd() +############################################################### +source("boxplot_stat_function.R") +source("plot_data.R") +#============= +# Output: +#============= +outfile_bp = paste0("boxplots_stats_all", ".pdf") +output_boxplot_stats = paste0(outdir_plots, outfile_bp); output_boxplot_stats +pdf(output_boxplot_stats, width=22, height=16) + +#=========================== +# NPA +#=========================== +my_sample_npa = "NPA" +plots_npa = doMyPlots(lf_fp_npa) +npa_plot = ggpubr::ggarrange(plotlist = plots_npa + , align = "hv" + , ncol = 7 + , nrow = 5 + , common.legend = T) +#npa_plot +npa_plot_annot = annotate_figure(npa_plot + , top = text_grob(my_sample_npa, color = "blue", face = "bold", size = 14) + , bottom = text_grob("Mosaic data\nFlu positive adults (n=133)" + , color = "blue" + , hjust = 1, x = 0.98, face = "italic", size = 10) + , left = text_grob("Levels (pg/ml)", color = "black", rot = 90, size = 18)) +npa_plot_annot +#dev.off() +#=========================== +# SAM +#=========================== +my_sample_sam = "SAM" +plots_sam = doMyPlots(lf_fp_sam) +sam_plot = ggpubr::ggarrange(plotlist = plots_sam + , align = "hv" + , ncol = 7 + , nrow = 5 + , common.legend = T) +#sam_plot +sam_plot_annot = annotate_figure(sam_plot + , top = text_grob(my_sample_sam, color = "blue", face = "bold", size = 14) + , bottom = text_grob("Mosaic data\nFlu positive adults (n=133)" + , color = "blue" + , hjust = 1, x = 0.98, face = "italic", size = 10) + , left = text_grob("Levels (pg/ml)", color = "black", rot = 90, size = 18)) +sam_plot_annot +#dev.off() +#=========================== +# SERUM +#=========================== +my_sample_serum = "serum" +plots_serum = doMyPlots(lf_fp_serum) +serum_plot = ggpubr::ggarrange(plotlist = plots_serum + , align = "hv" + , ncol = 7 + , nrow = 5 + , common.legend = T) +#serum_plot +serum_plot_annot = annotate_figure(serum_plot + , top = text_grob(my_sample_serum, color = "blue", face = "bold", size = 14) + , bottom = text_grob("Mosaic data\nFlu positive adults (n=133)" + , color = "blue" + , hjust = 1, x = 0.98, face = "italic", size = 10) + , left = text_grob("Levels (pg/ml)", color = "black", rot = 90, size = 18)) +serum_plot_annot +dev.off()