getMarkers: Retrieve marker genes from a 'findMarkers' output DataFrame

View source: R/func_markers.R

getMarkersR Documentation

Retrieve marker genes from a findMarkers output DataFrame

Description

This function parses a findMarkers() output DataFrame and returns the up- and down-regulated marker genes that passed the specified threshold.

Usage

getMarkers(
  object,
  direction = "both",
  fdr = 0.05,
  top = 200,
  logfc = c(0, 0),
  auc = c(0.3, 0.7),
  max = 1000,
  column_by = NULL
)

Arguments

object

A DataFrame that contain a sorted marker gene list for a single group. It should be taken from a named list of DataFrames returned by findMarkers().

direction

A string indicating the directionality of expression changes of markers to retreive. Allowable character values are "both", "up" and "down". Default is "both".

fdr

A numeric scalar indicating the FDR threashold used to select markers. This threshold has no effect when the input source is from findMarkers() ran with pval.type = "any". Default is 0.05.

top

An integer scalar indicating the 'Top' threashold used to select markers. This threshold is only applicable when the input source is from findMarkers() ran with pval.type = "any". Default is 200.

logfc

A numeric vector of length 2 specifying the logFC threasholds used to select up-/down-regulated markers/DEGs. This threshold has no effect when the input source is from findMarkers() ran with test.type = "wilcox". Default is c(0, 0).

auc

A numeric vector of length 2 specifying the AUC threasholds used to select up-/down-regulated markers. This threshold is only applicable when the input source is from findMarkers() ran with test.type = "wilcox". Default is c(0.3, 0.7).

max

An integer scalar indicating the maximum number of markers to return. Default is 1000.

column_by

A string indicating the column name containing the gene symbols or IDs in the input object and the selected information is returned. When column_by = NULL, it retreives the row names from the DataFrame. Default is NULL.

Details

The function takes a DataFrame from the findMarkers() output (which is a named list of DataFrames) and returns the marker genes that "passed" the fdr or top threshold.

By specifying direction, the function selects up-regulated markers when direction = "up", down-regulated markers when direction = "down" and both up- and down-regulated markers when direction = "both" (default). The definition of up/down-regulation depends on the test.type used when running findMarkers().

Value

A character vector

Author(s)

I-Hsuan Lin

See Also

scran::findMarkers()

Examples

library(SingleCellExperiment)

# Load demo dataset
data(sce)

# Retrieve first 1000 markers (default `max`) from the 1st DataFrame
# in 'findMarkers1', return rownames
getMarkers(metadata(sce)[["findMarkers1"]][[1]])

# Retrieve first 1000 up-regulated markers from the 2nd DataFrame
# in 'findMarkers4', return rownames
getMarkers(metadata(sce)[["findMarkers4"]][[2]], direction = "up")

ycl6/scRUtils documentation built on Feb. 18, 2025, 6:14 a.m.