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

@ -14,8 +14,8 @@
# ...other params
# Returns: Logo plot from combined data containing all nsSNPs per position.
# Helps to see the overview of SNP diversity
# Returns: Logo plot from combined data containing all SAVs per position.
# Helps to see the overview of SAV diversity
# TODO: SHINY
# select/drop down: omit_snp_count
@ -37,7 +37,7 @@ LogoPlotSnps <- function(plot_df
, omit_snp_count = c(0) # can be 1, 2, etc.
, my_logo_col = "chemistry"
, x_lab = "Position"
, y_lab = "nsSNP Count"
, y_lab = "SAV Count"
, x_ats = 6 # text size
, x_tangle = 90 # text angle
, y_ats = 10
@ -63,7 +63,7 @@ LogoPlotSnps <- function(plot_df
omit_snp_count <- as.numeric(unlist(str_extract_all(omit_snp_count, regex("[0-9]+"))))
}
############################################
# Data processing for logo plot for nsSNPS
# Data processing for logo plot for SAVS
############################################
# Generate "ligand distance" colour map
@ -84,7 +84,7 @@ LogoPlotSnps <- function(plot_df
max_mut = max(table(mutable_df[[x_axis_colname]]))
# Subset Data as specified by user
cat("\nDisplaying nsSNP position frequency:\n")
cat("\nDisplaying SAV position frequency:\n")
print(table(mutable_df$mut_pos_occurrence))
if ( (length(omit_snp_count) ==1) && (omit_snp_count == 0) ){
@ -93,8 +93,8 @@ LogoPlotSnps <- function(plot_df
max_mult_mut = max(table(my_data_snp[[x_axis_colname]]))
if (debug) {
cat("\nNo filtering requested:"
, "\nTotal no. of nsSNPs:", sum(table(mutable_df$mut_pos_occurrence))
, "\nTotal no. of nsSNPs omitted:", sum(table(mutable_df$mut_pos_occurrence)[omit_snp_count])
, "\nTotal no. of SAVs:", sum(table(mutable_df$mut_pos_occurrence))
, "\nTotal no. of SAVs omitted:", sum(table(mutable_df$mut_pos_occurrence)[omit_snp_count])
, "\nDim of data:", dim(my_data_snp)
, "\nNo. of positions:", length(u)
, "\nMax no. of muts at any position:", max_mult_mut)
@ -109,15 +109,15 @@ LogoPlotSnps <- function(plot_df
max_mult_mut = max(table(my_data_snp[[x_axis_colname]]))
if (debug) {
if (got_rows == exp_nrows) {
cat("\nPass: Position with the stated nsSNP frequency filtered:", omit_snp_count
, "\nTotal no. of nsSNPs:", sum(table(mutable_df$mut_pos_occurrence))
, "\nTotal no. of nsSNPs omitted:", sum(table(mutable_df$mut_pos_occurrence)[omit_snp_count])
cat("\nPass: Position with the stated SAV frequency filtered:", omit_snp_count
, "\nTotal no. of SAVs:", sum(table(mutable_df$mut_pos_occurrence))
, "\nTotal no. of SAVs omitted:", sum(table(mutable_df$mut_pos_occurrence)[omit_snp_count])
, "\nDim of subsetted data:", dim(my_data_snp)
, "\nNo. of positions:", length(u)
, "\nMax no. of muts at any position:", max_mult_mut)
} else {
cat("\nFAIL:Position with the stated nsSNP frequency COULD NOT be filtered..."
cat("\nFAIL:Position with the stated SAV frequency COULD NOT be filtered..."
, "\nExpected:",exp_nrows
, "\nGot:", got_rows )
}
@ -212,7 +212,7 @@ LogoPlotSnps <- function(plot_df
position_mt = as.numeric(colnames(tab_mt))
position_wt = as.numeric(colnames(tab_wt))
#####################################
# Generating logo plots for nsSNPs
# Generating logo plots for SAVs
#####################################
#-------------------
# Mutant logo plot