ComputekNNMatrix: Compute a 'k'-nearest-neighbour matrix for expression data

Description Usage Arguments Value References See Also

View source: R/02_Evaluate_kNN.R

Description

Finds k closest neighbours to each point in high-dimensional space and the distances to these points. You can choose from various exact or approximate algorithms to use: annoy, kd_tree, cover_tree, CR and brute.

Usage

1
2
3
4
5
6
7
ComputekNNMatrix(
  exprs,
  k,
  method = "annoy",
  dist = "euclidean",
  out.systime = NULL
)

Arguments

exprs

numeric matrix: a coordinate matrix of biological expression data (columns correspond to markers, rows correspond to cells)

k

integer: number of nearest neighbours to find for each point

method

string: k-NN algorithm to use. Default value is annoy

out.systime

optional out-variable: if an object is passed as out.systime, a side-effect of executing this function is that this object will be assigned elapsed time (in seconds) needed to complete the k-NN search

Value

list with two slots: Indices contains a matrix of nearest neighbours to each point (per row) and Distances contains a matrix of corresponding Euclidean distances

References

The code for annoy is adopted from ivis: Szubert, B., Cole, J.E., Monaco, C. et al. Structure-preserving visualisation of high dimensional single-cell datasets. Sci Rep 9, 8914 (2019). https://doi.org/10.1038/s41598-019-45301-0

See Also


davnovak/SingleBench documentation built on Dec. 19, 2021, 9:10 p.m.