Stacked barplot of the number of differential TSSs or TSRs per comparison.

plot_num_de(
  experiment,
  data_type = c("tss", "tsr"),
  de_comparisons = "all",
  log2fc_cutoff = 1,
  fdr_cutoff = 0.05,
  keep_unchanged = FALSE,
  return_table = FALSE,
  ...
)

Arguments

experiment

TSRexploreR object.

data_type

Whether to plot numbers of differential TSSs ('tss') or TSRs ('tsr').

de_comparisons

Character vector of differential expression comparisons to plot.

log2fc_cutoff

Differential features not meeting this |log2(fold change)| threshold will not be considered.

fdr_cutoff

Differential features not meeting this significance threshold will not be considered.

keep_unchanged

Whether to include (TRUE) unchanged features in the plot.

return_table

Return a table of results instead of a plot.

...

Additional arguments passed to geom_col.

Value

ggplot2 object of stacked barplot. If 'return_table' is TRUE, a data.frame with differentially expressed TSS/TSR numbers are returned.

Details

Generate a stacked barplot with the number of differential TSSs or TSRs per comparison.

'de_comparisons' are the names given to the comparisons from the 'comparison_name' argument of the 'differential_expression' function. 'log2fc_cutoff' and 'fdr_cutoff' are the log2(fold change) and FDR cutoffs used for determination of significance in the plot. 'keep_unchanged' controls whether non-significant feature numbers are included in the plot.

If 'keep_unchanged' is TRUE, a table with the numbers is returned instead of the ggplot. This may be useful if the exact numbers underlying the plot are required.

See also

fit_de_model to fit a differential expression model. differential_expression to find differential TSSs or TSRs.

Examples

data(TSSs) sample_sheet <- data.frame( sample_name=c( sprintf("S288C_D_%s", seq_len(3)), sprintf("S288C_WT_%s", seq_len(3)) ), file_1=NA, file_2=NA, condition=c(rep("Diamide", 3), rep("Untreated", 3)) ) exp <- TSSs %>% tsr_explorer(sample_sheet=sample_sheet) %>% format_counts(data_type="tss") diff_tss <- exp %>% fit_de_model(data_type="tss", formula= ~condition, method="edgeR") %>% differential_expression( data_type="tss", comparison_name="Diamide_vs_Untreated", comparison_type="coef", comparison=2) p <- plot_num_de(diff_tss, data_type="tss")