This commit is contained in:
Tanushree Tunstall 2022-05-05 13:36:03 +01:00
commit d61d11e020
6 changed files with 33 additions and 14 deletions

View file

@ -5,9 +5,9 @@
######################################## ########################################
lin_count_bp <- function( lf_data = lin_lf lin_count_bp <- function( lf_data = lin_lf
, all_lineages = F
, x_categ = "sel_lineages" , x_categ = "sel_lineages"
, y_count = "p_count" , y_count = "p_count"
, all_lineages = F
, use_lineages = c("L1", "L2", "L3", "L4") , use_lineages = c("L1", "L2", "L3", "L4")
, bar_fill_categ = "count_categ" , bar_fill_categ = "count_categ"
, display_label_col = "p_count" , display_label_col = "p_count"

View file

@ -238,12 +238,31 @@ wideP_consurf <- function(plotdf
my_xlim = length(unique(plotdf[[xvar_colname]])); my_xlim my_xlim = length(unique(plotdf[[xvar_colname]])); my_xlim
ymin = min(plotdf[[yvar_colname]]); ymin ymin = min(plotdf[[yvar_colname]]); ymin
ymax = max(plotdf[[yvar_colname]]); ymax ymax = max(plotdf[[yvar_colname]]); ymax
# DEBUG
# x_factor = as.factor(plotdf[[xvar_colname]])
# y_colour_factor = as.factor(plotdf[[yvar_colourN_colname]])
# cat('XXXX THIS:', str(x_factor))
#
# g = ggplot(plotdf, aes_string(x = x_factor)
# , y = yvar_colname
# , colour = y_colour_factor)
g = ggplot(plotdf, aes_string(x = sprintf("factor(%s)", xvar_colname) g = ggplot(plotdf, aes_string(x = sprintf("factor(%s)", xvar_colname)
, y = yvar_colname , y = yvar_colname
, colour = sprintf("factor(%s)", yvar_colourN_colname) , colour = sprintf("factor(%s)", yvar_colourN_colname)
)) ))
# "if SPECIAL do SPECIAL THING, otherwise do NORMAL THING" # g = ggplot(plotdf, aes_string(x = "position")
# , y = "consurf_score"
# , colour = "consurf_colour_rev")
# g = ggplot(plotdf, aes_string(x = "position")
# , y = "consurf_score"
# , colour = "consurf_colour_rev")
# DEBUG
#g0=g
"if SPECIAL do SPECIAL THING, otherwise do NORMAL THING"
if (plot_type == "bar"){ if (plot_type == "bar"){
g0 = g + g0 = g +
geom_bar(stat = "identity") geom_bar(stat = "identity")
@ -266,9 +285,9 @@ wideP_consurf <- function(plotdf
)) ))
}else{ }else{
g0 = g0 g0 = g0
} }
#--------------------- #---------------------
# add axis formatting # add axis formatting

View file

@ -8,7 +8,7 @@
lf_bp <- function(lf_df = lf_duet lf_bp <- function(lf_df = lf_duet
, p_title = "DUET-DDG" , p_title = "DUET-DDG"
, colour_categ = "duet_outcome" , colour_categ = "outcome"
, x_grp = "mutation_info_labels" , x_grp = "mutation_info_labels"
, y_var = "param_value" , y_var = "param_value"
, facet_var = "param_type" , facet_var = "param_type"

View file

@ -52,8 +52,8 @@ LogoPlotSnps <- function(plot_df
{ {
# handle funky omit_snp_count. DOES NOT WORK YET # handle funky omit_snp_count. DOES NOT WORK YET
if (class(omit_snp_count != 'numeric')){ if (class(omit_snp_count) != "numeric"){
omit_snp_count <- as.numeric(unlist(str_extract_all(thing, regex("[0-9]")))) 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 nsSNPS

View file

@ -40,7 +40,7 @@ my_corr_pairs <- function (corr_data_all
###################################################################### ######################################################################
my_pp = function (x, smooth = TRUE, scale = FALSE, density = TRUE, ellipses = TRUE, my_pp = function (x, smooth = TRUE, scale = FALSE, density = TRUE, ellipses = TRUE,
digits = 2, method = "pearson", pch = 20, lm = FALSE, cor = TRUE, digits = 2, method = "spearman", pch = 20, lm = FALSE, cor = TRUE,
jiggle = FALSE, factor = 2, hist.col = "cyan", show.points = TRUE, jiggle = FALSE, factor = 2, hist.col = "cyan", show.points = TRUE,
rug = TRUE, breaks = "Sturges", cex.cor = 1, wt = NULL, smoother = FALSE, rug = TRUE, breaks = "Sturges", cex.cor = 1, wt = NULL, smoother = FALSE,
stars = FALSE, ci = FALSE, alpha = 0.05, ...) stars = FALSE, ci = FALSE, alpha = 0.05, ...)

View file

@ -15,8 +15,8 @@ theme_set(theme_grey())
## ...opt args ## ...opt args
#========================================================== #==========================================================
stability_count_bp <- function(plotdf stability_count_bp <- function(plotdf
, df_colname = "duet_outcome" , df_colname = ""
, leg_title = "DUET" , leg_title = ""
, ats = 25 # axis text size , ats = 25 # axis text size
, als = 22 # axis label size , als = 22 # axis label size
, lts = 20 # legend text size , lts = 20 # legend text size