refactoring logo plots to add flame bar
This commit is contained in:
parent
f0a9eb4eec
commit
c968089cd2
4 changed files with 194 additions and 196 deletions
|
@ -1,64 +1,29 @@
|
||||||
# takes a dataframe and returns the same dataframe with two extra columns for colours and position
|
# takes a dataframe and returns the same dataframe with two extra columns for colours and position
|
||||||
generate_distance_colour_map = function(plotdf,
|
generate_distance_colour_map = function(plot_df,
|
||||||
xvar_colname = "position",
|
xvar_colname = "position",
|
||||||
yvar_colname = 'duet_scaled',
|
|
||||||
lig_dist_colname = "ligand_distance",
|
lig_dist_colname = "ligand_distance",
|
||||||
lig_dist_colours = c("green", "yellow", "orange", "red"),
|
lig_dist_colours = c("green", "yellow", "orange", "red"),
|
||||||
#tpos0 = 0,
|
debug = TRUE
|
||||||
#tpos1 = 0,
|
|
||||||
#tpos2 = 0,
|
|
||||||
#tpos3 = 0,
|
|
||||||
debug = FALSE
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#-------------------
|
|
||||||
# x and y axis
|
|
||||||
# range, scale, etc
|
|
||||||
#-------------------
|
|
||||||
my_xlim = length(unique(plotdf[[yvar_colname]])); my_xlim
|
|
||||||
ymin = min(plotdf[[yvar_colname]]); ymin
|
|
||||||
ymax = max(plotdf[[yvar_colname]]); ymax
|
|
||||||
|
|
||||||
#if (tpos0 == 0){
|
|
||||||
# tpos0 = ymin-0.5
|
|
||||||
#}
|
|
||||||
#if (tpos1 == 0){
|
|
||||||
# tpos1 = ymin-0.65
|
|
||||||
#}
|
|
||||||
#if (tpos2 == 0){
|
|
||||||
# tpos2 = ymin-0.75
|
|
||||||
#}
|
|
||||||
#if (tpos3 == 0){
|
|
||||||
# tpos3 = ymin-0.85
|
|
||||||
#}
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
cat("\nAnnotating x-axis ~", lig_dist_colname, "requested...")
|
cat("\nAnnotating x-axis ~", lig_dist_colname, "requested...")
|
||||||
}
|
}
|
||||||
#-------------------------------------
|
|
||||||
# round column values: to colour by
|
|
||||||
#--------------------------------------
|
|
||||||
#plotdf = plotdf[order(plotdf[[lig_dist_colname]]),]
|
|
||||||
plotdf['lig_distR'] = round(plotdf[[lig_dist_colname]], digits = 0)
|
|
||||||
#head(plotdf['lig_distR'])
|
|
||||||
|
|
||||||
#-------------------------------------
|
plot_df['lig_distR'] = round(plot_df[[lig_dist_colname]], digits = 0)
|
||||||
# ligand distance range, min, max, etc
|
|
||||||
#--------------------------------------
|
lig_min = min(round(plot_df[[lig_dist_colname]]), na.rm = T); lig_min
|
||||||
lig_min = min(round(plotdf[[lig_dist_colname]]), na.rm = T); lig_min
|
lig_max = max(round(plot_df[[lig_dist_colname]]), na.rm = T); lig_max
|
||||||
lig_max = max(round(plotdf[[lig_dist_colname]]), na.rm = T); lig_max
|
lig_mean = round(mean(round(plot_df[[lig_dist_colname]]), na.rm = T)); lig_mean
|
||||||
lig_mean = round(mean(round(plotdf[[lig_dist_colname]]), na.rm = T)); lig_mean
|
|
||||||
|
|
||||||
#-------------------------------------
|
|
||||||
# Create mapping colour key
|
# Create mapping colour key
|
||||||
#--------------------------------------
|
n_colours = length(sort(unique(round(plot_df[[lig_dist_colname]], digits = 0)))); n_colours
|
||||||
# sorting removes NA, so that n_colours == length(ligD_valsR)
|
|
||||||
n_colours = length(sort(unique(round(plotdf[[lig_dist_colname]], digits = 0)))); n_colours
|
|
||||||
|
|
||||||
lig_cols = colorRampPalette(lig_dist_colours)(n_colours); lig_cols
|
lig_cols = colorRampPalette(lig_dist_colours)(n_colours); lig_cols
|
||||||
ligD_valsR = sort(unique(round(plotdf[[lig_dist_colname]], digits = 0))); ligD_valsR
|
ligD_valsR = sort(unique(round(plot_df[[lig_dist_colname]], digits = 0))); ligD_valsR
|
||||||
length(ligD_valsR)
|
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
length(ligD_valsR)
|
||||||
if (n_colours == length(ligD_valsR)) {
|
if (n_colours == length(ligD_valsR)) {
|
||||||
cat("\nStarting: mapping b/w"
|
cat("\nStarting: mapping b/w"
|
||||||
, lig_dist_colname
|
, lig_dist_colname
|
||||||
|
@ -73,23 +38,23 @@ generate_distance_colour_map = function(plotdf,
|
||||||
|
|
||||||
ligDcolKey <- data.frame(ligD_colours = lig_cols
|
ligDcolKey <- data.frame(ligD_colours = lig_cols
|
||||||
, lig_distR = ligD_valsR); ligDcolKey
|
, lig_distR = ligD_valsR); ligDcolKey
|
||||||
names(ligDcolKey)
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
names(ligDcolKey)
|
||||||
cat("\nSuccessful: Mapping b/w", lig_dist_colname, "and colours")
|
cat("\nSuccessful: Mapping b/w", lig_dist_colname, "and colours")
|
||||||
}
|
}
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# merge colour key with plotdf
|
# merge colour key with plot_df
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
plotdf = merge(plotdf, ligDcolKey, by = 'lig_distR')
|
plot_df = merge(plot_df, ligDcolKey, by = 'lig_distR')
|
||||||
|
|
||||||
plotdf_check = as.data.frame(cbind(position = plotdf[[xvar_colname]]
|
# plot_df_check = as.data.frame(cbind(position = plot_df[[xvar_colname]]
|
||||||
, ligD = plotdf[[lig_dist_colname]]
|
# , ligD = plot_df[[lig_dist_colname]]
|
||||||
, ligDR = plotdf$lig_distR
|
# , ligDR = plot_df$lig_distR
|
||||||
, ligD_cols = plotdf$ligD_colours))
|
# , ligD_cols = plot_df$ligD_colours))
|
||||||
return(plotdf)
|
return(plot_df)
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_distance_legend = function(plotdf,
|
generate_distance_legend = function(plot_df,
|
||||||
yvar_colname,
|
yvar_colname,
|
||||||
xvar_colname = 'position',
|
xvar_colname = 'position',
|
||||||
lig_dist_colname = "ligand_distance",
|
lig_dist_colname = "ligand_distance",
|
||||||
|
@ -97,15 +62,15 @@ generate_distance_legend = function(plotdf,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
# build legend for ligand distance "heat bar"
|
# build legend for ligand distance "heat bar"
|
||||||
lig_min = min(round(plotdf[[lig_dist_colname]]), na.rm = T); lig_min
|
lig_min = min(round(plot_df[[lig_dist_colname]]), na.rm = T); lig_min
|
||||||
lig_max = max(round(plotdf[[lig_dist_colname]]), na.rm = T); lig_max
|
lig_max = max(round(plot_df[[lig_dist_colname]]), na.rm = T); lig_max
|
||||||
lig_mean = round(mean(round(plotdf[[lig_dist_colname]]), na.rm = T)); lig_mean
|
lig_mean = round(mean(round(plot_df[[lig_dist_colname]]), na.rm = T)); lig_mean
|
||||||
|
|
||||||
labels = seq(lig_min, lig_max, len = 5); labels
|
labels = seq(lig_min, lig_max, len = 5); labels
|
||||||
labelsD = round(labels, digits = 0); labelsD
|
labelsD = round(labels, digits = 0); labelsD
|
||||||
|
|
||||||
get_legend(ggplot(plotdf, aes_string(x = sprintf("factor(%s)", xvar_colname)
|
get_legend(
|
||||||
, y = yvar_colname)) +
|
ggplot(plot_df, aes_string(x = sprintf("factor(%s)", xvar_colname), y=0)) +
|
||||||
|
|
||||||
geom_tile(aes(fill = .data[[lig_dist_colname]])
|
geom_tile(aes(fill = .data[[lig_dist_colname]])
|
||||||
, colour = "white") +
|
, colour = "white") +
|
||||||
|
|
|
@ -54,6 +54,7 @@ lf_bp2 <- function(lf_df = lf_duet
|
||||||
}else{
|
}else{
|
||||||
bp_width = bp_width
|
bp_width = bp_width
|
||||||
}
|
}
|
||||||
|
my_comparisonsL <- list( stat_grp_comp )
|
||||||
|
|
||||||
ggplot(lf_df, aes_string(x = x_grp, y = y_var)) +
|
ggplot(lf_df, aes_string(x = x_grp, y = y_var)) +
|
||||||
|
|
||||||
|
@ -93,39 +94,11 @@ lf_bp2 <- function(lf_df = lf_duet
|
||||||
, x = ""
|
, x = ""
|
||||||
, y = "") +
|
, y = "") +
|
||||||
|
|
||||||
if (add_stats){
|
|
||||||
my_comparisonsL <- list( stat_grp_comp )
|
|
||||||
|
|
||||||
stat_compare_means(comparisons = my_comparisonsL
|
stat_compare_means(comparisons = my_comparisonsL
|
||||||
, method = stat_method
|
, method = stat_method
|
||||||
, paired = my_paired
|
, paired = my_paired
|
||||||
, label = stat_label[2])
|
, label = stat_label[2]) +
|
||||||
|
|
||||||
|
|
||||||
if (make_boxplot){
|
|
||||||
geom_boxplot(fill = "white"
|
|
||||||
, outlier.colour = NA
|
|
||||||
#, position = position_dodge(width = 0.9)
|
|
||||||
, width = bp_width) +
|
|
||||||
|
|
||||||
geom_quasirandom(#priority = "density"
|
|
||||||
#, shape = 21
|
|
||||||
size = dot_size
|
|
||||||
, alpha = dot_transparency
|
|
||||||
, show.legend = FALSE
|
|
||||||
, cex = 0.8
|
|
||||||
, aes(
|
|
||||||
colour = factor(
|
|
||||||
eval(
|
|
||||||
parse(
|
|
||||||
text = colour_categ
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
geom_quasirandom(
|
geom_quasirandom(
|
||||||
size = dot_size
|
size = dot_size
|
||||||
, alpha = dot_transparency
|
, alpha = dot_transparency
|
||||||
|
@ -143,7 +116,5 @@ lf_bp2 <- function(lf_df = lf_duet
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#lf_bp2(lf_consurf)
|
#lf_bp2(lf_consurf)
|
|
@ -46,7 +46,7 @@ LogoPlotCustomH <- function(plot_df
|
||||||
, rm_empty_y = F
|
, rm_empty_y = F
|
||||||
, y_axis_log = F
|
, y_axis_log = F
|
||||||
, log_value = log10
|
, log_value = log10
|
||||||
, y_axis_increment = 5
|
, y_axis_increment = 50
|
||||||
, x_lab = "Position"
|
, x_lab = "Position"
|
||||||
, y_lab = "Odds Ratio"
|
, y_lab = "Odds Ratio"
|
||||||
, x_ats = 12 # text size
|
, x_ats = 12 # text size
|
||||||
|
@ -68,16 +68,24 @@ LogoPlotCustomH <- function(plot_df
|
||||||
#################################
|
#################################
|
||||||
# Data processing for logo plot
|
# Data processing for logo plot
|
||||||
#################################
|
#################################
|
||||||
plot_df = generate_distance_colour_map(plot_df, yvar_colname = y_axis_colname, debug=TRUE)
|
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){
|
||||||
plot_df = plot_df[!is.na(plot_df[y_axis_colname]),]
|
plot_df = plot_df[!is.na(plot_df[y_axis_colname]),]
|
||||||
cat("\nRemoving empty positions...\n")
|
cat("\nRemoving empty positions...\n")
|
||||||
}else{
|
|
||||||
plot_df = plot_df
|
|
||||||
}
|
}
|
||||||
|
|
||||||
y_max = max(plot_df['or_mychisq'], na.rm = T)
|
y_max = max(plot_df[[y_axis_colname]], na.rm = T)
|
||||||
cat("\nRemoving y scale incremenet:", y_axis_increment)
|
cat("\nRemoving y scale incremenet:", y_axis_increment)
|
||||||
y_lim = round_any(y_max, y_axis_increment, f = ceiling)
|
y_lim = round_any(y_max, y_axis_increment, f = ceiling)
|
||||||
|
|
||||||
|
@ -155,32 +163,44 @@ LogoPlotCustomH <- function(plot_df
|
||||||
y_lab = paste("Log", y_lab)
|
y_lab = paste("Log", y_lab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ggseqlogo(logo_dfP_wf
|
plot_grid(
|
||||||
|
ggplot() +
|
||||||
|
geom_logo(logo_dfP_wf
|
||||||
, method = "custom"
|
, method = "custom"
|
||||||
, col_scheme = my_logo_col
|
, col_scheme = my_logo_col
|
||||||
, seq_type = "aa") +
|
, seq_type = "aa") +
|
||||||
#ylab("my custom height") +
|
#ylab("my custom height") +
|
||||||
theme(axis.text.x = element_text(size = x_ats
|
theme( axis.ticks.x = element_blank()
|
||||||
, angle = x_tangle
|
, axis.title.x = element_blank()
|
||||||
, hjust = 1
|
, axis.text.x = element_blank() # turn this off and the below on if you want to visually
|
||||||
, vjust = 0.4
|
# verify positions.
|
||||||
, colour = xfont_bgc)
|
# , axis.text.x = element_text(size = x_ats
|
||||||
|
# , angle = x_tangle
|
||||||
|
# , hjust = 1
|
||||||
|
# , vjust = 0.4
|
||||||
|
# , colour = xfont_bgc
|
||||||
|
# , margin = margin(b=0)
|
||||||
|
# )
|
||||||
, axis.text.y = element_text(size = y_ats
|
, axis.text.y = element_text(size = y_ats
|
||||||
, angle = y_tangle
|
, angle = y_tangle
|
||||||
, hjust = 1
|
, hjust = 1
|
||||||
, vjust = 0
|
, vjust = 0
|
||||||
, colour = yfont_bgc)
|
, colour = yfont_bgc)
|
||||||
, axis.title.x = element_text(size = x_tts
|
|
||||||
, colour = xtt_col)
|
|
||||||
, axis.title.y = element_text(size = y_tts
|
, axis.title.y = element_text(size = y_tts
|
||||||
, colour = ytt_col)
|
, colour = ytt_col)
|
||||||
, legend.title = element_text(size = leg_tts
|
, legend.title = element_text(size = leg_tts
|
||||||
, colour = ytt_col)
|
, colour = ytt_col)
|
||||||
, legend.text = element_text(size = leg_ts)
|
#, legend.text = element_text(size = leg_ts)
|
||||||
|
, legend.text = element_blank()
|
||||||
|
|
||||||
, legend.position = leg_pos
|
, legend.position = leg_pos
|
||||||
, legend.direction = leg_dir
|
, legend.direction = leg_dir
|
||||||
, plot.background = element_rect(fill = theme_bgc))+
|
, plot.background = element_rect(fill = theme_bgc)
|
||||||
|
, plot.margin = margin(b=0)
|
||||||
|
, panel.grid=element_blank()
|
||||||
|
, panel.background = element_rect(fill = theme_bgc)
|
||||||
|
|
||||||
|
)+
|
||||||
|
|
||||||
scale_x_discrete(x_lab
|
scale_x_discrete(x_lab
|
||||||
#, breaks
|
#, breaks
|
||||||
|
@ -191,14 +211,42 @@ LogoPlotCustomH <- function(plot_df
|
||||||
, breaks = seq(0, (y_lim), by = y_axis_increment)
|
, breaks = seq(0, (y_lim), by = y_axis_increment)
|
||||||
#, labels = seq(0, (y_lim), by = y_axis_increment)
|
#, labels = seq(0, (y_lim), by = y_axis_increment)
|
||||||
, limits = c(0, y_lim)) +
|
, limits = c(0, y_lim)) +
|
||||||
ylab(y_lab) +
|
labs(y=y_lab),
|
||||||
geom_tile(aes(plot_df$position, tpos0 # heat-mapped distance tiles along the bot
|
ggplot(data=unique_colour_map2, aes(
|
||||||
, width = tW0
|
x=factor(position), 0 # heat-mapped distance tiles along the bot
|
||||||
, height = tH0)
|
, fill = position
|
||||||
, fill = plot_df$ligD_colours
|
, colour = position
|
||||||
, colour = plot_df$ligD_colours
|
, linetype = "blank"
|
||||||
, linetype = "blank")
|
)
|
||||||
#LogoPlot = p0 + ylab(y_lab)
|
) +
|
||||||
#return(LogoPlot)
|
geom_tile() +
|
||||||
|
theme(axis.text.x = element_text(size = x_ats
|
||||||
|
, angle = x_tangle
|
||||||
|
, hjust = 1
|
||||||
|
, vjust = 0.4
|
||||||
|
, colour = xfont_bgc)
|
||||||
|
, axis.text.y = element_blank()
|
||||||
|
, axis.ticks.y = element_blank()
|
||||||
|
, axis.title.x = element_text(size = x_tts
|
||||||
|
, colour = xtt_col)
|
||||||
|
, axis.title.y = element_text(size = y_tts
|
||||||
|
, colour = ytt_col)
|
||||||
|
, legend.title = element_text(size = leg_tts
|
||||||
|
, colour = ytt_col)
|
||||||
|
, legend.text = element_text(size = leg_ts)
|
||||||
|
|
||||||
|
, legend.position = leg_pos
|
||||||
|
, legend.direction = leg_dir
|
||||||
|
, plot.background = element_rect(fill = theme_bgc)
|
||||||
|
, plot.margin = margin(t=0)
|
||||||
|
, panel.grid=element_blank()
|
||||||
|
, panel.background = element_rect(fill = theme_bgc)
|
||||||
|
) +
|
||||||
|
scale_x_discrete(x_lab, labels=factor(unique_colour_map$position)) +
|
||||||
|
scale_color_manual(values=unique_colour_map$ligD_colours) +
|
||||||
|
scale_fill_manual(values=unique_colour_map$ligD_colours) +
|
||||||
|
labs(y = NULL),
|
||||||
|
ncol=1, align='v', rel_heights = c(8/10,1/10)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
#LogoPlotCustomH(merged_df3)
|
|
@ -33,7 +33,7 @@
|
||||||
LogoPlotSnps <- function(plot_df
|
LogoPlotSnps <- function(plot_df
|
||||||
, x_axis_colname = "position"
|
, x_axis_colname = "position"
|
||||||
, symbol_mut_colname = "mutant_type"
|
, symbol_mut_colname = "mutant_type"
|
||||||
, symbol_wt_colname = "mutant_type"
|
, symbol_wt_colname = "wild_type"
|
||||||
, omit_snp_count = c(0) # can be 1, 2, etc.
|
, omit_snp_count = c(0) # can be 1, 2, etc.
|
||||||
, my_logo_col = "chemistry"
|
, my_logo_col = "chemistry"
|
||||||
, x_lab = "Position"
|
, x_lab = "Position"
|
||||||
|
@ -66,6 +66,13 @@ LogoPlotSnps <- function(plot_df
|
||||||
|
|
||||||
# Generate "ligand distance" colour map
|
# Generate "ligand distance" colour map
|
||||||
plot_df = generate_distance_colour_map(plot_df, debug=TRUE)
|
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)
|
||||||
|
#
|
||||||
|
|
||||||
setDT(plot_df)[, mut_pos_occurrence := .N, by = .(eval(parse(text=x_axis_colname)))]
|
setDT(plot_df)[, mut_pos_occurrence := .N, by = .(eval(parse(text=x_axis_colname)))]
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
@ -213,10 +220,6 @@ LogoPlotSnps <- function(plot_df
|
||||||
, col_scheme = my_logo_col
|
, col_scheme = my_logo_col
|
||||||
, seq_type = 'aa') +
|
, seq_type = 'aa') +
|
||||||
|
|
||||||
theme(text=element_text(family="FreeSans"))+
|
|
||||||
theme(axis.text.x = element_blank()) +
|
|
||||||
theme_logo()+
|
|
||||||
|
|
||||||
scale_x_continuous(breaks = 1:ncol(tab_mt)
|
scale_x_continuous(breaks = 1:ncol(tab_mt)
|
||||||
, expand = c(0.01,0)
|
, expand = c(0.01,0)
|
||||||
, labels = colnames(tab_mt))+
|
, labels = colnames(tab_mt))+
|
||||||
|
@ -224,16 +227,9 @@ LogoPlotSnps <- function(plot_df
|
||||||
scale_y_continuous(breaks = 0:(max_mult_mut-1)
|
scale_y_continuous(breaks = 0:(max_mult_mut-1)
|
||||||
, labels = c(1:max_mult_mut)
|
, labels = c(1:max_mult_mut)
|
||||||
, limits = c(0, max_mult_mut)) +
|
, limits = c(0, max_mult_mut)) +
|
||||||
# FIXME: currently broken, possibly due to ggseqlogo() not working in the
|
|
||||||
# way standard ggplot2() does
|
|
||||||
geom_tile(aes(plot_df$position, tpos0 # heat-mapped distance tiles along the bottom.
|
|
||||||
, width = tW0
|
|
||||||
, height = tH0)
|
|
||||||
, fill = plot_df$ligD_colours
|
|
||||||
, colour = plot_df$ligD_colours
|
|
||||||
, linetype = "blank") +
|
|
||||||
ylab(y_lab) +
|
ylab(y_lab) +
|
||||||
theme(legend.position = leg_pos
|
theme(text=element_text(family="FreeSans")
|
||||||
|
, legend.position = leg_pos
|
||||||
, legend.direction = leg_dir
|
, legend.direction = leg_dir
|
||||||
, legend.title = element_text(size = leg_tts
|
, legend.title = element_text(size = leg_tts
|
||||||
, colour = ytt_col)
|
, colour = ytt_col)
|
||||||
|
@ -260,40 +256,58 @@ LogoPlotSnps <- function(plot_df
|
||||||
, method = 'custom'
|
, method = 'custom'
|
||||||
, col_scheme = my_logo_col
|
, col_scheme = my_logo_col
|
||||||
, seq_type = 'aa') +
|
, seq_type = 'aa') +
|
||||||
|
|
||||||
theme(text = element_text(family="FreeSans"))+
|
|
||||||
theme(axis.text.x = element_blank()
|
|
||||||
, axis.text.y = element_blank()) +
|
|
||||||
theme_logo()+
|
|
||||||
|
|
||||||
scale_x_continuous(breaks = 1:ncol(tab_wt)
|
scale_x_continuous(breaks = 1:ncol(tab_wt)
|
||||||
, expand = c(0.01,0)
|
, expand = c(0.01,0)
|
||||||
, labels = colnames(tab_wt))+
|
, labels = colnames(tab_wt))+
|
||||||
|
theme(text = element_text(family="FreeSans")
|
||||||
xlab(x_lab) +
|
, legend.position = "none"
|
||||||
|
, axis.text.x = element_blank()
|
||||||
theme(legend.position = "none"
|
, axis.text.y = element_blank()
|
||||||
, legend.direction = leg_dir
|
, axis.title.x = element_blank()
|
||||||
#, legend.title = element_blank()
|
, axis.title.y = element_blank()
|
||||||
, legend.title = element_text(size = y_tts
|
, plot.background = element_rect(fill = theme_bgc)
|
||||||
, colour = ytt_col)
|
) +
|
||||||
, legend.text = element_text(size = leg_ts)
|
labs(x=NULL, y=NULL)
|
||||||
, axis.text.x = element_text(size = x_ats
|
,
|
||||||
|
ggplot(data=unique_colour_map2, aes(
|
||||||
|
x=factor(position), 0 # heat-mapped distance tiles along the bot
|
||||||
|
, fill = position
|
||||||
|
, colour = position
|
||||||
|
, linetype = "blank"
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
geom_tile() +
|
||||||
|
theme(axis.text.x = element_text(size = x_ats
|
||||||
, angle = x_tangle
|
, angle = x_tangle
|
||||||
, hjust = 1
|
, hjust = 1
|
||||||
, vjust = 0.4
|
, vjust = 0.4
|
||||||
, colour = xfont_bgc)
|
, colour = xfont_bgc)
|
||||||
, axis.text.y = element_blank()
|
, axis.text.y = element_blank()
|
||||||
|
, axis.ticks.y = element_blank()
|
||||||
, axis.title.x = element_text(size = x_tts
|
, axis.title.x = element_text(size = x_tts
|
||||||
, colour = xtt_col)
|
, colour = xtt_col)
|
||||||
, axis.title.y = element_text(size = y_tts
|
, axis.title.y = element_text(size = y_tts
|
||||||
, colour = ytt_col)
|
, colour = ytt_col)
|
||||||
|
, legend.title = element_text(size = leg_tts
|
||||||
|
, colour = ytt_col)
|
||||||
|
, legend.text = element_text(size = leg_ts)
|
||||||
|
|
||||||
|
, legend.position = leg_pos
|
||||||
|
, legend.direction = leg_dir
|
||||||
, plot.background = element_rect(fill = theme_bgc)
|
, plot.background = element_rect(fill = theme_bgc)
|
||||||
)
|
, plot.margin = margin(t=0)
|
||||||
, nrow = 2
|
, panel.grid=element_blank()
|
||||||
|
, panel.background = element_rect(fill = theme_bgc)
|
||||||
|
) +
|
||||||
|
scale_x_discrete(x_lab, labels=factor(unique_colour_map$position)) +
|
||||||
|
scale_color_manual(values=unique_colour_map$ligD_colours) +
|
||||||
|
scale_fill_manual(values=unique_colour_map$ligD_colours) +
|
||||||
|
labs(y = NULL)
|
||||||
|
, nrow = 3
|
||||||
, align = "v"
|
, align = "v"
|
||||||
, rel_heights = c(3/4, 1/4))
|
, rel_heights = c(7/10, 2/7, 1/7))
|
||||||
#------------------
|
#------------------
|
||||||
# Wild logo plot
|
# Wild logo plot
|
||||||
#------------------
|
#------------------
|
||||||
}
|
}
|
||||||
|
#LogoPlotSnps(mutable_df3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue