.preprocessData {SpatialCPie} | R Documentation

## Preprocess data

### Description

Preprocesses input data for `.makeServer`.

### Usage

    .preprocessData(counts, margin, resolutions, assignmentFunction,
      coordinates = NULL)

### Arguments

`counts` | count matrix. `rownames` should correspond to genes and `colnames` should correspond to spot coordinates.
`margin` | which margin of the count matrix to cluster. Valid values are `c("spot", "sample", "gene", "feature")`.
`resolutions` | vector of resolutions to cluster.
`assignmentFunction` | function to compute cluster assignments. The function should have the following signature: integer (number of clusters) -> (m, n) feature matrix -> m-length vector (cluster assignment of each data point).
`coordinates` | optional `data.frame` with pixel coordinates for each spot. `rownames` should correspond to the `colnames` of `counts` and the columns `x` and `y` should specify the pixel coordinates of the spots.

### Value

list with the following elements:

- `$assignments`: tidy assignments

- `$means`: cluster means

- `$scores`: cluster scores for each spot in each resolution

- `$colors`: cluster colors

- `$coordinates`: spot coordinates, either from `coordinates` or parsed from `assignments`

- `$featureName`: name of the clustered feature (the "opposite" of `margin`)

[Package SpatialCPie version 1.3.4 Index]