Skip to contents

This function collapses replicate samples in a tidyseurat object based on differential expression (DE) results. It returns a new tidyseurat object with a 'DE' assay containing the aggregated values.

Usage

aggregate_by_de(data, metric_col = "metric")

Arguments

data

A tidyseurat object with DE results

metric_col

A character string indicating the column name in each DE dataframe to use for aggregation. Defaults to "metric".

Value

A new tidyseurat object with collapsed metadata

Details

This function performs the following steps:

  • Converts the list of DE comparisons into a gene-by-condition matrix.

  • Aggregates metadata across replicates by combined_id.

  • Creates a new Seurat object with this matrix as a "DE" assay

Examples

data(mini_mac)
mac_collapsed <- aggregate_by_de(mini_mac)