added function for generating lineage barplots and also test script along wiadding script for processing data and added it to get_plotting_dfs.R
This commit is contained in:
parent
605eb54526
commit
869fca7f94
6 changed files with 470 additions and 5 deletions
111
scripts/functions/test_bp_lineage.R
Normal file
111
scripts/functions/test_bp_lineage.R
Normal file
|
@ -0,0 +1,111 @@
|
|||
setwd("~/git/LSHTM_analysis/scripts/plotting")
|
||||
|
||||
#source ('get_plotting_dfs.R')
|
||||
source("../functions/bp_lineage.R")
|
||||
|
||||
#########################################
|
||||
# Lineage and SNP count: lineage lf data
|
||||
#########################################
|
||||
# Relevel factors so that x-axis categ appear as you want
|
||||
lin_lf_plot = lin_lf
|
||||
lin_lf_plot
|
||||
is.factor(lin_lf_plot$sel_lineages_f)
|
||||
|
||||
lin_lf_plot$sel_lineages_f = factor(lin_lf_plot$sel_lineages_f, c(""
|
||||
, "L1"
|
||||
, "L2"
|
||||
, "L3"
|
||||
, "L4"
|
||||
, "L5"
|
||||
, "L6"
|
||||
, "L7"
|
||||
, "LBOV"
|
||||
, "L1;L2"
|
||||
, "L1;L3"
|
||||
, "L1;L4"
|
||||
, "L2;L3"
|
||||
, "L2;L3;L4"
|
||||
, "L2;L4"
|
||||
, "L2;L6"
|
||||
, "L2;LBOV"
|
||||
, "L3;L4"
|
||||
, "L4;L6"
|
||||
, "L4;L7"))
|
||||
|
||||
levels(lin_lf_plot$sel_lineages_f)
|
||||
|
||||
lin_count_bp(lin_lf_plot
|
||||
, x_categ = "sel_lineages_f"
|
||||
, y_count = "p_count"
|
||||
, bar_fill_categ = "count_categ"
|
||||
, display_label_col = "p_count"
|
||||
, bar_stat_stype = "identity"
|
||||
, x_lab_angle = 90
|
||||
, my_xats = 20
|
||||
, bar_col_labels = c("Mutations", "Total Samples")
|
||||
, bar_col_values = c("grey50", "gray75")
|
||||
, y_log10 = T
|
||||
, y_label = "Count"
|
||||
, y_scale_percent = F)
|
||||
|
||||
###############################################
|
||||
# Lineage SNP diversity count: lineage wf data
|
||||
###############################################
|
||||
# Relevel factors so that x-axis categ appear as you want
|
||||
lin_wf_plot = lin_wf
|
||||
is.factor(lin_wf_plot$sel_lineages_f)
|
||||
|
||||
lin_wf_plot$sel_lineages_f = factor(lin_wf_plot$sel_lineages_f, c(""
|
||||
, "L1"
|
||||
, "L2"
|
||||
, "L3"
|
||||
, "L4"
|
||||
, "L5"
|
||||
, "L6"
|
||||
, "L7"
|
||||
, "LBOV"
|
||||
, "L1;L2"
|
||||
, "L1;L3"
|
||||
, "L1;L4"
|
||||
, "L2;L3"
|
||||
, "L2;L3;L4"
|
||||
, "L2;L4"
|
||||
, "L2;L6"
|
||||
, "L2;LBOV"
|
||||
, "L3;L4"
|
||||
, "L4;L6"
|
||||
, "L4;L7"))
|
||||
|
||||
levels(lin_wf_plot$sel_lineages_f)
|
||||
|
||||
#==========
|
||||
# Plot
|
||||
#==========
|
||||
lin_count_bp(lin_wf_plot
|
||||
, x_categ = "sel_lineages_f"
|
||||
, y_count = "snp_diversity"
|
||||
, display_label_col = "snp_diversity_f"
|
||||
|
||||
, bar_stat_stype = "identity"
|
||||
, x_lab_angle = 90
|
||||
, my_xats = 20
|
||||
, y_scale_percent = T
|
||||
, y_label = "SNP diversity"
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
, x_categ = "sel_lineages_f"
|
||||
, y_count = "p_count"
|
||||
, bar_fill_categ = "count_categ"
|
||||
, display_label_col = "p_count"
|
||||
, bar_stat_stype = "identity"
|
||||
, x_lab_angle = 90
|
||||
, my_xats = 15
|
||||
, bar_col_labels = c("Mutations", "Total Samples")
|
||||
, bar_col_values = c("grey50", "gray75")
|
||||
, y_log10 = T
|
||||
, y_scale_percent = F
|
Loading…
Add table
Add a link
Reference in a new issue