adde format_results_dynamut2.py and ran shiny scripts for barplots
This commit is contained in:
parent
8cdf720702
commit
f7aac58081
9 changed files with 235 additions and 59 deletions
|
@ -23,7 +23,7 @@ my_df_u_lig = data.frame()
|
|||
dup_muts = data.frame()
|
||||
|
||||
#===========================
|
||||
# Read file: struct params
|
||||
# Read file: struct params
|
||||
#===========================
|
||||
#df = read.csv(infile_params, header = T)
|
||||
|
||||
|
|
|
@ -30,8 +30,12 @@ site_snp_count_bp <- function (plotdf
|
|||
, axis_text_size = 25
|
||||
, axis_label_size = 22
|
||||
, xaxis_title = "Number of nsSNPs"
|
||||
, yaxis_title = "Number of Sites"){
|
||||
|
||||
, yaxis_title = "Number of Sites"
|
||||
, title_colour = "chocolate4"
|
||||
, subtitle_text = NULL
|
||||
, subtitle_size = 20
|
||||
, subtitle_colour = "pink")
|
||||
{
|
||||
# dim of plotdf
|
||||
cat(paste0("\noriginal df dimensions:"
|
||||
, "\nNo. of rows:", nrow(plotdf)
|
||||
|
@ -83,9 +87,9 @@ site_snp_count_bp <- function (plotdf
|
|||
|
||||
# FIXME: should really be legend title
|
||||
# but atm being using as plot title
|
||||
my_leg_title = paste0("Total nsSNPs:", tot_muts
|
||||
, ", Total no. of nsSNPs sites:", tot_sites)
|
||||
bp_plot_title = my_leg_title
|
||||
#my_leg_title
|
||||
bp_plot_title = paste0("Total nsSNPs: ", tot_muts
|
||||
, ", Total no. of nsSNPs sites: ", tot_sites)
|
||||
|
||||
#-------------
|
||||
# start plot 2
|
||||
|
@ -111,11 +115,16 @@ site_snp_count_bp <- function (plotdf
|
|||
#, 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 = leg_text_size)) +
|
||||
, plot.title = element_text(size = leg_text_size
|
||||
, colour = title_colour)
|
||||
, plot.subtitle = element_text(size = subtitle_size
|
||||
, hjust = 0.5
|
||||
, colour = subtitle_colour)) +
|
||||
|
||||
labs(title = bp_plot_title
|
||||
, x = xaxis_title
|
||||
, y = yaxis_title)
|
||||
, subtitle = subtitle_text
|
||||
, x = xaxis_title
|
||||
, y = yaxis_title)
|
||||
|
||||
return(OutPlot_pos_count)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,14 @@ stability_count_bp <- function(plotdf
|
|||
, leg_text_size = 20
|
||||
, leg_title_size = 22
|
||||
, yaxis_title = "Number of nsSNPs"
|
||||
, bp_plot_title = ""){
|
||||
, bp_plot_title = ""
|
||||
, label_categories = c("Destabilising", "Stabilising")
|
||||
, title_colour = "chocolate4"
|
||||
, subtitle_text = NULL
|
||||
, subtitle_size = 20
|
||||
, subtitle_colour = "pink"
|
||||
#, leg_position = c(0.73,0.8) # within plot area
|
||||
, leg_position = "top"){
|
||||
|
||||
OutPlot_count = ggplot(plotdf, aes(x = eval(parse(text = df_colname)))) +
|
||||
geom_bar(aes(fill = eval(parse(text = df_colname))), show.legend = TRUE) +
|
||||
|
@ -35,14 +42,20 @@ stability_count_bp <- function(plotdf
|
|||
, 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.position = leg_position
|
||||
, legend.text = element_text(size = leg_text_size)
|
||||
, legend.title = element_text(size = leg_title_size)
|
||||
, plot.title = element_text(size = axis_label_size)) +
|
||||
labs(title = bp_plot_title
|
||||
, y = yaxis_title) +
|
||||
, plot.title = element_text(size = axis_label_size
|
||||
, colour = title_colour)
|
||||
, plot.subtitle = element_text(size = subtitle_size
|
||||
, hjust = 0.5
|
||||
, colour = subtitle_colour)) +
|
||||
labs(title = bp_plot_title
|
||||
, subtitle = subtitle_text
|
||||
, y = yaxis_title) +
|
||||
scale_fill_discrete(name = leg_title
|
||||
, labels = c("Destabilising", "Stabilising"))
|
||||
#, labels = c("Destabilising", "Stabilising")
|
||||
, labels = label_categories)
|
||||
|
||||
return(OutPlot_count)
|
||||
}
|
||||
|
|
|
@ -6,21 +6,24 @@ getwd()
|
|||
# load functions, data, dirs, hardocded vars
|
||||
# that will be used in testing the functions
|
||||
#===========================================
|
||||
source("plotting_data.R")
|
||||
infile = "/home/tanu/git/Data/streptomycin/output/gid_comb_stab_struc_params.csv"
|
||||
drug = "streptomycin"
|
||||
gene = "gid"
|
||||
|
||||
source("plotting_data.R")
|
||||
|
||||
infile = paste0("~/git/Data/", drug, "/output/", gene, "_comb_stab_struc_params.csv")
|
||||
infile_df = read.csv(infile)
|
||||
|
||||
lig_dist = 5
|
||||
pd_df = plotting_data(infile_df
|
||||
, lig_dist_colname = 'ligand_distance'
|
||||
, lig_dist_cutoff = lig_dist)
|
||||
|
||||
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]]
|
||||
|
||||
source("plotting_globals.R")
|
||||
drug = "streptomycin"
|
||||
gene = "gid"
|
||||
|
||||
import_dirs(drug, gene)
|
||||
|
||||
#=====================
|
||||
# functions to test
|
||||
#=====================
|
||||
|
@ -40,7 +43,9 @@ print(paste0("plot filename:", basic_bp_duet))
|
|||
# function only
|
||||
stability_count_bp(plotdf = my_df_u
|
||||
, df_colname = "duet_outcome"
|
||||
, leg_title = "DUET outcome")
|
||||
, leg_title = "DUET outcome"
|
||||
, label_categories = c("Destabilising", "Stabilising")
|
||||
, leg_position = "top")
|
||||
|
||||
dev.off()
|
||||
|
||||
|
@ -54,10 +59,13 @@ svg(plot_basic_bp_ligand)
|
|||
print(paste0("plot filename:", basic_bp_ligand))
|
||||
|
||||
# function only
|
||||
lig_dist = 10
|
||||
stability_count_bp(plotdf = my_df_u_lig
|
||||
, df_colname = "ligand_outcome"
|
||||
, leg_title = "Ligand outcome"
|
||||
, bp_plot_title = "Sites < 10 Ang of ligand")
|
||||
, yaxis_title = paste0("Number of nsSNPs\nLigand dist: <", lig_dist, "\u212b")
|
||||
#, bp_plot_title = "Sites < 10 Ang of ligand"
|
||||
)
|
||||
|
||||
dev.off()
|
||||
# ------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue