convertGeneIds: Change Gene Identifiers

Description Usage Arguments Details Value Examples

View source: R/Utilities.R

Description

Changes gene identifiers by aggregating expression measures (sum). This is mainly useful when changing from Ensembl IDs to Gene Symbols

Usage

1

Arguments

exp

expression matrix (genes x cells)

newIds

character vector specifying the new identifer that corresponds with each row of the input exp matrix

Details

This method is made fast by the use of sparse matrix multiplication

i.e.: (newIds x oldIds) x (oldIds x cells) = (newIds x cells)

Value

a matrix in which rows with duplicate 'newIds' have been summed together

Examples

1
2
3
4
5
6
7
8
exp <- matrix(c(1, 1, 1, 2, 2, 2, 3, 3, 3), nrow=3)
colnames(exp) <- c("Cell1", "Cell2", "Cell3")
print(exp)

newIds <- c("GeneA", "GeneA", "GeneB")

result <- convertGeneIds(exp, newIds)
print(result)

YosefLab/VISION documentation built on Sept. 14, 2021, 5:27 p.m.