SNP -> SAV for thesis plots
This commit is contained in:
parent
777d3765cf
commit
db7e2912e1
31 changed files with 145 additions and 145 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env Rscript
|
||||
|
||||
#########################################################
|
||||
# TASK: function for barplot showing no. of sites with nsSNP
|
||||
# TASK: function for barplot showing no. of sites with SAV
|
||||
# count
|
||||
#########################################################
|
||||
# load libraries and functions
|
||||
|
@ -11,7 +11,7 @@ library(dplyr)
|
|||
|
||||
theme_set(theme_grey())
|
||||
#=================================================================
|
||||
# site_snp_count_bp(): barplots for no. of sites and nsSNP count
|
||||
# site_snp_count_bp(): barplots for no. of sites and SAV count
|
||||
# input args
|
||||
## df containing data to plot
|
||||
## df column name containing site/position numbers
|
||||
|
@ -31,7 +31,7 @@ site_snp_count_bp <- function (plotdf,
|
|||
axis_label_size = 10,#22
|
||||
subtitle_size = 10,#20
|
||||
geom_ls = 10,
|
||||
xaxis_title = "Number of nsSNPs",
|
||||
xaxis_title = "Number of SAVs",
|
||||
yaxis_title = "Number of Sites",
|
||||
title_colour = "chocolate4",
|
||||
subtitle_text = NULL,
|
||||
|
@ -82,7 +82,7 @@ site_snp_count_bp <- function (plotdf,
|
|||
# sanity check
|
||||
if(tot_muts == nrow(plotdf)){
|
||||
cat("\nPASS: total number of mutations match"
|
||||
, "\nTotal no. of nsSNPs:", tot_muts)
|
||||
, "\nTotal no. of SAVs:", tot_muts)
|
||||
} else{
|
||||
cat("\nWARNING: total no. of muts = ", tot_muts
|
||||
, "\nExpected = ", nrow(plotdf))
|
||||
|
@ -106,13 +106,13 @@ site_snp_count_bp <- function (plotdf,
|
|||
, table(snpsBYpos_df$snpsBYpos)
|
||||
, "\n")
|
||||
|
||||
# calculating total no. of sites associated with nsSNPs
|
||||
# calculating total no. of sites associated with SAVs
|
||||
tot_sites = sum(table(snpsBYpos_df$snpsBYpos))
|
||||
|
||||
# sanity check
|
||||
if(tot_sites == length(unique(plotdf$position))){
|
||||
cat("\nPASS: total number of mutation sites match"
|
||||
, "\nTotal no. of sites with nsSNPs:", tot_sites)
|
||||
, "\nTotal no. of sites with SAVs:", tot_sites)
|
||||
} else{
|
||||
cat("WARNING: total no. of sites = ", tot_sites
|
||||
, "\nExpected = ", length(unique(plotdf$position)))
|
||||
|
@ -121,7 +121,7 @@ site_snp_count_bp <- function (plotdf,
|
|||
# FIXME: should really be legend title
|
||||
# but atm being using as plot title
|
||||
#my_leg_title
|
||||
bp_plot_title = paste0("Total nsSNPs: ", tot_muts
|
||||
bp_plot_title = paste0("Total SAVs: ", tot_muts
|
||||
, "\nTotal sites: ", tot_sites)
|
||||
|
||||
#-------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue