Generate a stacked barplot for the number of TSRs with significant upstream and/or downstream shifts for each comparison.

plot_shift_count(
  experiment,
  samples = "all",
  ncol = 3,
  return_table = FALSE,
  ...
)

Arguments

experiment

TSRexploreR object.

samples

A vector of sample names to analyze.

ncol

Integer specifying the number of columns to arrange multiple plots.

return_table

Return a table of results instead of a plot.

...

Arguments passed to geom_col.

Value

ggplot2 of stacked barplot of shifted TSS clusters. If 'return_table' is TRUE, a data.frame of underlying counts is returned instead.

Details

The 'tss_shifting' function uses the earth mover's score (EMS) to assess shifts in TSS distribution in consensus TSRs between two samples. This function generates a stacked barplot of the number of upstream and downstream shifts in each comparison.

If 'return_table' is TRUE, a data.frame is returned that provides the underlying counts for each sample.

See also

tss_shift For TSS cluster shifting calculation.

Examples

data(TSSs) assembly <- system.file("extdata", "S288C_Assembly.fasta", package = "TSRexploreR") samples <- data.frame( sample_name=c(sprintf("S288C_D_%s", seq_len(3)), sprintf("S288C_WT_%s", seq_len(3))), file_1=rep(NA, 6), file_2=rep(NA, 6), condition=c(rep("Diamide", 3), rep("Untreated", 3)) ) exp <- TSSs %>% tsr_explorer(sample_sheet=samples, genome_assembly=assembly) %>% format_counts(data_type="tss") %>% tss_clustering(threshold=3) %>% merge_samples(data_type="tss", merge_group="condition") %>% merge_samples(data_type="tsr", merge_group="condition") %>% tss_shift( sample_1=c(TSS="S288C_WT_1", TSR="S288C_WT_1"), sample_2=c(TSS="S288C_D_1", TSR="S288C_D_1"), comparison_name="Untreated_vs_Diamide", max_distance = 100, min_threshold = 10, n_resamples = 1000L )
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Arguments in '...' ignored
#> Warning: Some sequences have fewer than nthresh scores for at least one sample. #> These are ignored and returned as NA.
#> Joining, by = c("fhash", "sample_indicator")
p <- plot_shift_count(exp)