some stuff

This commit is contained in:
Tanushree Tunstall 2022-08-12 10:03:32 +01:00
parent 365c322953
commit c6a720770d
4 changed files with 13 additions and 10 deletions

View file

@ -36,11 +36,11 @@ ColourPalleteMulti = function(df, group, subgroup){
bp_stability_hmap <- function(plot_df = merged_df3 bp_stability_hmap <- function(plot_df = merged_df3
, xvar_colname = "position" , xvar_colname = "position"
, yvar_colname = 'duet_scaled' #FIXME: temp, remove , yvar_colname = 'duet_scaled' # Only here so that you can do function(df)
#, bar_col_colname = "group" #, bar_col_colname = "group"
, stability_colname = "duet_scaled" , stability_colname = "duet_scaled" # Only here so that you can do function(df)
, stability_outcome_colname = "duet_outcome" , stability_outcome_colname = "duet_outcome" # Only here so that you can do function(df)
, p_title = "DUET" # "Protein stability (DUET)" , p_title = "DUMMY TITLE" # Only here so that you can do function(df)
, my_xaxls = 12 # x-axis label size , my_xaxls = 12 # x-axis label size
, my_yaxls = 20 # y-axis label size , my_yaxls = 20 # y-axis label size
, my_xaxts = 18 # x-axis text size , my_xaxts = 18 # x-axis text size

View file

@ -211,6 +211,7 @@ LogoPlotCustomH <- function(plot_df
#, labels = seq(0, (y_lim), by = y_axis_increment) #, labels = seq(0, (y_lim), by = y_axis_increment)
, limits = c(0, y_lim)) + , limits = c(0, y_lim)) +
labs(y=y_lab), labs(y=y_lab),
NULL,
ggplot(data=unique_colour_map2, aes( ggplot(data=unique_colour_map2, aes(
x=factor(position), 0 # heat-mapped distance tiles along the bot x=factor(position), 0 # heat-mapped distance tiles along the bot
, fill = position , fill = position
@ -239,7 +240,7 @@ LogoPlotCustomH <- function(plot_df
, legend.position = leg_pos , legend.position = leg_pos
, legend.direction = leg_dir , legend.direction = leg_dir
#, plot.background = element_blank() #, plot.background = element_blank()
, plot.margin = margin(t=0,b=0) , plot.margin = margin(t=0,b=1)
, panel.grid=element_blank() , panel.grid=element_blank()
, plot.background = element_rect(fill = theme_bgc, colour=NA) , plot.background = element_rect(fill = theme_bgc, colour=NA)
, panel.background = element_rect(fill = "transparent", colour=NA) , panel.background = element_rect(fill = "transparent", colour=NA)
@ -252,7 +253,7 @@ LogoPlotCustomH <- function(plot_df
labs(y = NULL), NULL, labs(y = NULL), NULL,
position_annotation(plot_df, bg=theme_bgc), position_annotation(plot_df, bg=theme_bgc),
ncol=1, align='v', rel_heights = c(16,1,-0.1, 1) ncol=1, align='v', rel_heights = c(16,0,1,0,1)
) )
} }
#LogoPlotCustomH(small_df3) #LogoPlotCustomH(small_df3)

View file

@ -305,7 +305,8 @@ LogoPlotSnps <- function(plot_df
, panel.grid=element_blank() , panel.grid=element_blank()
, panel.background = element_rect(fill = theme_bgc, colour=NA) , panel.background = element_rect(fill = theme_bgc, colour=NA)
) + ) +
scale_x_discrete(x_lab, labels=factor(unique_colour_map$position)) + scale_x_discrete(x_lab, labels=unique_colour_map$position) +
#scale_x_discrete(x_lab, labels=factor(unique_colour_map$position)) +
scale_color_manual(values=unique_colour_map$ligD_colours) + scale_color_manual(values=unique_colour_map$ligD_colours) +
scale_fill_manual(values=unique_colour_map$ligD_colours) + scale_fill_manual(values=unique_colour_map$ligD_colours) +
labs(y = NULL) labs(y = NULL)
@ -313,6 +314,7 @@ LogoPlotSnps <- function(plot_df
, position_annotation(plot_df, bg=theme_bgc) , position_annotation(plot_df, bg=theme_bgc)
, ncol=1 , ncol=1
, align = "v" , align = "v"
, axis='lr'
, rel_heights = c(7/10, 2/7,1/7, -0.1, 0.5/7)) , rel_heights = c(7/10, 2/7,1/7, -0.1, 0.5/7))
#------------------ #------------------
# Wild logo plot # Wild logo plot

View file

@ -27,7 +27,7 @@ wideP_consurf3 <- function(plot_df
, lower_EB_colname = "consurf_ci_lower" , lower_EB_colname = "consurf_ci_lower"
, plot_type = "point" # default is point , plot_type = "point" # default is point
, point_colours = consurf_bp_colours , point_colours
, p_size = 2 , p_size = 2
, leg_title1 = "" , leg_title1 = ""
, leg_labels = c("0": "Insufficient Data" , leg_labels = c("0": "Insufficient Data"
@ -328,7 +328,7 @@ wideP_consurf3 <- function(plot_df
g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)" g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)"
, yvar_colourN_colname))) , yvar_colourN_colname)))
g1_leg = g1_leg + scale_fill_manual(values = consurf_bp_colours , name = leg_title1) g1_leg = g1_leg + scale_fill_manual(values = point_colours , name = leg_title1)
g1_leg g1_leg
legend1 = get_legend(g1_leg) legend1 = get_legend(g1_leg)