moved all test scripts for functions to tests/

This commit is contained in:
Tanushree Tunstall 2021-09-09 13:12:07 +01:00
parent 901f3896af
commit 9bb3ac2a01
15 changed files with 162 additions and 776 deletions

View file

@ -12,7 +12,6 @@ getwd()
# Installing and loading required packages
##########################################################
source("Header_TT.R")
source("../functions/bp_lineage.R")
#===========
# input
@ -40,24 +39,6 @@ if(is.null(drug)|is.null(gene)) {
source ('get_plotting_dfs.R')
cat("Directories imported:"
, "\n===================="
, "\ndatadir:", datadir
, "\nindir:", indir
, "\noutdir:", outdir
, "\nplotdir:", plotdir)
cat("Variables imported:"
, "\n====================="
, "\ndrug:", drug
, "\ngene:", gene
, "\ngene_match:", gene_match
, "\nAngstrom symbol:", angstroms_symbol
#, "\nNo. of duplicated muts:", dup_muts_nu
, "\ndr_muts_col:", dr_muts_col
, "\nother_muts_col:", other_muts_col
, "\ndrtype_col:", resistance_col)
#=======
# output
#=======
@ -74,21 +55,21 @@ plot_basic_bp_lineage_cl
# Data: All lineages or
# selected few
#------------------------
sel_lineages = levels(lin_lf$sel_lineages_f)[1:4]
sel_lineages = levels(lin_lf$sel_lineages)[1:4]
sel_lineages
lin_lf_plot = lin_lf[lin_lf$sel_lineages_f%in%sel_lineages,]
lin_lf_plot = lin_lf[lin_lf$sel_lineages%in%sel_lineages,]
str(lin_lf_plot)
# drop unused factor levels
lin_lf_plot$sel_lineages_f = factor(lin_lf_plot$sel_lineages_f)
levels(lin_lf_plot$sel_lineages_f)
lin_lf_plot$sel_lineages = factor(lin_lf_plot$sel_lineages)
levels(lin_lf_plot$sel_lineages)
str(lin_lf_plot)
#------------------------
# plot from my function:
#------------------------
lin_countP = lin_count_bp(lin_lf_plot
, x_categ = "sel_lineages_f"
, x_categ = "sel_lineages"
, y_count = "p_count"
, bar_fill_categ = "count_categ"
, display_label_col = "p_count"
@ -109,21 +90,21 @@ lin_countP
# Data: All lineages or
# selected few
#------------------------
sel_lineages = levels(lin_wf$sel_lineages_f)[1:4]
sel_lineages = levels(lin_wf$sel_lineages)[1:4]
sel_lineages
lin_wf_plot = lin_wf[lin_wf$sel_lineages_f%in%sel_lineages,]
lin_wf_plot = lin_wf[lin_wf$sel_lineages%in%sel_lineages,]
str(lin_wf_plot)
# drop unused factor levels
lin_wf_plot$sel_lineages_f = factor(lin_wf_plot$sel_lineages_f)
levels(lin_wf_plot$sel_lineages_f)
lin_wf_plot$sel_lineages = factor(lin_wf_plot$sel_lineages)
levels(lin_wf_plot$sel_lineages)
str(lin_wf_plot)
#------------------------
# plot from my function:
#------------------------
lin_diversityP = lin_count_bp(lin_wf_plot
, x_categ = "sel_lineages_f"
, x_categ = "sel_lineages"
, y_count = "snp_diversity"
, display_label_col = "snp_diversity_f"
, bar_stat_stype = "identity"