locStructure: locStructure

Description Usage Arguments Details Value References Examples

View source: R/otherMetrics.R

Description

locStructure

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
locStructure(
  sce,
  group,
  dim_combined,
  k = 100,
  dim_red = "PCA",
  assay_name = "logcounts",
  n_dim = 10,
  n_combined = 10,
  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)).

dim_combined

Charactyer. Name of the reduced dimensional representation of the integrated data. Needs to be one of reducedDimNames(sce)).

k

Numeric. Number of k-nearest neighbours (knn) to use.

dim_red

Character. Name of embeddings to calculate neighbourhoods before integration. Default is "PCA".

assay_name

Character. Name of the assay to use for PCA of the original (not integrated) data. Should not refer to "corrected" counts.

n_dim

Numeric. Number of dimensions to include for the original data.

n_combined

Numeric. Number of dimensions to include for the integrated data.

res_name

Character. Appendix of the result score's name (e.g. method used to combine batches).

Details

The locStructure function implements the localStructure function from Seurat (See LocalStruct. For each group it calculates the k nearest neighbour within PCA space before integration and compares it to the knn within the reduced dimensional representation after integration. The score represents the proportion of overlapping neighbours. The LocalStruct function is based on the RunPCA function, while here runPCA is used. This can cause small deviance from the LocalStruct function, but overall these functions are equivalent.

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

1
2
3
4
5
library(SingleCellExperiment)
sim_list <- readRDS(system.file("extdata/sim50.rds", package = "CellMixS"))
sce <- sim_list[["batch20"]][, c(1:50, 300:350)]

sce <- locStructure(sce, "batch", "MNN", k = 20, assay_name = "counts")

CellMixS documentation built on Dec. 19, 2020, 2 a.m.