collapseCellTypes {SpatialDecon} | R Documentation

## Collapse related cell types within a deconvolution result

### Description

Given the input of an SpatialDecon result output and a list of which cell types to combine, returns a reshaped deconvolution result object with the specified cell types merged.

### Usage

    collapseCellTypes(fit, matching)

### Arguments

`fit` | The object (a list) returned by the SpatialDecon algorithm
`matching` | A list object holding the mapping from beta's cell names to official cell names. See str(safeTME.matches) for an example.

### Value

A reshaped deconvolution result object

### Examples

    data(mini_geomx_dataset)
    data(safeTME)
    data(safeTME.matches)
    # estimate background:
    mini_geomx_dataset$bg <- derive_GeoMx_background(
      norm = mini_geomx_dataset$normalized,
      probepool = rep(1, nrow(mini_geomx_dataset$normalized)),
      negnames = "NegProbe"
    )
    # run basic decon:
    res0 <- spatialdecon(
      norm = mini_geomx_dataset$normalized,
      bg = mini_geomx_dataset$bg,
      X = safeTME
    )
    res1 <- collapseCellTypes(
        fit = res0,
        matching = safeTME.matches
    )

[Package SpatialDecon version 1.4.3 Index]