translateCounts
renames counts matrix rownames according to supplied
dict
ionary. 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)
#> treatment control
#> GATA5 5 3
#> TBX5 4 2