Filter TSSs based on given threshold.

apply_threshold(experiment, threshold, n_samples = 1, use_normalized = FALSE)

Arguments

experiment

TSRexploreR object.

threshold

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

n_samples

Number of samples threshold must be reached to keep TSS. By default set to 1 sample. A NULL value will result in all samples being required to have read counts above the threshold at a given TSS position

use_normalized

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

Value

TSRexploreR object with weak TSSs filtered out of counts table.

Details

All TSSs mapping methods produce spurious TSSs. For the most part, these spurious reads TSSs to be weak and somewhat uniformly distributed throughout promoters and gene bodies. This means that this background can be mitigated by requiring a minimum read threshold for a TSS to be considered in downstream analyses.

This function will remove TSSs from the TSS data.table if no sample has at least 'threshold' number of reads in at least 'n_samples' number of samples.

See also

plot_threshold_exploration to explore fraction of promoter proximal TSSs, and absolute number of detected genes.

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")
#> 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
exp <- apply_threshold(exp, threshold=3)