stuff
This commit is contained in:
parent
e4e8bd7278
commit
3b77b4b611
2 changed files with 28 additions and 36 deletions
|
@ -73,7 +73,7 @@ lf_bp <- function(lf_df = lf_duet
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) + ggplot2::scale_color_manual(values = consurf_bp_colours)
|
) + ggplot2::scale_color_manual(values = consurf_colours)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#Legend=factor(eval(parse(text = colour_categ)))
|
#Legend=factor(eval(parse(text = colour_categ)))
|
||||||
|
@ -99,7 +99,7 @@ lf_bp <- function(lf_df = lf_duet
|
||||||
)
|
)
|
||||||
#, aes(colour = Legend)
|
#, aes(colour = Legend)
|
||||||
) +
|
) +
|
||||||
ggplot2::scale_color_manual(values = consurf_bp_colours)
|
ggplot2::scale_color_manual(values = consurf_colours)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ wideP_consurf3 <- function(plot_df
|
||||||
, "1": "Variable"
|
, "1": "Variable"
|
||||||
, "2", "3", "4", "5", "6", "7", "8"
|
, "2", "3", "4", "5", "6", "7", "8"
|
||||||
, "9": "Conserved")
|
, "9": "Conserved")
|
||||||
, panel_col = "grey"
|
, panel_col = "white"
|
||||||
, panel_col_fill = "grey"
|
, panel_col_fill = "white"
|
||||||
|
|
||||||
# axes title and label sizes
|
# axes title and label sizes
|
||||||
, x_axls = 12 # x-axis label size
|
, x_axls = 12 # x-axis label size
|
||||||
|
@ -70,6 +70,15 @@ wideP_consurf3 <- function(plot_df
|
||||||
, build_plot_df=FALSE
|
, build_plot_df=FALSE
|
||||||
, debug=FALSE
|
, debug=FALSE
|
||||||
){
|
){
|
||||||
|
anno_bar = position_annotation(
|
||||||
|
plot_df,
|
||||||
|
bg = panel_col,
|
||||||
|
aa_pos_drug=aa_pos_drug,
|
||||||
|
active_aa_pos=active_aa_pos,
|
||||||
|
aa_pos_lig1=aa_pos_lig1,
|
||||||
|
aa_pos_lig2=aa_pos_lig2,
|
||||||
|
aa_pos_lig3=aa_pos_lig3
|
||||||
|
)
|
||||||
|
|
||||||
if(missing(point_colours)){
|
if(missing(point_colours)){
|
||||||
temp_cols = colorRampPalette(c("seagreen", "sienna3"))(30)
|
temp_cols = colorRampPalette(c("seagreen", "sienna3"))(30)
|
||||||
|
@ -230,9 +239,9 @@ wideP_consurf3 <- function(plot_df
|
||||||
, unit = unit_margin))+
|
, unit = unit_margin))+
|
||||||
#guides(colour = guide_legend(title = "ConsurfXXXX")) +
|
#guides(colour = guide_legend(title = "ConsurfXXXX")) +
|
||||||
labs(x = NULL, y = NULL)
|
labs(x = NULL, y = NULL)
|
||||||
# labs(title = ptitle
|
# labs(title = ptitle
|
||||||
# , x = xlab
|
# , x = xlab
|
||||||
# , y = ylab)
|
# , y = ylab)
|
||||||
|
|
||||||
#------------------
|
#------------------
|
||||||
#Extract legend1
|
#Extract legend1
|
||||||
|
@ -242,7 +251,7 @@ wideP_consurf3 <- function(plot_df
|
||||||
, aes_string(
|
, aes_string(
|
||||||
x = sprintf("factor(%s)"
|
x = sprintf("factor(%s)"
|
||||||
, xvar_colname))
|
, xvar_colname))
|
||||||
)
|
)
|
||||||
g1_leg = g1_leg + geom_bar(); g1_leg
|
g1_leg = g1_leg + geom_bar(); g1_leg
|
||||||
g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)"
|
g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)"
|
||||||
, yvar_colourN_colname)))
|
, yvar_colourN_colname)))
|
||||||
|
@ -255,40 +264,23 @@ wideP_consurf3 <- function(plot_df
|
||||||
|
|
||||||
out = g1
|
out = g1
|
||||||
|
|
||||||
# x-axis: geom_tiles ~ active sites and others
|
|
||||||
if(annotate_active_sites){
|
|
||||||
aligned = align_plots(out,position_annotation(plot_df))
|
|
||||||
|
|
||||||
|
# x-axis: geom_tiles ~ active sites and others
|
||||||
|
if(annotate_active_sites){
|
||||||
|
#aligned = align_plots(out,position_annotation(plot_df))
|
||||||
out=cowplot::plot_grid(
|
out=cowplot::plot_grid(
|
||||||
out,
|
out,
|
||||||
NULL,
|
NULL,
|
||||||
ggplot(plot_df,
|
anno_bar,
|
||||||
aes(x=factor(position), # THIS STUPID FUCKING FACTOR THING
|
|
||||||
)
|
|
||||||
) +
|
|
||||||
geom_tile(aes(y=0),
|
|
||||||
fill=plot_df$ligD_colours) +
|
|
||||||
scale_x_discrete("Position", labels=factor(plot_df$position)) +
|
|
||||||
theme_nothing() +
|
|
||||||
theme(plot.background = element_rect(fill = panel_col, colour=NA),
|
|
||||||
plot.margin = margin(t=0,b=0)) +
|
|
||||||
labs(x = NULL, y = NULL), #end of distance-heat-bar
|
|
||||||
NULL,
|
|
||||||
position_annotation(plot_df,
|
|
||||||
bg = panel_col,
|
|
||||||
aa_pos_drug=aa_pos_drug,
|
|
||||||
active_aa_pos=active_aa_pos,
|
|
||||||
aa_pos_lig1=aa_pos_lig1,
|
|
||||||
aa_pos_lig2=aa_pos_lig2,
|
|
||||||
aa_pos_lig3=aa_pos_lig3
|
|
||||||
),
|
|
||||||
ncol=1,
|
ncol=1,
|
||||||
align='v',
|
align='v',
|
||||||
axis='lr',
|
#axis='lr',
|
||||||
rel_heights = c(10,0,1,-0.1,1)
|
rel_heights = c(10,-0.1,1)
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
#### add the legends to the output ####
|
||||||
|
# ...which legends depend on whether the heat bar and position tiles are included
|
||||||
if (annotate_ligand_distance){
|
if (annotate_ligand_distance){
|
||||||
cat('\nOutput: Plot + distance heat-bar + other stuff')
|
cat('\nOutput: Plot + distance heat-bar + other stuff')
|
||||||
legs = cowplot::plot_grid(legend1
|
legs = cowplot::plot_grid(legend1
|
||||||
|
@ -314,4 +306,4 @@ wideP_consurf3 <- function(plot_df
|
||||||
return(out2)
|
return(out2)
|
||||||
}
|
}
|
||||||
|
|
||||||
#wideP_consurf3(small_df3, point_colours = consurf_bp_colours)
|
#wideP_consurf3(small_df3, point_colours = consurf_colours)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue