filterDeaDf: Postprocess DEA results

View source: R/f.R

filterDeaDfR Documentation

Postprocess DEA results

Description

Processes the results of getDeaResultsDf(). See details.

Usage

filterDeaDf(
  dea_df,
  max_adj_pval = 0.05,
  min_lfc = 0,
  n_highest_lfc = 25,
  n_lowest_pval = 25,
  across_subset = NULL,
  relevel = FALSE,
  return = "data.frame"
)

Arguments

dea_df

A data.frame containing information about differentially expressed genes. Must contain the variables:

gene

Character. The differentially expressed genes.

cluster

Character. The clusters (or experimental groups) across which the analysis was performed.

avg_logFC

Numeric. The average log-fold change to which the belonging gene was differentially expressed..

p_val

Numeric. The p-values.

p_val_adj

Numeric. The adjusted p-values.

Hint: Use the resulting data.frame of SPATA::findDE() or it's descendants as input.

max_adj_pval

Numeric value. Sets the threshold for adjusted p-values. All genes with adjusted p-values above that threshold are ignored.

min_lfc

Numeric value. Sets the threshold for average log fold change. All genes with an average log fold change below that threshold are ignored.

n_highest_lfc

Numeric value. Affects the total number of genes that are kept. See details.

n_lowest_pval

Numeric value. Affects the total number of genes that are kept. See details.

return

Character value. Denotes the output type. One of 'data.frame', 'vector' or 'list

Details

The de-data.frame is processed such that the following steps are performed for every experimental group.

  1. Discards genes with avg_logFC-values that are either infinite or negative

  2. Discards genes with adjusted p-values above the threshold set with max_adj_pval

  3. Discard genes with average log fold change below the treshold set with min_lfc

  4. Slices the data.frame in order that for every experimental group:

    1. the n genes with the highest avg_logFC-values are kept where n = n_highest_lfc

    2. the n genes with the lowest p_val_adj-values are kept where n = n_lowest_pval

  5. Arranges the genes according to the highest avg_logFC-values

Value

Depends on input of argument return:

  • return = 'data.frame': The filtered data.frame of dea_df with all its variables.

  • return = 'vector': A named vector of all genes that remain. Named by the experimental group in which they were differently expressed.

  • return = 'list: A list named according to the experimental groups. Every slot of that list is a character vector containing the differently expressed genes of the respective experimental group.


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.