Export differential features for use in clusterProfiler term enrichment.

export_for_enrichment(
  experiment,
  data_type = c("tss", "tsr"),
  de_comparisons = "all",
  log2fc_cutoff = 1,
  fdr_cutoff = 0.05,
  keep_unchanged = FALSE,
  anno_categories = NULL
)

Arguments

experiment

TSRexploreR object.

data_type

Whether to export genes associated with differential TSSs ('tss') or TSRs ('tsr').

de_comparisons

Character vector of differential expression comparisons to export.

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

Logical for inclusion of genes not significantly changed in the exported list.

anno_categories

Vector of annotation categories to keep. If NULL no filtering by annotation type occurs.

Value

data.frame of genes and differential expression status of TSSs or TSRs.

Details

This function outputs a data.frame that is formatted for use with the 'compareCluster' function of the clusterProfiler library. The 'geneId', 'sample', and 'de_status' columns can be used in the formula 'geneId ~ sample + de_status'.

'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.

'keep_unchanged' controls whether genes with the category of 'unchanged' (not differentially expressed) are returned in the table. Additionally, genes can be returned based on whether they have differential features within a certain relative genomic location, such as promoter. This is controlled by providing a vector of annotation types to 'anno_types'.

See also

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

Examples

data(TSSs) annotation <- system.file("extdata", "S288C_Annotation.gtf", package="TSRexploreR") sample_sheet <- 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=sample_sheet, 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
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) diff_tss <- export_for_enrichment(diff_tss, data_type="tss")