added functions dir for further tidying and tested this with ind scripts for stability
This commit is contained in:
parent
786eaabe1a
commit
4bee48f545
6 changed files with 108 additions and 107 deletions
50
scripts/plotting/functions/stability_count_bp.R
Normal file
50
scripts/plotting/functions/stability_count_bp.R
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env Rscript
|
||||
# load libraries
|
||||
#########################################################
|
||||
# TASK: function for basic barplot returning stability counts
|
||||
#########################################################
|
||||
# load libraries and functions
|
||||
library(ggplot2)
|
||||
theme_set(theme_grey())
|
||||
#==========================================================
|
||||
# my_stability_count(): basic barplots for stability counts
|
||||
# input args
|
||||
## df containing data to plot
|
||||
## df column name containing stability outcome
|
||||
## legend title
|
||||
## ...opt args
|
||||
#==========================================================
|
||||
stability_count_bp <- function(plotdf
|
||||
, df_colname
|
||||
, leg_title
|
||||
, axis_text_size = 25
|
||||
, axis_label_size = 22
|
||||
, leg_text_size = 20
|
||||
, yaxis_title = "Number of nsSNPs"
|
||||
, bp_plot_title = ""){
|
||||
|
||||
OutPlot_count = ggplot(plotdf, aes(x = eval(parse(text = df_colname)))) +
|
||||
geom_bar(aes(fill = eval(parse(text = df_colname))), show.legend = TRUE) +
|
||||
geom_label(stat = "count"
|
||||
, aes(label = ..count..)
|
||||
, color = "black"
|
||||
, show.legend = FALSE
|
||||
, size = 10) +
|
||||
theme(axis.text.x = element_blank()
|
||||
, axis.title.x = element_blank()
|
||||
, axis.title.y = element_text(size = axis_label_size)
|
||||
, axis.text.y = element_text(size = axis_text_size)
|
||||
, legend.position = c(0.73,0.8)
|
||||
, legend.text = element_text(size = leg_text_size)
|
||||
, legend.title = element_text(size = axis_label_size)
|
||||
, plot.title = element_text(size = axis_label_size)) +
|
||||
labs(title = bp_plot_title
|
||||
, y = yaxis_title) +
|
||||
scale_fill_discrete(name = leg_title
|
||||
, labels = c("Destabilising", "Stabilising"))
|
||||
|
||||
return(OutPlot_count)
|
||||
}
|
||||
#############################################################
|
||||
# end of function
|
||||
#############################################################
|
27
scripts/plotting/functions/test_functions.R
Normal file
27
scripts/plotting/functions/test_functions.R
Normal file
|
@ -0,0 +1,27 @@
|
|||
#=================
|
||||
# Test function
|
||||
#==================
|
||||
#source("../plotting_data.R")
|
||||
#infile = "/home/tanu/git/Data/streptomycin/output/gid_comb_stab_struc_params.csv"
|
||||
#pd_df = plotting_data(infile)
|
||||
#my_df = pd_df[[1]]
|
||||
#my_df_u = pd_df[[2]]
|
||||
#my_df_u_lig = pd_df[[3]]
|
||||
#dup_muts = pd_df[[4]]
|
||||
|
||||
#------------------------------
|
||||
# barplot for mscm stability
|
||||
#------------------------------
|
||||
#stability_count_bp(plotdf = my_df
|
||||
# , df_colname = "duet_outcome"
|
||||
# , leg_title = "DUET outcome")
|
||||
|
||||
#------------------------------
|
||||
# barplot for ligand affinity
|
||||
#------------------------------
|
||||
#stability_count_bp(plotdf = my_df_u
|
||||
# , df_colname = "ligand_outcome"
|
||||
# , leg_title = "Ligand outcome"
|
||||
# , bp_plot_title = "Sites < 10 Ang of ligand"
|
||||
#)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue