From 40e4ddd70ac035726b4c8ab36951999d3ee3c37f Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Thu, 17 Sep 2020 20:00:34 +0100 Subject: [PATCH] minor tweaks in logo and corr plots --- scripts/plotting/corr_PS_LIG.R | 9 +++++++-- scripts/plotting/logo_multiple_muts.R | 1 - scripts/plotting/logo_plot.R | 23 +++++++++++++++++------ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/scripts/plotting/corr_PS_LIG.R b/scripts/plotting/corr_PS_LIG.R index 0ea4a68..b6ea1d7 100644 --- a/scripts/plotting/corr_PS_LIG.R +++ b/scripts/plotting/corr_PS_LIG.R @@ -59,6 +59,9 @@ cat(paste0("Variables imported:" corr_ps = "corr_PS.svg" plot_corr_ps = paste0(plotdir,"/", corr_ps) +corr_ps_duet_col = "corr_PS_duet_coloured.svg" +plot_corr_ps_duet_col = paste0(plotdir,"/", corr_ps_duet_col) + corr_upper_ps = "corr_upper_PS.svg" plot_corr_upper_ps = paste0(plotdir,"/", corr_upper_ps) @@ -193,10 +196,12 @@ head(my_corr_ps) #--------------------------------------- # generate corr PS plot 1: both panels #--------------------------------------- - -cat("Corr plot PS:", plot_corr_ps) +cat("Corr plot PS DUET with coloured dots:", plot_corr_ps) svg(plot_corr_ps, width = 15, height = 15) +#cat("Corr plot PS DUET with coloured dots:",plot_corr_ps_duet_col) +#svg(plot_corr_ps_duet_col, width = 15, height = 15) + OutPlot1 = pairs.panels(my_corr_ps[1:(length(my_corr_ps)-1)] , method = "spearman" # correlation method , hist.col = "grey" ##00AFBB diff --git a/scripts/plotting/logo_multiple_muts.R b/scripts/plotting/logo_multiple_muts.R index f6d5344..fb9ec63 100644 --- a/scripts/plotting/logo_multiple_muts.R +++ b/scripts/plotting/logo_multiple_muts.R @@ -173,7 +173,6 @@ p3 = p2 + p3 - # Now combine using cowplot, which ensures the plots are aligned suppressMessages( require(cowplot) ) diff --git a/scripts/plotting/logo_plot.R b/scripts/plotting/logo_plot.R index a96cdb9..7294d8e 100644 --- a/scripts/plotting/logo_plot.R +++ b/scripts/plotting/logo_plot.R @@ -116,6 +116,7 @@ wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = 0.0) wide_df_or = as.matrix(wide_df_or) rownames(wide_df_or) = wide_df_or[,1] wide_df_or = wide_df_or[,-1] +str(wide_df_or) position_or = as.numeric(colnames(wide_df_or)) @@ -124,22 +125,32 @@ position_or = as.numeric(colnames(wide_df_or)) #============================================ # custom height (OR) logo plot: yayy works -ggseqlogo(wide_df_or, method="custom", seq_type="aa") + ylab("my custom height") + - theme(legend.position = "bottom" - , axis.text.x = element_text(size = 11 +cat("Logo plot with OR as y axis:", plot_logo_plot) +svg(plot_logo_plot, width = 30 , height = 6) + +logo_or = ggseqlogo(wide_df_or, method="custom", seq_type="aa") + ylab("my custom height") + + theme( axis.text.x = element_text(size = 16 , angle = 90 , hjust = 1 , vjust = 0.4) - , axis.text.y = element_text(size = 15 + , axis.text.y = element_text(size = 22 , angle = 0 , hjust = 1 - , vjust = 0))+ - scale_x_discrete("Position" + , vjust = 0) + , axis.title.y = element_text(size = 25) + , axis.title.x = element_text(size = 20) + #, legend.position = "bottom") + + , legend.position = "none")+ + #, legend.text = element_text(size = 15) + #, legend.title = element_text(size = 15))+ + scale_x_discrete("Position" #, breaks , labels = position_or , limits = factor(1:length(position_or))) + ylab("Odds Ratio") +print(logo_or) +dev.off() #%% end of logo plot with OR as height #=======================================================================