added functions dir for further tidying and tested this with ind scripts for stability

This commit is contained in:
Tanushree Tunstall 2021-06-09 18:13:18 +01:00
parent 786eaabe1a
commit 4bee48f545
6 changed files with 108 additions and 107 deletions

View file

@ -23,6 +23,7 @@ require("getopt", quietly = TRUE) # cmd parse arguments
# load functions
source("plotting_globals.R")
source("plotting_data.R")
source("functions/stability_count_bp.R")
#########################################################
# command line args
#********************
@ -98,9 +99,10 @@ cat(paste0("Directories imported:"
, "\noutdir:", outdir
, "\nplotdir:", plotdir))
cat(paste0("Variables imported:"
cat(paste0("\nVariables imported:"
, "\ndrug:", drug
, "\ngene:", gene))
, "\ngene:", gene
, "\n))
#, "\ngene_match:", gene_match
#, "\nLength of upos:", length(upos)
#, "\nAngstrom symbol:", angstroms_symbol))
@ -129,45 +131,18 @@ str(df)
#****************
# Plot 1: Count of stabilising and destabilsing muts
#****************
svg(plot_basic_bp_duet)
print(paste0("plot1 filename:", basic_bp_duet))
my_ats = 25 # axis text size
my_als = 22 # axis label size
theme_set(theme_grey())
#--------------
# start plot 1
# start plot 1: call function
#--------------
g = ggplot(df, aes(x = duet_outcome))
OutPlot_count = g + geom_bar(aes(fill = duet_outcome)
, 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=my_als)
, axis.text.y = element_text(size = my_ats)
, legend.position = c(0.73,0.8)
, legend.text = element_text(size=my_als-2)
, legend.title = element_text(size=my_als)
, plot.title = element_blank()) +
labs(title = ""
, y = "Number of nsSNPs"
#, fill="DUET Outcome"
) +
scale_fill_discrete(name = "DUET Outcome"
, labels = c("Destabilising", "Stabilising"))
print(OutPlot_count)
stability_count_bp(plotdf = my_df_u
, df_colname = "duet_outcome"
, leg_title = "DUET outcome")
dev.off()
table(df$duet_outcome)
table(my_df_u$duet_outcome)
#=======================================================================
#****************
# Plot 2: frequency of positions
@ -252,4 +227,4 @@ print(OutPlot_pos_count)
dev.off()
########################################################################
# end of PS barplots
########################################################################
########################################################################