This commit is contained in:
Tanushree Tunstall 2022-08-27 15:35:41 +01:00
parent 79b251047d
commit c6f5a446c3
6 changed files with 56 additions and 55 deletions

View file

@ -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) +

View file

@ -61,24 +61,11 @@ 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)))
@ -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)

View file

@ -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(

View file

@ -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
# aa_pos_lig3=1:1000,
# drug_colour = "red",
# lig1_colour = "green",
# lig2_colour = "blue",
# lig3_colour = "skyblue"
# )

View file

@ -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)

View file

@ -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",
continuous = wrap(
"points",
alpha = 0.7,
size=0.125),
combo = wrap("dot",
size=0.125
),
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"))
# 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)