plot_pwm_as_bars | R Documentation |
This function is useful to visually explore the different contribution of pseudocounts and weighted background probabilities to a PWM. See exaples.
plot_pwm_as_bars(
long_df,
axis_txt_size = 10,
alphabet_palette = c(t = "forestgreen", c = "dodgerblue", g = "orange", a =
"firebrick3")
)
long_df |
A data.frame obtained with |
axis_txt_size |
axis_txt_size Text size of axis labels. Default 10. |
alphabet_palette |
A colour palette vector with names matching the PWM alphabet |
A ggplot2 plot
df2pwm(data, ID_col = 'Species', alphabet = c('a', 'c', 'g', 't'), long_format = T) |>
plot_pwm_as_bars() + ggtitle('uniform bg prob & default pseudocounts')
df2pwm(data, ID_col = 'Species', alphabet = c('a', 'c', 'g', 't'), long_format = T, pseudocount_letter = 0.05) |>
plot_pwm_as_bars() + ggtitle('Uniform bg prob & small pseudocounts')
mm10_bg_prob <- c('a' = 0.2917, 't' = 0.2917, 'c' = 0.2083, 'g' = 0.2083 )
df2pwm(data, ID_col = 'Species', alphabet = c('a', 'c', 'g', 't'), long_format = T,
pseudocount_letter = 0.05, bg_prob_letter = mm10_bg_prob ) |>
plot_pwm_as_bars() + ggtitle('mm10 bg prob & small pseudocounts')
# Get the alphabet and build a palette
alphabet <- guess_alphabet(data = data, ID_col = 'Species')
plt <- palette.colors(n = length(alphabet))
names(plt) <- alphabet
df2pwm(data, ID_col = 'Species', long_format = T) |>
plot_pwm_as_bars(alphabet_palette = plt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.