sourcing plotting_data for subcols_axis_PS

This commit is contained in:
Tanushree Tunstall 2020-08-26 12:07:04 +01:00
parent b754f26f9b
commit ed739aeb71
4 changed files with 110 additions and 90 deletions

View file

@ -4,6 +4,7 @@
# basic barplots with count of mutations
# basic barplots with frequency of count of mutations
#########################################################
#=======================================================================
# working dir and loading libraries
getwd()
setwd("~/git/LSHTM_analysis/scripts/plotting")
@ -14,18 +15,30 @@ library(ggplot2)
library(data.table)
library(dplyr)
source("plotting_data.R")
# should return
#my_df
#my_df_u
#dup_muts
#========================================================
# should return the following dfs, directories and variables
# my_df
# my_df_u
# my_df_u_lig
# dup_muts
cat(paste0("Directories imported:"
, "\ndatadir:", datadir
, "\nindir:", indir
, "\noutdir:", outdir
, "\nplotdir:", plotdir))
cat(paste0("Variables imported:"
, "\ndrug:", drug
, "\ngene:", gene
, "\ngene_match:", gene_match
, "\nLength of upos:", length(upos))
, "\nAngstrom symbol:", angstroms_symbol))
# clear excess variable
rm(my_df, upos, dup_muts, my_df_u_lig)
#=======================================================================
#=======
# output
#=======
@ -37,17 +50,16 @@ plot_basic_bp_duet = paste0(plotdir,"/", basic_bp_duet)
pos_count_duet = "position_count_PS.svg"
plot_pos_count_duet = paste0(plotdir, "/", pos_count_duet)
#%%===============================================================
#=======================================================================
#================
# Data for plots
#================
# REASSIGNMENT as necessary
df = my_df_u
rm(my_df, upos, dup_muts)
# sanity checks
str(df)
#%%=======================================================================
#=======================================================================
#****************
# Plot 1:Count of stabilising and destabilsing muts
#****************
@ -89,7 +101,9 @@ outPlot = g + geom_bar(aes(fill = duet_outcome)
print(outPlot)
dev.off()
#%%=======================================================================
table(df$duet_outcome)
#=======================================================================
#****************
# Plot 2: frequency of positions
#****************
@ -173,6 +187,6 @@ outPlot_pos = g + geom_bar(aes (alpha = 0.5)
print(outPlot_pos)
dev.off()
########################################################################
# end of DUET barplots
# end of Ligand barplots
########################################################################