Skip to contents

Adapted from scanpy's strategy in sc.pp.neighbors() to compute connectivities. Two methods are available, using a Gaussian kernel or a fuzzy union of simplical sets as implemented in umap-learn

Usage

GetConnectivities(
  object,
  neighbors.use,
  method = c("umap", "gauss"),
  graph.name = NULL,
  assay = NULL,
  umap.set.op.mix.ratio = 1,
  umap.local.connectivity = 1,
  umap.niter.smoothing = 64L,
  umap.apply.set.operations = TRUE,
  umap.bipartite = FALSE,
  gauss.sigmas = NULL,
  gauss.median.sigma = FALSE,
  verbose = TRUE
)

Arguments

object

a Seurat object

neighbors.use

name of a Neighbor instance stored in the Seurat object to derive connectivities from.

method

one of "umap" or "gauss". Decides whether connectivities are computed using a fuzzy union of simplical sets ("umap") or a Gaussian kernel ("gauss")

graph.name

name of the return Graph of connectivities to store in the Seurat object.

assay

name of the assay to reference in the output Graph object. Use the default assay of object if not provided.

umap.set.op.mix.ratio

float between 0 and 1. Controls how the fuzzy sets are mixed to obtain a global fuzzy simplicial set. 0 and 1 correspond to a pure fuzzy intersection and union, respectively. Both fuzzy set operations use the product t-norm. Only applies to the umap method.

umap.local.connectivity

The local connectivity required, i.e. the expected number of nearest neighbours locally connected. The higher, the more local connections are output. In practice, this should be not more than the local intrinsic dimension of the manifold. Only applies to the umap method when umap.apply.set.operations = TRUE.

umap.niter.smoothing

maximum number of iterations during the smoothing process of distances. Only applies to the umap method.

umap.apply.set.operations

set to FALSE to disable the fuzzy union or intersection of the local fuzzy simplicial sets into a global fuzzy simplicial set. Only applies to the umap method.

umap.bipartite

whether the knn network is bipartite (FALSE by default). Only applies to the umap method.

gauss.sigmas

by default, a sigma value (i.e. width of the kernel) per cell is computed internally. Those sigmas are controlling for each cell's connectivities range and magnitude. Alternatively, you can provide your own width(s). If the length of sigmas is shorter than the number of cells, it will be recycled. Only applies to the Gaussian method.

gauss.median.sigma

which estimation method to use when sigmas = NULL. By default, use the cell’s distance to its kth nearest neighbour. When median.sigma = TRUE, use the median of distances to the nearest neighbours (excluding self). Only applies to the Gaussian method.

verbose

whether to print progress messages

Value

the Seurat object with a new Graph instance of name graph.name

Note

The UMAP method is a re-implementation of the function fuzzy_simplicial_set() from umap-learn and should estimate identical connectivities. You can check the original documentation.

The Gaussian kernel method is a re-implementation of the analogous function from scanpy called by sc.pp.neighbors(). You can have a look at the original function
median.sigmas = FALSE is the method used in Haghverdi L. et al.,2016.

References

McInnes, L., Healy, J. & Melville, J. UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction. arXiv preprint (2018). DOI

Wolf, F. A., Angerer, P. & Theis, F. J. SCANPY: large-scale single-cell gene expression data analysis. Genome Biology 19, (2018).

Coifman, R. R., Lafon, S., Lee, A. B., Maggioni, M., Nadler, B., Warner, F. & Zucker, S. W. Geometric diffusions as a tool for harmonic analysis and structure definition of data: Diffusion maps. PNAS 102, 7426–7431 (2005). DOI

Haghverdi, L., Büttner, M., Wolf, F. A., Buettner, F. & Theis, F. J. Diffusion pseudotime robustly reconstructs lineage branching. Nature Methods 13, 845–848 (2016). DOI