various changes

This commit is contained in:
Tanushree Tunstall 2022-08-08 16:48:40 +01:00
parent 5bdfd03443
commit 4ce2087224
3 changed files with 9 additions and 8 deletions

View file

@ -68,7 +68,7 @@ bp_stability_hmap <- function(plotdf = merged_df3
# Build data with colours # Build data with colours
# ~ ligand distance # ~ ligand distance
#========================= #=========================
plotdf = generate_distance_colour_map(plotdf, yvar_colname = stability_colname, debug=TRUE) plotdf = generate_distance_colour_map(plotdf, debug=TRUE)
# order the df by position and ensure it is a factor # order the df by position and ensure it is a factor
plotdf = plotdf[order(plotdf[[xvar_colname]]), ] plotdf = plotdf[order(plotdf[[xvar_colname]]), ]
@ -131,7 +131,7 @@ bp_stability_hmap <- function(plotdf = merged_df3
labs(title = p_title labs(title = p_title
, x = my_xlab , x = my_xlab
, y = my_ylab), , y = my_ylab),
generate_distance_legend(plotdf, yvar_colname = stability_colname), generate_distance_legend(plotdf),
ncol = 2, ncol = 2,
#align = "hv", #align = "hv",
rel_widths = c(9/10, 0.4/10) rel_widths = c(9/10, 0.4/10)

View file

@ -55,7 +55,6 @@ generate_distance_colour_map = function(plot_df,
} }
generate_distance_legend = function(plot_df, generate_distance_legend = function(plot_df,
yvar_colname,
xvar_colname = 'position', xvar_colname = 'position',
lig_dist_colname = "ligand_distance", lig_dist_colname = "ligand_distance",
legend_title = "Ligand\nDistance" legend_title = "Ligand\nDistance"

View file

@ -13,6 +13,11 @@
# input args # input args
#========================================================== #==========================================================
wideP_consurf2 <- function(plot_df wideP_consurf2 <- function(plot_df
, aa_pos_drug = NULL
, aa_pos_lig1 = NULL
, aa_pos_lig2 = NULL
, aa_pos_lig3 = NULL
, xvar_colname = "position" , xvar_colname = "position"
, yvar_colname = "consurf_score" , yvar_colname = "consurf_score"
, yvar_colourN_colname = "consurf_colour_rev" # num from 0-1 , yvar_colourN_colname = "consurf_colour_rev" # num from 0-1
@ -66,20 +71,17 @@ wideP_consurf2 <- function(plot_df
# 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 = F
, aa_pos_drug = aa_pos_drug
, drug_aa_colour = "purple" , drug_aa_colour = "purple"
, active_aa_pos = NULL , active_aa_pos = NULL
, active_aa_colour = "brown" , active_aa_colour = "brown"
, aa_pos_lig1 = NULL
, aa_colour_lig1 = "blue" , aa_colour_lig1 = "blue"
, tpos1 = 0 , tpos1 = 0
, aa_pos_lig2 = NULL
, aa_colour_lig2 = "cyan" , aa_colour_lig2 = "cyan"
, tpos2 = 0 , tpos2 = 0
, aa_pos_lig3 = NULL
, aa_colour_lig3 = "cornflowerblue" , aa_colour_lig3 = "cornflowerblue"
, tpos3 = 0 , tpos3 = 0
@ -487,7 +489,7 @@ wideP_consurf2 <- function(plot_df
if (annotate_ligand_distance){ if (annotate_ligand_distance){
cat('\nOutput: Plot + distance heat-bar + other stuff') cat('\nOutput: Plot + distance heat-bar + other stuff')
legs = cowplot::plot_grid(legend1 legs = cowplot::plot_grid(legend1
, generate_distance_legend(plot_df, yvar_colname = yvar_colname) , generate_distance_legend(plot_df)
, ncol = 1 , ncol = 1
, align = "hv" , align = "hv"
, rel_heights = c(2/4,3/4)) , rel_heights = c(2/4,3/4))