sourcing plotting_data for subcols_axis_PS

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

View file

@ -1,52 +1,21 @@
#########################################################
# TASK: Adding colours to positions labels according to
# active site residues. This is so these can be seen promptly
# when visualising the barplot.
#########################################################
#=======================================================================
getwd()
setwd("~/git/LSHTM_analysis/scripts/plotting")
getwd()
#########################################################
# TASK:
source("plotting_data.R")
# should return the following dfs and directories
# my_df
# my_df_u
# my_df_u_lig
# dup_muts
#########################################################
########################################################################
# Installing and loading required packages and functions #
########################################################################
#source("Header_TT.R")
#source("barplot_colour_function.R")
########################################################################
# Read file: call script for combining df for PS #
########################################################################
#?????????????
#
########################################################
#%% variable assignment: input and output paths & filenames
drug = "pyrazinamide"
gene = "pncA"
gene_match = paste0(gene,"_p.")
cat(gene_match)
#=============
# directories
#=============
datadir = paste0("~/git/Data")
indir = paste0(datadir, "/", drug, "/input")
outdir = paste0("~/git/Data", "/", drug, "/output")
#======
# input
#======
#in_filename = "mcsm_complex1_normalised.csv"
in_filename_params = paste0(tolower(gene), "_all_params.csv")
infile_params = paste0(outdir, "/", in_filename_params)
cat(paste0("Input file:", infile_params) )
#=======
# output
#=======
#%%===============================================================
#=======================================================================
###########################
# Read file: struct params
###########################
@ -83,7 +52,7 @@ if ( length(unique(my_df$mutationinformation)) != length(my_df$mutationinformati
upos = unique(my_df_u$position)
cat("Dim of clean df:"); cat(dim(my_df_u))
cat("\nNo. of unique mutational positions:"); cat(length(upos))
#======================================================
#=======================================================================
# create a new df with unique position numbers and cols
position = unique(my_df$position) #130
position_cols = as.data.frame(position)
@ -235,6 +204,5 @@ rm(aa_cols_ref
, lab_bg
, lab_bg2
, lab_fg
, position
, dup_muts)
, position)