getDeaResultsDf: Obtain de-analysis results

View source: R/getA-G.R

getDeaGenesR Documentation

Obtain de-analysis results

Description

A convenient way to extract the differential gene expression analysis results. Function getDeaGenes() is a wrapper around getDeaResultsDf() and returns only gene names in a character vector. See details for more.

Usage

getDeaGenes(
  object,
  across = getDefaultGrouping(object),
  across_subset = NULL,
  method_de = "wilcox",
  max_adj_pval = NULL,
  min_lfc = 0,
  n_highest_lfc = NULL,
  n_lowest_pval = NULL,
  flatten = TRUE,
  of_sample = NA
)

getDeaResultsDf(
  object,
  across = getDefaultGrouping(object),
  across_subset = NULL,
  relevel = FALSE,
  method_de = "wilcox",
  max_adj_pval = NULL,
  min_lfc = NULL,
  n_highest_lfc = NULL,
  n_lowest_pval = NULL,
  of_sample = NA,
  stop_if_null = TRUE
)

Arguments

object

A valid spata-object.

across

Character value or NULL. Specifies the grouping variable of interest.

Use getGroupingOptions() to obtain all variable names that group the barcode spots of your object in a certain manner.

across_subset

Character vector or NULL. Specifies the particular groups of interest the grouping variable specified in argument across contains.

If set to NULL all of them are chosen. You can prefix groups you are NOT interested in with a '-'. (Saves writing if there are more groups you are interested in than groups you are not interested in.)

Use getGroupNames() to obtain all valid input options.

method_de

Character value. Denotes the method to according to which the de-analysis is performed. Given to argument test.use of the Seurat::FindAllMarkers()-function. Run SPATA::dea_methods to obtain all valid input options.

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.

of_sample

This argument is currently inactive. It might be reactivated when spata-objects can store more than one sample.

relevel

Logical value. If set to TRUE the input order of across_subset determines the order in which the groups of interest are displayed. Groups that are not included are dropped which affects the colors with which they are displayed.

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

A data.frame:

  • gene Character. The differentially expressed genes.

  • 'across' Character. The grouping across which the analysis was performed. The variable/column name is equal to the input for argument across.

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


kueckelj/SPATA2 documentation built on March 16, 2024, 10:25 a.m.