# Aggregating ULM cell-type scores by cluster

**URL:** <https://discourse.scverse.org/t/aggregating-ulm-cell-type-scores-by-cluster/4044>\
**Category:** decoupler\
**Created:** [August 26, 2026, 10:06am UTC](https://discourse.scverse.org/t/aggregating-ulm-cell-type-scores-by-cluster/4044 "2026-08-26T10:06:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![albi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/albi/32/1597_2.png) [@albi](https://discourse.scverse.org/u/albi)\
**Post date:** [August 26, 2026, 10:06am UTC](https://discourse.scverse.org/t/aggregating-ulm-cell-type-scores-by-cluster/4044/1 "2026-08-26T10:06:10Z")

</div>

Hi! I am using `decoupler.mt.ulm` with a network of cell-type marker genes to obtain cell-type enrichment scores, basically following the cell-type scoring approach shown in the single-cell enrichment analysis tutorial.

I would like to summarize these scores at the cluster level, so that I obtain a single enrichment score for each **Leiden cluster × candidate cell type** combination. My idea is to aggregate the cell-level ULM scores within each Leiden cluster, for example by taking the mean or median. I would then like to visualize the resulting **cluster × cell-type** matrix as a heatmap and use it as one source of information for cluster annotation.

So, my questions are:

- Does this approach make statistical sense for ULM enrichment scores?
- Is there a preferred aggregation method for these scores?
- Does decoupler already provide a function for this type of aggregation?

Thank you!

---

<div class="post-metadata">

**Author:** ![PauBadiaM](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/paubadiam/32/410_2.png) [@PauBadiaM](https://discourse.scverse.org/u/PauBadiaM)\
**Post date:** [September 7, 2026, 11:48pm UTC](https://discourse.scverse.org/t/aggregating-ulm-cell-type-scores-by-cluster/4044/2 "2026-09-07T23:48:35Z")

</div>

Hi @albi,

You can directly do this with `sc.pl.matrixplot` if you only want to visualize the aggregated scores. If you want to keep them as an object you can use `dc.pp.pseudobul` but instead of using `mode='sum'` you can use `mode='mean`’. You can check how to do it in the decoupler vignettes: [single-cell](https://decoupler.readthedocs.io/en/latest/notebooks/scell/rna_sc.html) and [pseudobulk](https://decoupler.readthedocs.io/en/latest/notebooks/scell/rna_psbk.html)

Hope this is helpful!
