FindNeighbors: SNN Graph Construction

Description Usage Arguments Value Examples

Description

Constructs a Shared Nearest Neighbor (SNN) Graph for a given dataset. We first determine the k-nearest neighbors of each cell. We use this knn graph to construct the SNN graph by calculating the neighborhood overlap (Jaccard index) between every cell and its k.param nearest neighbors.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
FindNeighbors(object, ...)

## Default S3 method:
FindNeighbors(object, distance.matrix = FALSE,
  k.param = 10, compute.SNN = TRUE, prune.SNN = 1/15, nn.eps = 0,
  verbose = TRUE, force.recalc = FALSE, ...)

## S3 method for class 'Assay'
FindNeighbors(object, features = NULL, k.param = 10,
  compute.SNN = TRUE, prune.SNN = 1/15, nn.eps = 0, verbose = TRUE,
  force.recalc = FALSE, ...)

## S3 method for class 'dist'
FindNeighbors(object, k.param = 10, compute.SNN = TRUE,
  prune.SNN = 1/15, nn.eps = 0, verbose = TRUE,
  force.recalc = FALSE, ...)

## S3 method for class 'Seurat'
FindNeighbors(object, reduction = "pca", dims = 1:10,
  assay = NULL, features = NULL, k.param = 30, compute.SNN = TRUE,
  prune.SNN = 1/15, nn.eps = 0, verbose = TRUE,
  force.recalc = FALSE, do.plot = FALSE, graph.name = NULL, ...)

Arguments

object

An object

...

Arguments passed to other methods

distance.matrix

Boolean value of whether the provided matrix is a distance matrix; note, for objects of class dist, this parameter will be set automatically

k.param

Defines k for the k-nearest neighbor algorithm

compute.SNN

also compute the shared nearest neighbor graph

prune.SNN

Sets the cutoff for acceptable Jaccard index when computing the neighborhood overlap for the SNN construction. Any edges with values less than or equal to this will be set to 0 and removed from the SNN graph. Essentially sets the strigency of pruning (0 — no pruning, 1 — prune everything).

nn.eps

Error bound when performing nearest neighbor seach using RANN; default of 0.0 implies exact nearest neighbor search

verbose

Whether or not to print output to the console

force.recalc

Force recalculation of SNN.

features

Features to use as input for building the SNN

reduction

Reduction to use as input for building the SNN

dims

Dimensions of reduction to use as input

assay

Assay to use in construction of SNN

do.plot

Plot SNN graph on tSNE coordinates

graph.name

Optional naming parameter for stored SNN graph. Default is assay.name_snn.

Value

Returns the object with object@snn filled

Examples

1
2
3
4
5
6
7
8
pbmc_small
# Compute an SNN on the gene expression level
pbmc_small <- FindNeighbors(pbmc_small, features = VariableFeatures(object = pbmc_small))

# More commonly, we build the SNN on a dimensionally reduced form of the data
# such as the first 10 principle components.

pbmc_small <- FindNeighbors(pbmc_small, reduction = "pca", dims = 1:10)

atakanekiz/Seurat3.0 documentation built on May 26, 2019, 2:33 a.m.