Summarize a transcript level matrix to gene level.

summarize_to_gene(mtx, tx2gene, fun = "sum", genes = NULL)

Arguments

mtx

A (sparse) expression matrix on transcript / feature level

tx2gene

A data frame, mapping the mtx rownames (first column) to genes (second column).

fun

character string specifying the name of aggregation function to be applied to all columns in data. Currently "sum", "count", and "mean" are supported.

genes

Optionally only summarize specific genes.

Value

A summarised (sparse) matrix

Details

Can be used with sparse or dense expression matrices