SNP -> SAV for thesis plots

This commit is contained in:
Tanushree Tunstall 2023-02-19 17:43:22 +00:00
parent 777d3765cf
commit db7e2912e1
31 changed files with 145 additions and 145 deletions

View file

@ -13,8 +13,8 @@
# For my case, this is called "lineage_labels"
# This column has short labels like L1, L2, L3, etc.
# if this is left empty, then the lineage_column_name will be used
# id_colname : sample-id column. Used to calculate SNP count
# snp_colname : SNP column. Used to calculate SNP diversity
# id_colname : sample-id column. Used to calculate SAV count
# snp_colname : SAV column. Used to calculate SAV diversity
# RETURNS: List
# WF and LF data for lineage-wise snp count and snp diversity
@ -142,7 +142,7 @@ lineage_plot_data <- function(plot_df
lin_wf
#----------------------
# Add SNP diversity
# Add SAV diversity
#----------------------
lin_wf$snp_diversity = lin_wf$num_snps_u/lin_wf$total_samples
lin_wf
@ -150,7 +150,7 @@ lineage_plot_data <- function(plot_df
#----------------------
# Add some formatting
#----------------------
# SNP diversity
# SAV diversity
lin_wf$snp_diversity_f = round( (lin_wf$snp_diversity * 100), digits = 0)
lin_wf$snp_diversity_f = paste0(lin_wf$snp_diversity_f, "%")