Skip to contents

This function rebases the gene expression matrix in a `SummarizedExperiment` object using a specified annotation as the primary identifier.

Usage

rebase_gexp(exp_data, annotation = "gene_name")

Arguments

exp_data

A `SummarizedExperiment` object containing the gene expression data.

annotation

A character string specifying the column in the gene annotation to use as the main identifier. Default is `"gene_name"`.

Value

A `SummarizedExperiment` object with rebased gene expression data. The output includes updated `rowData` with summarized gene-level information, and new `assays` containing rebased `counts` and `tpm` matrices.

Details

This function rebases the gene expression data by aggregating counts based on the specified annotation. It also calculates transcripts per million (TPM) using the aggregated data and associated gene lengths.

The function performs the following steps: - Aggregates gene counts and metadata based on the specified annotation. - Calculates TPM values using the rebased gene counts and average gene lengths. - Constructs a new `SummarizedExperiment` object with the rebased data.