convertGeneIds: Change Gene Identifiers

View source: R/Utilities.R

convertGeneIdsR Documentation

Change Gene Identifiers

Description

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

Usage

convertGeneIds(exp, newIds)

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


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/FastProjectR documentation built on June 13, 2024, 4:20 p.m.