.smoothCms {CellMixS} | R Documentation

## .smoothCms

### Description

Performs weighted smoothening of cms scores

### Usage

    .smoothCms(knn, cms_raw, cell_names, k_min, k)

### Arguments

`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.
`cms_raw` | Matrix with raw cms scores for all cells specified in `cell_names` and `knn`. Colnames need to be "cms.
`cell_names` | Character vector with cell names corresponding to the rownames of the list elements in `knn` and `rownames(cms_raw)`.
`k_min` | Numeric. Minimum number of Knn to include. Default is NA (see Details).
`k` | Numeric. Number of k-nearest neighbours (Knn) to use.

### Details

Internal function to smooth cms scores. In a complete random setting cms scores are uniform distributed. To reduce the resulting random variance and enable visualization of local pattern cms scores can be smoothened assuming that within one region mixing is uniform. Generates smoothened cms scores using weigthed means of cms scores within the k-nearest neighbourhood. Reciprocal distances are used as weights.

### Value

matrix with two columns ("cms_smooth", "cms").

### See Also

`.cmsCell`, `cms`

Other helper functions: `.cmsCell`, `.defineSubspace`, `.filterLocMin`, `.ldfKnn`

[Package CellMixS version 1.0.2 Index]