translateCounts: Translate counts matrix rownames

View source: R/utils.R

translateCountsR Documentation

Translate counts matrix rownames

Description

translateCounts renames counts matrix rownames according to supplied dictionary. Function can handle many to one assignments by taking a sum or an average over counts rows. Other types of ambiguous assignments are not supported.

Usage

translateCounts(counts, dict)

Arguments

counts

matrix of expression values.

dict

named character vector mapping counts rownames to new values. Values of vector should correspond to new desired rownames, and its names to current rownames.

Value

matrix of expression values with new rownames.

Examples

counts <- matrix(
data = c(5, 4, 3, 2),
nrow = 2,
   dimnames = list(
     c("ENSG00000130700", "ENSG00000089225"),
     c("treatment", "control")
   )
 )
dict <- c(ENSG00000130700 = "GATA5", ENSG00000089225 = "TBX5")
translateCounts(counts, dict)


bkaczkowski/xcore documentation built on Jan. 26, 2024, 6:24 p.m.