added linage barplots
This commit is contained in:
parent
7f9facc1e6
commit
424c1d184d
1 changed files with 68 additions and 0 deletions
68
scripts/plotting/plotting_thesis/lineage_barplots_combined.R
Normal file
68
scripts/plotting/plotting_thesis/lineage_barplots_combined.R
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# get plotting_dfs()
|
||||||
|
# using dfs [lf and wf] from lineage_dfL
|
||||||
|
#===============================
|
||||||
|
# lineage sample and SNP count
|
||||||
|
#===============================
|
||||||
|
lin_countP = lin_count_bp(lf_data = lineage_dfL[['lin_lf']]
|
||||||
|
, all_lineages = F
|
||||||
|
, x_categ = "sel_lineages"
|
||||||
|
, y_count = "p_count"
|
||||||
|
, use_lineages = c("L1", "L2", "L3", "L4")
|
||||||
|
, bar_fill_categ = "count_categ"
|
||||||
|
, display_label_col = "p_count"
|
||||||
|
, bar_stat_stype = "identity"
|
||||||
|
, d_lab_size = 10
|
||||||
|
, d_lab_col = "black"
|
||||||
|
, my_xats = 25 # x axis text size
|
||||||
|
, my_yats = 25 # y axis text size
|
||||||
|
, my_xals = 25 # x axis label size
|
||||||
|
, my_yals = 25 # y axis label size
|
||||||
|
, my_lls = 25 # legend label size
|
||||||
|
, bar_col_labels = c("SNPs", "Total Samples")
|
||||||
|
, bar_col_values = c("grey50", "gray75")
|
||||||
|
, bar_leg_name = ""
|
||||||
|
, leg_location = "top"
|
||||||
|
, y_log10 = F
|
||||||
|
, y_scale_percent = FALSE
|
||||||
|
, y_label = c("Count")
|
||||||
|
)
|
||||||
|
|
||||||
|
#===============================
|
||||||
|
# lineage SNP diversity count
|
||||||
|
#===============================
|
||||||
|
lin_diversityP = lin_count_bp_diversity(lf_data = lineage_dfL[['lin_wf']]
|
||||||
|
, x_categ = "sel_lineages"
|
||||||
|
, y_count = "snp_diversity"
|
||||||
|
#, all_lineages = F
|
||||||
|
, use_lineages = c("L1", "L2", "L3", "L4")
|
||||||
|
, display_label_col = "snp_diversity_f"
|
||||||
|
, bar_stat_stype = "identity"
|
||||||
|
, x_lab_angle = 90
|
||||||
|
, d_lab_size =10
|
||||||
|
, my_xats = 25 # x axis text size
|
||||||
|
, my_yats = 25 # y axis text size
|
||||||
|
, my_xals = 25 # x axis label size
|
||||||
|
, my_yals = 25 # y axis label size
|
||||||
|
, my_lls = 25 # legend label size
|
||||||
|
, y_log10 = F
|
||||||
|
, y_scale_percent = F
|
||||||
|
, leg_location = "top"
|
||||||
|
, y_label = "SNP diversity")
|
||||||
|
|
||||||
|
#=============================================
|
||||||
|
# Output plots: Lineage count and Diversity
|
||||||
|
#=============================================
|
||||||
|
lineage_bp_CL = paste0(outdir_images
|
||||||
|
,tolower(gene)
|
||||||
|
,"_lineage_bp_CL.svg")
|
||||||
|
|
||||||
|
cat("Lineage barplots:", lineage_bp_CL)
|
||||||
|
svg(lineage_bp_CL, width = 8, height = 15)
|
||||||
|
|
||||||
|
cowplot::plot_grid(lin_countP, lin_diversityP
|
||||||
|
#, labels = c("(a)", "(b)", "(c)", "(d)")
|
||||||
|
, nrow = 2
|
||||||
|
, labels = "AUTO"
|
||||||
|
, label_size = 25)
|
||||||
|
|
||||||
|
dev.off()
|
Loading…
Add table
Add a link
Reference in a new issue