stuff
This commit is contained in:
parent
79b251047d
commit
c6f5a446c3
6 changed files with 56 additions and 55 deletions
|
@ -56,7 +56,8 @@ bp_stability_hmap <- function(plot_df = merged_df3
|
||||||
, tW0 = 1
|
, tW0 = 1
|
||||||
, tH0 = 0.2,
|
, tH0 = 0.2,
|
||||||
y_max_override = 1, # an override for tidily plotting multiple different-ranged plots together
|
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,
|
active_aa_pos=active_aa_pos,
|
||||||
aa_pos_lig1=aa_pos_lig1,
|
aa_pos_lig1=aa_pos_lig1,
|
||||||
aa_pos_lig2=aa_pos_lig2,
|
aa_pos_lig2=aa_pos_lig2,
|
||||||
aa_pos_lig3=aa_pos_lig3
|
aa_pos_lig3=aa_pos_lig3,
|
||||||
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
subcols_plot = ggplot(plot_df) +
|
subcols_plot = ggplot(plot_df) +
|
||||||
|
|
|
@ -61,25 +61,12 @@ LogoPlotCustomH <- function(plot_df
|
||||||
, leg_tts = 8 # leg title size
|
, leg_tts = 8 # leg title size
|
||||||
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
||||||
, tW0 = 1
|
, 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){
|
if (rm_empty_y){
|
||||||
cat(paste0("Original Rows: ",nrow(plot_df)))
|
cat(paste0("Original Rows: ",nrow(plot_df)))
|
||||||
plot_df = plot_df[!is.na(plot_df[y_axis_colname]),]
|
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,
|
active_aa_pos=active_aa_pos,
|
||||||
aa_pos_lig1=aa_pos_lig1,
|
aa_pos_lig1=aa_pos_lig1,
|
||||||
aa_pos_lig2=aa_pos_lig2,
|
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)
|
ncol=1, align='v', rel_heights = c(6,1)
|
||||||
|
|
|
@ -51,7 +51,8 @@ LogoPlotSnps <- function(plot_df
|
||||||
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
||||||
, tW0 = 1
|
, tW0 = 1
|
||||||
, tH0 = 0.2
|
, tH0 = 0.2
|
||||||
, debug=FALSE
|
, debug=FALSE,
|
||||||
|
...
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -286,7 +287,8 @@ LogoPlotSnps <- function(plot_df
|
||||||
active_aa_pos=active_aa_pos,
|
active_aa_pos=active_aa_pos,
|
||||||
aa_pos_lig1=aa_pos_lig1,
|
aa_pos_lig1=aa_pos_lig1,
|
||||||
aa_pos_lig2=aa_pos_lig2,
|
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')
|
#aligned=align_plots(logo_top, logo_bottom, anno_bar, align='vh', axis='lr')
|
||||||
cowplot::plot_grid(
|
cowplot::plot_grid(
|
||||||
|
|
|
@ -186,5 +186,9 @@ position_annotation=function(plot_df,
|
||||||
# active_aa_pos=1:1000,
|
# active_aa_pos=1:1000,
|
||||||
# aa_pos_lig1=1:1000,
|
# aa_pos_lig1=1:1000,
|
||||||
# aa_pos_lig2=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"
|
||||||
|
# )
|
|
@ -22,20 +22,22 @@ theme_set(theme_grey())
|
||||||
# visually might be nicer for it to be inside the plot
|
# visually might be nicer for it to be inside the plot
|
||||||
#=================================================================
|
#=================================================================
|
||||||
|
|
||||||
site_snp_count_bp <- function (plotdf
|
site_snp_count_bp <- function (plotdf,
|
||||||
, df_colname = "position"
|
df_colname = "position",
|
||||||
#, bp_plot_title = ""
|
#, bp_plot_title = ""
|
||||||
#, leg_title = "Legend title"
|
#, leg_title = "Legend title"
|
||||||
, leg_text_size = 10#20
|
leg_text_size = 10,#20
|
||||||
, axis_text_size = 10#25
|
axis_text_size = 10,#25
|
||||||
, axis_label_size = 10#22
|
axis_label_size = 10,#22
|
||||||
, subtitle_size = 10#20
|
subtitle_size = 10,#20
|
||||||
, geom_ls = 10
|
geom_ls = 10,
|
||||||
, xaxis_title = "Number of nsSNPs"
|
xaxis_title = "Number of nsSNPs",
|
||||||
, yaxis_title = "Number of Sites"
|
yaxis_title = "Number of Sites",
|
||||||
, title_colour = "chocolate4"
|
title_colour = "chocolate4",
|
||||||
, subtitle_text = NULL
|
subtitle_text = NULL,
|
||||||
, subtitle_colour = "pink")
|
subtitle_colour = "pink",
|
||||||
|
...
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
plotdf = as.data.frame(plotdf)
|
plotdf = as.data.frame(plotdf)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#=======
|
#=======
|
||||||
# output
|
# 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)
|
#cat("plots will output to:", outdir_images)
|
||||||
|
|
||||||
my_gg_pairs=function(plot_df, plot_title
|
my_gg_pairs=function(plot_df, plot_title
|
||||||
|
@ -20,28 +20,31 @@ my_gg_pairs=function(plot_df, plot_title
|
||||||
title="ρ",
|
title="ρ",
|
||||||
digits=2,
|
digits=2,
|
||||||
justify_labels = "centre",
|
justify_labels = "centre",
|
||||||
title_args=list(size=tt_args_size, colour="black"),#2.5
|
title_args=list(size=tt_args_size, colour="black")#,#2.5
|
||||||
group_args=list(size=gp_args_size)#2.5
|
#group_args=list(size=gp_args_size)#2.5
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
lower = list(
|
lower = list(
|
||||||
continuous = wrap("points",
|
continuous = wrap(
|
||||||
alpha = 0.7,
|
"points",
|
||||||
size=0.125),
|
alpha = 0.7,
|
||||||
combo = wrap("dot",
|
size=0.125
|
||||||
alpha = 0.7,
|
|
||||||
size=0.125)
|
|
||||||
),
|
),
|
||||||
aes(colour = factor(ifelse(dst_mode==0,
|
combo = wrap(
|
||||||
"S",
|
"dot",
|
||||||
"R") ),
|
alpha = 0.7,
|
||||||
alpha = 0.5),
|
size=0.125)
|
||||||
title=plot_title) +
|
),
|
||||||
|
# aes(colour = factor(ifelse(dst_mode==0,
|
||||||
scale_colour_manual(values = c("red", "blue")) +
|
# "S",
|
||||||
scale_fill_manual(values = c("red", "blue")) #+
|
# "R") ),
|
||||||
# theme(text = element_text(size=7,
|
# alpha = 0.5),
|
||||||
# face="bold"))
|
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
|
DistCutOff = 10
|
||||||
|
@ -152,7 +155,7 @@ plot_corr_df_aff = my_gg_pairs(corr_df_aff
|
||||||
, plot_title="Affinity estimates"
|
, plot_title="Affinity estimates"
|
||||||
#, tt_args_size = 4
|
#, tt_args_size = 4
|
||||||
#, gp_args_size = 4
|
#, gp_args_size = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
#### Combine plots #####
|
#### Combine plots #####
|
||||||
# #png("/home/tanu/tmp/gg_pairs_all.png", height = 6, width=11.75, unit="in",res=300)
|
# #png("/home/tanu/tmp/gg_pairs_all.png", height = 6, width=11.75, unit="in",res=300)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue