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

View file

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