diff --git a/scripts/plotting/basic_barplots_LIG.R b/scripts/plotting/basic_barplots_LIG.R index ac1123c..8e64937 100755 --- a/scripts/plotting/basic_barplots_LIG.R +++ b/scripts/plotting/basic_barplots_LIG.R @@ -78,7 +78,7 @@ theme_set(theme_grey()) # start plot 1 #-------------- g = ggplot(df, aes(x = ligand_outcome)) -outPlot = g + geom_bar(aes(fill = ligand_outcome) +OutPlot_lig_count = g + geom_bar(aes(fill = ligand_outcome) , show.legend = TRUE) + geom_label(stat = "count" , aes(label = ..count..) @@ -100,7 +100,7 @@ outPlot = g + geom_bar(aes(fill = ligand_outcome) scale_fill_discrete(name = "Ligand Outcome" , labels = c("Destabilising", "Stabilising")) -print(outPlot) +print(OutPlot_lig_count) dev.off() table(df$ligand_outcome) @@ -166,7 +166,7 @@ my_als = 22 # axis label size my_x = sort(unique(snpsBYpos_df$snpsBYpos)) g = ggplot(snpsBYpos_df, aes(x = snpsBYpos)) -outPlot_pos = g + geom_bar(aes (alpha = 0.5) +OutPlot_lig_pos_count = g + geom_bar(aes (alpha = 0.5) , show.legend = FALSE) + scale_x_continuous(breaks = unique(snpsBYpos_df$snpsBYpos)) + #scale_x_continuous(breaks = my_x) + @@ -185,7 +185,7 @@ outPlot_pos = g + geom_bar(aes (alpha = 0.5) labs(x = "Number of SNPs" , y = "Number of Sites") -print(outPlot_pos) +print(OutPlot_lig_pos_count) dev.off() ######################################################################## # end of lig barplots diff --git a/scripts/plotting/basic_barplots_PS.R b/scripts/plotting/basic_barplots_PS.R index 47d34d9..36c2483 100755 --- a/scripts/plotting/basic_barplots_PS.R +++ b/scripts/plotting/basic_barplots_PS.R @@ -64,7 +64,6 @@ str(df) # Plot 1:Count of stabilising and destabilsing muts #**************** -#svg("basic_barplots_PS.svg") svg(plot_basic_bp_duet) print(paste0("plot1 filename:", basic_bp_duet)) @@ -77,7 +76,7 @@ theme_set(theme_grey()) # start plot 1 #-------------- g = ggplot(df, aes(x = duet_outcome)) -outPlot = g + geom_bar(aes(fill = duet_outcome) +OutPlot_count = g + geom_bar(aes(fill = duet_outcome) , show.legend = TRUE) + geom_label(stat = "count" , aes(label = ..count..) @@ -99,7 +98,7 @@ outPlot = g + geom_bar(aes(fill = duet_outcome) scale_fill_discrete(name = "DUET Outcome" , labels = c("Destabilising", "Stabilising")) -print(outPlot) +print(OutPlot_count) dev.off() table(df$duet_outcome) @@ -153,7 +152,7 @@ foo = select(df, mutationinformation #-------------- # start plot 2 #-------------- -#svg("position_count_PS.svg") + svg(plot_pos_count_duet) print(paste0("plot filename:", plot_pos_count_duet)) @@ -165,7 +164,7 @@ my_als = 22 # axis label size my_x = sort(unique(snpsBYpos_df$snpsBYpos)) g = ggplot(snpsBYpos_df, aes(x = snpsBYpos)) -outPlot_pos = g + geom_bar(aes (alpha = 0.5) +OutPlot_pos_count = g + geom_bar(aes (alpha = 0.5) , show.legend = FALSE) + scale_x_continuous(breaks = unique(snpsBYpos_df$snpsBYpos)) + #scale_x_continuous(breaks = my_x) + @@ -184,9 +183,8 @@ outPlot_pos = g + geom_bar(aes (alpha = 0.5) labs(x = "Number of SNPs" , y = "Number of Sites") -print(outPlot_pos) +print(OutPlot_pos_count) dev.off() ######################################################################## # end of Ligand barplots ######################################################################## - diff --git a/scripts/plotting/logo_combined.R b/scripts/plotting/logo_combined.R index d40c501..387f1ca 100644 --- a/scripts/plotting/logo_combined.R +++ b/scripts/plotting/logo_combined.R @@ -222,7 +222,8 @@ my_df_snp$log10or = log10(my_df_snp$or_mychisq) logo_data = my_df_snp[, c("position", "mutant_type", "or_mychisq", "log10or")] logo_data_or = my_df_snp[, c("position", "mutant_type", "or_mychisq")] -wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = 0.0) +#wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = 0.0) +wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = NA) wide_df_or = as.matrix(wide_df_or) rownames(wide_df_or) = wide_df_or[,1] diff --git a/scripts/plotting/other_plots.R b/scripts/plotting/other_plots.R index 1497a8b..ba5409a 100644 --- a/scripts/plotting/other_plots.R +++ b/scripts/plotting/other_plots.R @@ -21,6 +21,10 @@ source("other_plots_data.R") dr_other_combined = "dr_other_muts.svg" plot_dr_other_combined = paste0(plotdir,"/", dr_other_combined) +dr_other_combined_labelled = "dr_other_muts_labelled.svg" +plot_dr_other_combined_labelled = paste0(plotdir,"/", dr_other_combined_labelled) + + dr_other_foldx = "dr_other_muts_foldx.svg" plot_dr_other_foldx = paste0(plotdir,"/", dr_other_foldx) @@ -214,6 +218,8 @@ svg(plot_dr_other_combined, width = 24, height = 12) # first combine fold and lig plots (2 and 3) c1 = cowplot::plot_grid(p2, p3 + , labels = c("(b)", "(c)") + , label_size = 25 , nrow = 1 , rel_widths = c(1/6, 5/6)) c1 @@ -223,6 +229,22 @@ OutPlot = cowplot::plot_grid(p1, c1 print(OutPlot) dev.off() +#========================================== +# labelled +cat("Output plot:", plot_dr_other_combined_labelled) +svg(plot_dr_other_combined_labelled, width = 24, height = 12) +plot_dr_other_combined_labelled + +Outplot_labelled = cowplot::plot_grid(p1, c1 + , nrow = 2 + , labels = c("(a)", "", "") + , label_size = 25) + +print(Outplot_labelled) + +dev.off() + + #--------- # plot 3: legend #---------