This commit is contained in:
Tanushree Tunstall 2022-08-14 12:17:36 +01:00
parent c09d7530c9
commit 6f354ab390
10 changed files with 833 additions and 285 deletions

View file

@ -40,12 +40,12 @@ bp_stability_hmap <- function(plot_df = merged_df3
#, bar_col_colname = "group"
, stability_colname = "duet_scaled" # Only here so that you can do function(df)
, stability_outcome_colname = "duet_outcome" # Only here so that you can do function(df)
, p_title = "DUMMY TITLE" # Only here so that you can do function(df)
, my_xaxls = 12 # x-axis label size
, my_yaxls = 20 # y-axis label size
, my_xaxts = 18 # x-axis text size
, my_yaxts = 20 # y-axis text size
, my_pts = 20 # plot-title size
, p_title = "DUMMY TITLE", # Only here so that you can do function(df)
my_xaxls = 6, # x-axis label size
my_yaxls = 6, # y-axis label size
my_xaxts = 9, # x-axis text size
my_yaxts = 10, # y-axis text size
my_pts = 10 # plot-title size
, my_xlab = "Position"
, my_ylab = "No. of nsSNPs"
@ -68,7 +68,7 @@ bp_stability_hmap <- function(plot_df = merged_df3
# Build data with colours
# ~ ligand distance
#=========================
plot_df = generate_distance_colour_map(plot_df, debug=TRUE)
# plot_df = generate_distance_colour_map(plot_df, debug=TRUE)
# order the df by position and ensure it is a factor
plot_df = plot_df[order(plot_df[[xvar_colname]]), ]
@ -104,7 +104,7 @@ bp_stability_hmap <- function(plot_df = merged_df3
# , ordered = T)
)) +
geom_bar(aes(fill = group)
, colour = "grey") +
, colour = "grey", size=0.125) +
scale_fill_manual( values = subcols_bp_hmap
, guide = "none") +
@ -120,11 +120,12 @@ bp_stability_hmap <- function(plot_df = merged_df3
, hjust = 1
, vjust = 0)
, axis.title.x = element_blank()
, axis.ticks = element_blank()
#, axis.title.x = element_text(size = my_xaxts)
, axis.title.y = element_text(size = my_yaxts )
, plot.title = element_text(size = my_pts
, hjust = 0.5)
, panel.grid = element_blank()
# , panel.grid = element_blank()
, panel.background = element_rect(fill = "transparent", colour=NA)
) +
@ -132,25 +133,20 @@ bp_stability_hmap <- function(plot_df = merged_df3
, x = my_xlab
, y = my_ylab),
NULL,
ggplot(plot_df,
aes(x=factor(position), # THIS STUPID FUCKING FACTOR THING
)
) +
geom_tile(aes(y=0),
fill=plot_df$ligD_colours) +
scale_x_discrete("Position", labels=factor(plot_df$position)) +
theme_nothing() +
theme(plot.background = element_rect(fill = "transparent", colour=NA),
plot.margin = margin(t=0,b=0)) +
labs(x = NULL, y = NULL), #end of distance-heat-bar
NULL,
position_annotation(plot_df),
position_annotation(plot_df,
aa_pos_drug=aa_pos_drug,
active_aa_pos=active_aa_pos,
aa_pos_lig1=aa_pos_lig1,
aa_pos_lig2=aa_pos_lig2,
aa_pos_lig3=aa_pos_lig3
)
,
#generate_distance_legend(plot_df),
ncol = 1,
align = "v",
rel_heights = c(10,-0.1,1,-0.1,1)
rel_heights = c(10,-0.1,1)
#rel_widths = c(9/10, 0.4/10)
)
}
#bp_stability_hmap(small_df3)
#bp_stability_hmap(merged_df3)