moved all test scripts for functions to tests/
This commit is contained in:
parent
2ee66c770b
commit
03031d2eb6
15 changed files with 162 additions and 776 deletions
62
scripts/functions/tests/test_bp_lineage.R
Normal file
62
scripts/functions/tests/test_bp_lineage.R
Normal file
|
@ -0,0 +1,62 @@
|
|||
setwd("~/git/LSHTM_analysis/scripts/plotting")
|
||||
|
||||
source ('get_plotting_dfs.R')
|
||||
source("../functions/bp_lineage.R")
|
||||
|
||||
#########################################
|
||||
# Lineage and SNP count: lineage lf data
|
||||
#########################################
|
||||
#=========================
|
||||
# Data: All lineages or
|
||||
# selected few
|
||||
#=========================
|
||||
sel_lineages = levels(lin_lf$sel_lineages_f)
|
||||
sel_lineages
|
||||
lin_lf_plot = lin_lf[lin_lf$sel_lineages_f%in%sel_lineages,]
|
||||
|
||||
# drop unused factor levels
|
||||
lin_lf_plot$sel_lineages_f = factor(lin_lf_plot$sel_lineages_f)
|
||||
levels(lin_lf_plot$sel_lineages_f)
|
||||
#=========================
|
||||
# Lineage count plot
|
||||
#=========================
|
||||
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_scale_percent = F # T for diversity
|
||||
, y_log10 = F
|
||||
, y_label = "Count")
|
||||
|
||||
###############################################
|
||||
# Lineage SNP diversity count: lineage wf data
|
||||
###############################################
|
||||
#=========================
|
||||
# Data: All lineages or
|
||||
# selected few
|
||||
#=========================
|
||||
sel_lineages = levels(lin_wf$sel_lineages_f)
|
||||
sel_lineages
|
||||
lin_wf_plot = lin_wf[lin_wf$sel_lineages_f%in%sel_lineages,]
|
||||
|
||||
# drop unused factor levels
|
||||
lin_wf_plot$sel_lineages_f = factor(lin_wf_plot$sel_lineages_f)
|
||||
levels(lin_wf_plot$sel_lineages_f)
|
||||
#=========================
|
||||
# Lineage Diversity 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")
|
Loading…
Add table
Add a link
Reference in a new issue