.cmsCell {CellMixS} | R Documentation

## .cmsCell

### Description

Function to calculate a cellspecific mixing score (cms) of groups/batches.

### Usage

    .cmsCell(
      cell,
      group,
      knn,
      k_min = NA,
      batch_min = NULL,
      cell_min = 4,
      unbalanced = FALSE,
      sce
    )

### Arguments

`cell` | Character. Name of the cell to calculate cms for. Needs to be one of `rownames(knn)`.
`group` | Character. Name of group/batch variable. Needs to be one of `names(knn)`.
`knn` | List with three elements. First "index" with indices of knn cells. Second "distance" with distances to knn cells. Third a slot named by `group` variable with group level of knn cells.
`k_min` | Numeric. Minimum number of knn to include. Default is NA (see Details).
`batch_min` | Numeric. Minimum number of cells per batch to include in to the AD test. If set neighbours will be included until batch_min cells from each batch are present.
`cell_min` | Numeric. Minimum number of cells from each group to be included into the AD test. Should be > 4 to make 'ad.test' working.
`unbalanced` | Boolean. If True neighbourhoods with only one batch present will be set to NA. This way they are not included into any summaries or smoothening.
`sce` | A `SingleCellExperiment` object with the combined data.

### Details

The cms function tests the hypothesis, that group-specific distance distributions of knn cells have the same underlying unspecified distribution. It performs Anderson-Darling tests as implemented in the `kSamples package`. In default the function uses all distances and group label defined in knn. If `k_min` is specified, the first local minimum of the overall distance distribution with at least kmin cells is used. This can be used to adapt to the local structure of the datatset e.g. prevent cells from a distinct different cluster to be included.

### Value

A p.value as resulting from the ad.test.

### See Also

`ad.test`, `cms`, `.smoothCms`

Other helper functions: `.defineSubspace()`, `.filterKnn()`, `.filterLocMin()`, `.ldfKnn()`, `.smoothCms()`

[Package CellMixS version 1.4.2 Index]