Get genomic distributions of TSSs and TSRs.

plot_genomic_distribution(
  experiment,
  data_type = c("tss", "tsr", "shift"),
  samples = "all",
  threshold = NULL,
  use_normalized = FALSE,
  dominant = FALSE,
  data_conditions = NULL,
  return_table = FALSE,
  ...
)

Arguments

experiment

TSRexploreR object.

data_type

Whether to get distribution of TSSs ('tss') or TSRs ('tsr').

samples

A vector of sample names to analyze.

threshold

TSSs or TSRs with a score below this value will not be considered.

use_normalized

Whether to use the normalized (TRUE) or raw (FALSE) counts.

dominant

If TRUE, will only consider the highest-scoring TSS per gene, transcript, or TSR or highest-scoring TSR per gene or transcript.

data_conditions

Apply advanced conditions to the data.

return_table

Return a table of results instead of a plot.

...

Arguments passed to geom_col.

Value

ggplot2 plot with TSS or TSR genomic distribution. If 'return_table' is TRUE returns a data.frame of underlying stats.

Details

This plotting function will create a stacked barplot of the proportion of TSSs or TSRs containing within several types of genomic feature: exons, introns, intergenic, downstream, antisense, and promoter regions. The promoter region is user-defined during annotation.

A set of functions to control data structure for plotting are included. 'use_normalized' will use normalized scores, which only matters if 'consider_score' is TRUE. 'threshold' defines the minimum number of raw counts a TSS or TSR must have to be considered. dominant' specifies whether only the dominant TSS or TSR (determined using the 'mark_dominant' function) is considered. For TSSs, this can be either dominant TSS per TSR or gene/transcript, and for TSRs it is the dominant TSR per gene/transcript. 'data_conditions' can be used to filter, quantile, order, and/or group data for plotting.

If 'return_table' is TRUE, a data.frame containing the underlying data for the plot is returned.

See also

annotate_features to annotate TSSs or TSRs.

Examples

data(TSSs_reduced) annotation <- system.file("extdata", "S288C_Annotation.gtf", package="TSRexploreR") exp <- TSSs_reduced %>% tsr_explorer(genome_annotation=annotation) %>% format_counts(data_type="tss") %>% annotate_features(data_type="tss")
#> Import genomic features from the file as a GRanges object ...
#> OK
#> Prepare the 'metadata' data frame ...
#> OK
#> Make the TxDb object ...
#> Warning: The "phase" metadata column contains non-NA values for features of type #> stop_codon. This information was ignored.
#> OK
p <- plot_genomic_distribution(exp, data_type="tss")