printMarkerStats: Print marker gene stats from 'findMarkers' output

View source: R/func_markers.R

printMarkerStatsR Documentation

Print marker gene stats from findMarkers output

Description

This function parses the findMarkers() output (from the ⁠pkg{scran} package) and print the number of marker genes that "passed" the ⁠fdrortop' threshold on to standard output in interactive sessions. It provides a quick way to find out the number of candidate marker genes.

Usage

printMarkerStats(
  object,
  fdr = 0.05,
  top = 200,
  pval.type = NULL,
  min.prop = NULL,
  logfc = c(0, 0),
  auc = c(0.3, 0.7)
)

Arguments

object

A named list of DataFrames returned by findMarkers(), each of which contains a sorted marker gene list for the corresponding group of comparison.

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.

pval.type

A string specifying how p-values are to be combined across pairwise comparisons for a given group/cluster when using findMarkers(). Default is NULL.

min.prop

A numeric scalar specifying the minimum proportion of significant comparisons per gene when using findMarkers(). Default is NULL.

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

Details

The function can detect the pval.type and test.type, to a certain degree, based on the resulting DataFrame structure. One can optionally provide the pval.type and min.prop settings used to run findMarkers() to allow printMarkerStats() to use them in the printed messages.

Value

‘simple’ diagnostic messages

Author(s)

I-Hsuan Lin

See Also

scran::findMarkers()

Examples

library(SingleCellExperiment)

# Load demo dataset
data(sce)

# Use result saved after running `findMarkers()` with `pval.type = "any"`
printMarkerStats(metadata(sce)[["findMarkers1"]])

# Use result saved after running `findMarkers()` with `pval.type = "all"`
printMarkerStats(metadata(sce)[["findMarkers2"]])

# Use result saved after running `findMarkers()` with `pval.type = "any"`
# and `min.prop = 0.5`
printMarkerStats(metadata(sce)[["findMarkers3"]], min.prop = 0.5)

# Use result saved after running `findMarkers()` with `test.type = "wilcox"`
printMarkerStats(metadata(sce)[["findMarkers4"]])

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