mixMetric {CellMixS} | R Documentation

## mixMetric

### Description

mixMetric

### Usage

    mixMetric(
      sce,
      group,
      k = 300,
      dim_red = "PCA",
      assay_name = "logcounts",
      n_dim = 10,
      k_pos = 5,
      res_name = NULL
    )

### Arguments

`sce` | `SingleCellExperiment` object, with the integrated data.
`group` | Character. Name of group/batch variable. Needs to be one of `names(colData(sce))`.
`k` | Numeric. Number of k-nearest neighbours (knn) to use.
`dim_red` | Character. Name of embeddings to use as subspace for distance distributions. Default is "PCA".
`assay_name` | Character. Name of the assay to use for PCA. Only relevant if no existing 'dim_red' is provided.
`n_dim` | Numeric. Number of dimensions to include to define the subspace.
`k_pos` | Position of the cell, which rank to use for scoring, defaults to 5.
`res_name` | Character. Appendix of the result score's name (e.g. method used to combine batches).

### Details

The mixMetric function implements the mixingMetric function from Seurat (See `MixingMetric`. It takes the median rank of the '__k_pos__ neighbour from each batch as estimation for the data's entropy according to the batch variable. The same result can be assesed using the `MixingMetric` function and a seurat object from the __Seurat__ package.

### Value

A `SingleCellExperiment` with the mixing metric within colData.

### References

Stuart T Butler A Hoffman P Hafemeister C Papalexi E et. al. (2019) Comprehensive Integration of Single-Cell Data. Cell.

### Examples

    library(SingleCellExperiment)
    sim_list <- readRDS(system.file("extdata/sim50.rds", package = "CellMixS"))
    sce <- sim_list[[1]][, c(1:15, 400:420, 16:30)]

    sce <- mixMetric(sce, "batch", k = 20)

[Package CellMixS version 1.6.1 Index]