From c6a720770d7ad7d6660dd87bf2bd627d1096b644 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Fri, 12 Aug 2022 10:03:32 +0100 Subject: [PATCH] some stuff --- scripts/functions/bp_subcolours.R | 8 ++++---- scripts/functions/logoP_or.R | 7 ++++--- scripts/functions/logoP_snp.R | 4 +++- scripts/functions/wideP_consurf3.R | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/functions/bp_subcolours.R b/scripts/functions/bp_subcolours.R index 2be5e9b..24a6a58 100755 --- a/scripts/functions/bp_subcolours.R +++ b/scripts/functions/bp_subcolours.R @@ -36,11 +36,11 @@ ColourPalleteMulti = function(df, group, subgroup){ bp_stability_hmap <- function(plot_df = merged_df3 , 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" - , stability_colname = "duet_scaled" - , stability_outcome_colname = "duet_outcome" - , p_title = "DUET" # "Protein stability (DUET)" + , 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 diff --git a/scripts/functions/logoP_or.R b/scripts/functions/logoP_or.R index b47c375..965f5d7 100644 --- a/scripts/functions/logoP_or.R +++ b/scripts/functions/logoP_or.R @@ -210,7 +210,8 @@ LogoPlotCustomH <- function(plot_df , breaks = seq(0, (y_lim), by = y_axis_increment) #, labels = seq(0, (y_lim), by = y_axis_increment) , limits = c(0, y_lim)) + - labs(y=y_lab), + labs(y=y_lab), + NULL, ggplot(data=unique_colour_map2, aes( x=factor(position), 0 # heat-mapped distance tiles along the bot , fill = position @@ -239,7 +240,7 @@ LogoPlotCustomH <- function(plot_df , legend.position = leg_pos , legend.direction = leg_dir #, plot.background = element_blank() - , plot.margin = margin(t=0,b=0) + , plot.margin = margin(t=0,b=1) , panel.grid=element_blank() , plot.background = element_rect(fill = theme_bgc, colour=NA) , panel.background = element_rect(fill = "transparent", colour=NA) @@ -252,7 +253,7 @@ LogoPlotCustomH <- function(plot_df labs(y = NULL), NULL, 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) diff --git a/scripts/functions/logoP_snp.R b/scripts/functions/logoP_snp.R index a28c588..c492513 100644 --- a/scripts/functions/logoP_snp.R +++ b/scripts/functions/logoP_snp.R @@ -305,7 +305,8 @@ LogoPlotSnps <- function(plot_df , panel.grid=element_blank() , 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_fill_manual(values=unique_colour_map$ligD_colours) + labs(y = NULL) @@ -313,6 +314,7 @@ LogoPlotSnps <- function(plot_df , position_annotation(plot_df, bg=theme_bgc) , ncol=1 , align = "v" + , axis='lr' , rel_heights = c(7/10, 2/7,1/7, -0.1, 0.5/7)) #------------------ # Wild logo plot diff --git a/scripts/functions/wideP_consurf3.R b/scripts/functions/wideP_consurf3.R index 358418c..ac6c925 100644 --- a/scripts/functions/wideP_consurf3.R +++ b/scripts/functions/wideP_consurf3.R @@ -27,7 +27,7 @@ wideP_consurf3 <- function(plot_df , lower_EB_colname = "consurf_ci_lower" , plot_type = "point" # default is point - , point_colours = consurf_bp_colours + , point_colours , p_size = 2 , leg_title1 = "" , 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)" , 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 legend1 = get_legend(g1_leg)