various changes

This commit is contained in:
Tanushree Tunstall 2022-08-09 13:46:05 +01:00
parent 4ce2087224
commit 79d83b6240

View file

@ -17,6 +17,7 @@ wideP_consurf2 <- function(plot_df
, aa_pos_lig1 = NULL , aa_pos_lig1 = NULL
, aa_pos_lig2 = NULL , aa_pos_lig2 = NULL
, aa_pos_lig3 = NULL , aa_pos_lig3 = NULL
, active_aa_pos = NULL
, xvar_colname = "position" , xvar_colname = "position"
, yvar_colname = "consurf_score" , yvar_colname = "consurf_score"
@ -70,10 +71,9 @@ wideP_consurf2 <- function(plot_df
, tH0 = 0.3 , tH0 = 0.3
# Custom 3: x-axis: geom tiles ~ active sites and ligand # Custom 3: x-axis: geom tiles ~ active sites and ligand
, annotate_active_sites = F , annotate_active_sites = T
, drug_aa_colour = "purple" , drug_aa_colour = "purple"
, active_aa_pos = NULL
, active_aa_colour = "brown" , active_aa_colour = "brown"
, aa_colour_lig1 = "blue" , aa_colour_lig1 = "blue"
@ -86,6 +86,7 @@ wideP_consurf2 <- function(plot_df
, tpos3 = 0 , tpos3 = 0
, default_gt_clr = "white" , default_gt_clr = "white"
, build_plot_df=FALSE
, debug=FALSE , debug=FALSE
){ ){
@ -181,15 +182,16 @@ wideP_consurf2 <- function(plot_df
# Build Data with colours # Build Data with colours
# ~ on active sites # ~ on active sites
#========================== #==========================
if(annotate_active_sites) {
cat("\nAnnotation for xvar requested. Building colours for annotation...")
aa_colour_colname = "bg_all" aa_colour_colname = "bg_all"
aa_colour_colname1 = "col_bg1" aa_colour_colname1 = "col_bg1"
aa_colour_colname2 = "col_bg2" aa_colour_colname2 = "col_bg2"
aa_colour_colname3 = "col_bg3" aa_colour_colname3 = "col_bg3"
if (build_plot_df) {
if(annotate_active_sites) {
cat("\nAnnotation for xvar requested. Building colours for annotation...")
#-------------------------------------------------- #--------------------------------------------------
# column colour 0: Active site + drug binding sites # column colour 0: Active site + drug binding sites
#-------------------------------------------------- #--------------------------------------------------
@ -222,6 +224,18 @@ wideP_consurf2 <- function(plot_df
, aa_colour_lig3, plot_df[[aa_colour_colname2]]) , aa_colour_lig3, plot_df[[aa_colour_colname2]])
} }
} else {
# set these to the string "DUMMY" so that the build-up-the-tiles bit works
aa_pos_drug = "DUMMY"
aa_pos_lig1 = "DUMMY"
active_aa_pos = "DUMMY"
if (aa_colour_colname2 %in% colnames(merged_df3)) {
aa_pos_lig2 = "DUMMY"
if (aa_colour_colname3 %in% colnames(merged_df3)) {
aa_pos_lig2 = "DUMMY"
}
}
}
################### ###################
# start plot # start plot
################### ###################
@ -456,7 +470,7 @@ wideP_consurf2 <- function(plot_df
cat("\nDone Plot with 1 ligand") cat("\nDone Plot with 1 ligand")
} else {cat("\n3 Lig Plot condition FAIL")} } else {cat("\n1 Lig Plot condition FAIL")}
#----------------------------------- #-----------------------------------
# Add2plot:NO ligands # Add2plot:NO ligands