config: add tile stuff for all targets. Other functions: many rewrites!

This commit is contained in:
Tanushree Tunstall 2022-08-15 16:29:38 +01:00
parent a3e5283a9b
commit 0cc7a8fcae
11 changed files with 163 additions and 200 deletions

View file

@ -208,25 +208,20 @@ LogoPlotSnps <- function(plot_df
xtt_col = "black"
ytt_col = "black"
}
position_mt = as.numeric(colnames(tab_mt))
position_wt = as.numeric(colnames(tab_wt))
#####################################
# Generating logo plots for nsSNPs
#####################################
#-------------------
# Mutant logo plot
#-------------------
logo_top =ggseqlogo(tab_mt
, method = 'custom'
, col_scheme = my_logo_col
, seq_type = 'aa') +
scale_x_continuous(breaks = 1:ncol(tab_mt)
, expand = c(0.01,0)
, labels = colnames(tab_mt))+
scale_y_continuous(breaks = 0:(max_mult_mut-1)
, labels = c(1:max_mult_mut)
, limits = c(0, max_mult_mut)) +
logo_top = ggplot() +
geom_logo(tab_mt
, method = 'custom'
, col_scheme = my_logo_col
, seq_type = 'aa') +
theme_nothing() +
ylab(y_lab) +
theme(text=element_text(family="FreeSans")
, legend.position = leg_pos
@ -239,7 +234,9 @@ LogoPlotSnps <- function(plot_df
, angle = x_tangle
#, hjust = 1
#, vjust = 0.4
, colour = xfont_bgc)
, colour = xfont_bgc
#, margin = margin(t = 0.1)
)
, axis.text.y = element_text(size = y_ats
, angle = y_tangle
, hjust = 1
@ -249,17 +246,25 @@ LogoPlotSnps <- function(plot_df
# , colour = xtt_col)
, axis.title.x = element_blank()
, axis.title.y = element_text(size = y_tts
, angle = 90
, colour = ytt_col)
, plot.background = element_rect(fill = theme_bgc, colour=NA)
) +
scale_x_discrete("Position"
, labels = position_mt
, limits = factor(1:length(position_mt))
)
logo_bottom = ggseqlogo(tab_wt
, method = 'custom'
, col_scheme = my_logo_col
, seq_type = 'aa') +
scale_x_continuous(breaks = 1:ncol(tab_wt)
, expand = c(0.01,0)
, labels = as.factor(colnames(tab_wt))) +
logo_bottom = ggplot() +
geom_logo(tab_wt
, method = 'custom'
, col_scheme = my_logo_col
, seq_type = 'aa') +
theme_nothing() +
scale_x_discrete("Position"
, labels = x_axis_colname
, limits = factor(1:length(x_axis_colname))) +
theme(text = element_text(family="FreeSans")
, legend.position = "none"
, axis.text.x = element_blank()
@ -278,13 +283,13 @@ LogoPlotSnps <- function(plot_df
aa_pos_lig2=aa_pos_lig2,
aa_pos_lig3=aa_pos_lig3)
aligned=align_plots(logo_top, logo_bottom, anno_bar, align='v', axis='lr')
#aligned=align_plots(logo_top, logo_bottom, anno_bar, align='vh', axis='lr')
cowplot::plot_grid(
aligned[[1]], aligned[[2]], aligned[[3]],
logo_top, logo_bottom, anno_bar,
#aligned[[1]], aligned[[2]], aligned[[3]],
ncol=1,
#align = "v",
rel_heights = c(7, 1,1),
rel_widths = c(1,1,0.75)
align = "v",
rel_heights = c(7, 1,1)
)
# cowplot::plot_grid(
@ -303,4 +308,4 @@ LogoPlotSnps <- function(plot_df
#------------------
}
#LogoPlotSnps(mutable_df3)
#LogoPlotSnps(small_df3)