SelectTopGenes: Select top or bottom N genes based on a selection criterion

View source: R/Utils.R

SelectTopGenesR Documentation

Select top or bottom N genes based on a selection criterion

Description

The SelectTopGenes function enables selecting top or bottom N genes based on a criterion (e.g. log2FC or adj.p.value).

Usage

SelectTopGenes(
  gene.markers = NULL,
  top.N = 10,
  criterion.type = "log2FC",
  inverse = FALSE
)

Arguments

gene.markers

A data frame of the gene markers found by FindAllGeneMarkers function.

top.N

How many top or bottom genes to select. Default is 10.

criterion.type

Which criterion to use for selecting the genes. Default is "log2FC".

inverse

Whether to select bottom instead of top N genes. Default is FALSE.

Value

an object of 'data.frame' class

Examples

library(SingleCellExperiment)
sce <- SingleCellExperiment(assays = list(logcounts = pbmc3k_500))
sce <- PrepareILoReg(sce)
## These settings are just to accelerate the example, use the defaults.
sce <- RunParallelICP(sce,L=2,threads=1,C=0.1,k=5,r=1)
sce <- RunPCA(sce,p=5)
sce <- HierarchicalClustering(sce)
sce <- SelectKClusters(sce,K=5)
gene_markers <- FindAllGeneMarkers(sce)
## Select top 10 markers based on log2 fold-change
top10_log2FC <- SelectTopGenes(gene_markers,
                               top.N = 10,
                               criterion.type = "log2FC",
                               inverse = FALSE)


elolab/iloreg documentation built on March 27, 2022, 4:19 a.m.