mapGenes: Map genes

mapGenesToRownamesR Documentation

Map genes

Description

Take a user-defined gene vector and dynamically map the input to either the object rownames or the gene names (symbols). These functions are useful for writing code that needs to handle either gene identifier or gene name input dynamically (e.g. for single-cell RNA-seq marker analysis).

Usage

mapGenesToRownames(object, ...)

mapGenesToIds(object, ...)

mapGenesToSymbols(object, ...)

## S4 method for signature 'SummarizedExperiment'
mapGenesToRownames(object, genes, strict = TRUE)

## S4 method for signature 'SummarizedExperiment'
mapGenesToIds(object, genes, strict = TRUE)

## S4 method for signature 'SummarizedExperiment'
mapGenesToSymbols(object, genes, strict = TRUE)

Arguments

object

Object.

genes

character. Gene identifiers.

strict

logical(1). Require all genes to match. Recommended by default. If set FALSE, instead will return a warning to the user, and subset the genes vector to only include matches.

...

Additional arguments.

Value

character.

Ambiguous gene names

Some genomes (e.g. Homo sapiens, Mus musculus) contain duplicated gene names for multiple gene identifiers. Normally we handle these ambiguous gene names by sanitizing them with make.names. If a user requests a gene name that is duplicated, these functions will return a warning.

Note

Updated 2021-10-08.

Examples

data(RangedSummarizedExperiment, package = "AcidTest")

## SummarizedExperiment ====
object <- RangedSummarizedExperiment
rownames <- head(rownames(object))
print(rownames)
g2s <- GeneToSymbol(object)
geneIds <- head(g2s[["geneId"]])
print(geneIds)
geneNames <- head(g2s[["geneName"]])
print(geneNames)

## Row names.
mapGenesToRownames(object, genes = rownames)
mapGenesToRownames(object, genes = geneIds)
mapGenesToRownames(object, genes = geneNames)

## Gene identifiers.
mapGenesToIds(object, genes = rownames)
mapGenesToIds(object, genes = geneIds)
mapGenesToIds(object, genes = geneNames)

## Gene names (symbols).
mapGenesToSymbols(object, genes = rownames)
mapGenesToSymbols(object, genes = geneIds)
mapGenesToSymbols(object, genes = geneNames)

acidgenomics/r-acidexperiment documentation built on Jan. 17, 2024, 7:56 p.m.