diff --git a/scripts/functions/bp_subcolours.R b/scripts/functions/bp_subcolours.R index a9e3ae3..6b8d52c 100755 --- a/scripts/functions/bp_subcolours.R +++ b/scripts/functions/bp_subcolours.R @@ -56,7 +56,8 @@ bp_stability_hmap <- function(plot_df = merged_df3 , tW0 = 1 , tH0 = 0.2, y_max_override = 1, # an override for tidily plotting multiple different-ranged plots together - reorder_position = FALSE # enable to reorder according to plot_df$pos_count + reorder_position = FALSE, # enable to reorder according to plot_df$pos_count + ... @@ -103,7 +104,8 @@ bp_stability_hmap <- function(plot_df = merged_df3 active_aa_pos=active_aa_pos, aa_pos_lig1=aa_pos_lig1, aa_pos_lig2=aa_pos_lig2, - aa_pos_lig3=aa_pos_lig3 + aa_pos_lig3=aa_pos_lig3, + ... ) subcols_plot = ggplot(plot_df) + diff --git a/scripts/functions/logoP_or.R b/scripts/functions/logoP_or.R index 7069afa..ba1e582 100644 --- a/scripts/functions/logoP_or.R +++ b/scripts/functions/logoP_or.R @@ -61,25 +61,12 @@ LogoPlotCustomH <- function(plot_df , leg_tts = 8 # leg title size , tpos0 = 0 # 0 is a magic number that does my sensible default , tW0 = 1 - , tH0 = 0.3 + , tH0 = 0.3, + ... ) { - ################################# - # Data processing for logo plot - ################################# - # plot_df = generate_distance_colour_map(plot_df, debug=TRUE) - - # unique_colour_map = unique(plot_df[,c("position","ligD_colours")]) - # unique_colour_map = unique_colour_map[order(unique_colour_map$position), ] - # rownames(unique_colour_map) = unique_colour_map$position - # - # unique_colour_map2 = unique_colour_map - # unique_colour_map2$position=as.factor(unique_colour_map2$position) - # unique_colour_map2$ligD_colours = as.factor(unique_colour_map2$ligD_colours) - # - - + if (rm_empty_y){ cat(paste0("Original Rows: ",nrow(plot_df))) plot_df = plot_df[!is.na(plot_df[y_axis_colname]),] @@ -231,7 +218,8 @@ LogoPlotCustomH <- function(plot_df active_aa_pos=active_aa_pos, aa_pos_lig1=aa_pos_lig1, aa_pos_lig2=aa_pos_lig2, - aa_pos_lig3=aa_pos_lig3 + aa_pos_lig3=aa_pos_lig3, + ... ), ncol=1, align='v', rel_heights = c(6,1) diff --git a/scripts/functions/logoP_snp.R b/scripts/functions/logoP_snp.R index 7e13acd..0522141 100644 --- a/scripts/functions/logoP_snp.R +++ b/scripts/functions/logoP_snp.R @@ -51,7 +51,8 @@ LogoPlotSnps <- function(plot_df , tpos0 = 0 # 0 is a magic number that does my sensible default , tW0 = 1 , tH0 = 0.2 - , debug=FALSE + , debug=FALSE, + ... ) @@ -286,7 +287,8 @@ LogoPlotSnps <- function(plot_df active_aa_pos=active_aa_pos, aa_pos_lig1=aa_pos_lig1, aa_pos_lig2=aa_pos_lig2, - aa_pos_lig3=aa_pos_lig3) + aa_pos_lig3=aa_pos_lig3, + ...) #aligned=align_plots(logo_top, logo_bottom, anno_bar, align='vh', axis='lr') cowplot::plot_grid( diff --git a/scripts/functions/position_annotation.R b/scripts/functions/position_annotation.R index 24b7edb..fb5775e 100644 --- a/scripts/functions/position_annotation.R +++ b/scripts/functions/position_annotation.R @@ -186,5 +186,9 @@ position_annotation=function(plot_df, # active_aa_pos=1:1000, # aa_pos_lig1=1:1000, # aa_pos_lig2=1:1000, -# aa_pos_lig3=1:1000 -# ) \ No newline at end of file +# aa_pos_lig3=1:1000, +# drug_colour = "red", +# lig1_colour = "green", +# lig2_colour = "blue", +# lig3_colour = "skyblue" +# ) \ No newline at end of file diff --git a/scripts/functions/position_count_bp.R b/scripts/functions/position_count_bp.R index a53fe21..accc85a 100755 --- a/scripts/functions/position_count_bp.R +++ b/scripts/functions/position_count_bp.R @@ -22,20 +22,22 @@ theme_set(theme_grey()) # visually might be nicer for it to be inside the plot #================================================================= -site_snp_count_bp <- function (plotdf - , df_colname = "position" +site_snp_count_bp <- function (plotdf, + df_colname = "position", #, bp_plot_title = "" #, leg_title = "Legend title" - , leg_text_size = 10#20 - , axis_text_size = 10#25 - , axis_label_size = 10#22 - , subtitle_size = 10#20 - , geom_ls = 10 - , xaxis_title = "Number of nsSNPs" - , yaxis_title = "Number of Sites" - , title_colour = "chocolate4" - , subtitle_text = NULL - , subtitle_colour = "pink") + leg_text_size = 10,#20 + axis_text_size = 10,#25 + axis_label_size = 10,#22 + subtitle_size = 10,#20 + geom_ls = 10, + xaxis_title = "Number of nsSNPs", + yaxis_title = "Number of Sites", + title_colour = "chocolate4", + subtitle_text = NULL, + subtitle_colour = "pink", + ... + ) { plotdf = as.data.frame(plotdf) diff --git a/scripts/plotting/plotting_thesis/alr/gg_pairs_all_alr.R b/scripts/plotting/plotting_thesis/alr/gg_pairs_all_alr.R index 0a25c05..3cd6fc6 100644 --- a/scripts/plotting/plotting_thesis/alr/gg_pairs_all_alr.R +++ b/scripts/plotting/plotting_thesis/alr/gg_pairs_all_alr.R @@ -5,7 +5,7 @@ #======= # output #======= -#outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/") +outdir_images = paste0("/home/pub/Work/LSHTM/Thesis_Plots/pairs/") #cat("plots will output to:", outdir_images) my_gg_pairs=function(plot_df, plot_title @@ -20,28 +20,31 @@ my_gg_pairs=function(plot_df, plot_title title="ρ", digits=2, justify_labels = "centre", - title_args=list(size=tt_args_size, colour="black"),#2.5 - group_args=list(size=gp_args_size)#2.5 + title_args=list(size=tt_args_size, colour="black")#,#2.5 + #group_args=list(size=gp_args_size)#2.5 ) ), lower = list( - continuous = wrap("points", - alpha = 0.7, - size=0.125), - combo = wrap("dot", - alpha = 0.7, - size=0.125) + continuous = wrap( + "points", + alpha = 0.7, + size=0.125 ), - aes(colour = factor(ifelse(dst_mode==0, - "S", - "R") ), - alpha = 0.5), - title=plot_title) + - - scale_colour_manual(values = c("red", "blue")) + - scale_fill_manual(values = c("red", "blue")) #+ - # theme(text = element_text(size=7, - # face="bold")) + combo = wrap( + "dot", + alpha = 0.7, + size=0.125) + ), + # aes(colour = factor(ifelse(dst_mode==0, + # "S", + # "R") ), + # alpha = 0.5), + title=plot_title) #+ +# +# scale_colour_manual(values = c("red", "blue")) + +# scale_fill_manual(values = c("red", "blue")) #+ +# theme(text = element_text(size=7, +# face="bold")) } DistCutOff = 10 @@ -152,7 +155,7 @@ plot_corr_df_aff = my_gg_pairs(corr_df_aff , plot_title="Affinity estimates" #, tt_args_size = 4 #, gp_args_size = 4 - ) +) #### Combine plots ##### # #png("/home/tanu/tmp/gg_pairs_all.png", height = 6, width=11.75, unit="in",res=300)