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 912a439589
commit cbb3749a21
6 changed files with 108 additions and 107 deletions

View file

@ -99,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))
@ -130,46 +131,19 @@ str(df)
#****************
# Plot 1: Count of stabilising and destabilsing muts
#****************
#svg("basic_barplots_LIG.svg")
svg(plot_basic_bp_ligand)
print(paste0("plot1 filename:", basic_bp_ligand))
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 = ligand_outcome))
OutPlot_lig_count = g + geom_bar(aes(fill = ligand_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="ligand_outcome"
) +
scale_fill_discrete(name = "Ligand Outcome"
, labels = c("Destabilising", "Stabilising"))
print(OutPlot_lig_count)
stability_count_bp(plotdf = my_df_u_lig
, df_colname = "ligand_outcome"
, leg_title = "Ligand outcome")
dev.off()
table(df$ligand_outcome)
table(my_df_u_lig$ligand_outcome)
#=======================================================================
#****************
# Plot 2: frequency of positions
@ -255,4 +229,4 @@ print(OutPlot_lig_pos_count)
dev.off()
########################################################################
# end of LIG barplots
########################################################################
########################################################################