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

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

Value

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

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)

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)