enter the commit message for your changes. Lines starting

This commit is contained in:
Tanushree Tunstall 2020-11-02 15:04:40 +00:00
parent b8ff7995ac
commit 9c141326aa
2 changed files with 80 additions and 62 deletions

View file

@ -7,6 +7,7 @@ getwd()
# Input
#=============
source("boxplot_stat_function.R")
source("boxplot_function.R") # for sam
source("plot_data.R")
#=============
@ -39,7 +40,7 @@ npa_plot_annot = annotate_figure(npa_plot
, top = text_grob(my_sample_npa
, color = "blue"
, face = "bold"
, size = 14)
, size = 18)
, bottom = text_grob(paste0("Mosaic data\nFlu positive adults (n=", fp_npa, ")")
, color = "blue"
, hjust = 1
@ -51,44 +52,46 @@ npa_plot_annot = annotate_figure(npa_plot
, rot = 90
, size = 18))
npa_plot_annot
#dev.off()
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#
#-------------
# SAM
# SAM: NO STATS
# FIXME: error handling!
# For now, just calling plotting function without stats
#-------------
#my_sample_sam = "SAM"
#fp_sam = length(unique(lf_fp_sam$mosaic)); fp_sam
my_sample_sam = "SAM"
fp_sam = length(unique(lf_fp_sam$mosaic)); fp_sam
#cat("\nPlotting boxplots with stats for:", my_sample_sam
# , "\n========================================================\n")
cat("\nPlotting boxplots with stats for:", my_sample_sam
, "\n========================================================\n")
#plots_sam = doMyPlots(lf_fp_sam)
#sam_plot = ggpubr::ggarrange(plotlist = plots_sam
# , align = "hv"
# , ncol = 7
# , nrow = 5
# , common.legend = T)
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(paste0("Mosaic data\nFlu positive adults (n=", fp_sam, ")")
# , 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()
sam_plot_annot = annotate_figure(sam_plot
, top = text_grob(my_sample_sam
, color = "blue"
, face = "bold"
, size = 18)
, bottom = text_grob(paste0("Mosaic data\nFlu positive adults (n=", fp_sam, ")")
, 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
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#
#-------------
# SERUM
#-------------
my_sample_serum = "serum"
my_sample_serum = "SERUM"
fp_serum = length(unique(lf_fp_serum$mosaic)); fp_serum
cat("\nPlotting boxplots with stats for:", my_sample_serum
@ -105,7 +108,7 @@ serum_plot_annot = annotate_figure(serum_plot
, top = text_grob(my_sample_serum
, color = "blue"
, face = "bold"
, size = 14)
, size = 18)
, bottom = text_grob(paste0("Mosaic data\nFlu positive adults (n=", fp_serum, ")")
, color = "blue"
, hjust = 1
@ -119,3 +122,5 @@ serum_plot_annot = annotate_figure(serum_plot
serum_plot_annot
dev.off()
###############################################################
# END OF SCRIPT #
###############################################################

View file

@ -40,8 +40,9 @@ revised_nrow = nrow(lf_fp_npa); revised_nrow
orig_nrow == revised_nrow
head(lf_fp_npa$value)
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# log all values and reassign
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
lf_fp_npa$value = log10(lf_fp_npa$value)
head(lf_fp_npa$value)
vl_temp_fix2 = lf_fp_npa[lf_fp_npa$mediator=="vl_pfu_ul",]
@ -77,46 +78,56 @@ npa_plot_annot = annotate_figure(npa_plot
, rot = 90
, size = 18))
npa_plot_annot
#dev.off()
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#
#-------------
# SAM
#-------------
#my_sample_sam = "SAM"
#fp_sam = length(unique(lf_fp_sam$mosaic)); fp_sam
head(lf_fp_sam$value)
#cat("\nPlotting boxplots with stats for:", my_sample_sam
# , "\n========================================================\n")
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# log all values and reassign
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
lf_fp_sam$value = log10(lf_fp_sam$value)
head(lf_fp_sam$value)
#plots_sam = doMyPlots(lf_fp_sam)
#sam_plot = ggpubr::ggarrange(plotlist = plots_sam
# , align = "hv"
# , ncol = 7
# , nrow = 5
# , common.legend = T)
my_sample_sam = "SAM"
fp_sam = length(unique(lf_fp_sam$mosaic)); fp_sam
cat("\nPlotting boxplots with stats for:", my_sample_sam
, "\n========================================================\n")
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(paste0("Mosaic data\nFlu positive adults (n=", fp_sam, ")")
# , 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()
sam_plot_annot = annotate_figure(sam_plot
, top = text_grob(my_sample_sam
, color = "blue"
, face = "bold"
, size = 14)
, bottom = text_grob(paste0("Mosaic data\nFlu positive adults (n=", fp_sam, ")")
, 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
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#
#------------------------------------------
#-------------
# SERUM
#-------------
head(lf_fp_serum$value)
# reassign
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# log all values and reassign
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
lf_fp_serum$value = log10(lf_fp_serum$value)
head(lf_fp_serum$value)
@ -151,3 +162,5 @@ serum_plot_annot = annotate_figure(serum_plot
serum_plot_annot
dev.off()
###############################################################
# END OF SCRIPT #
###############################################################