DOI: 10.18129/B9.bioc.BiocNeighbors    

This package is for version 3.8 of Bioconductor; for the stable, up-to-date release version, see BiocNeighbors.

Nearest Neighbor Detection for Bioconductor Packages

Bioconductor version: 3.8

Implements exact and approximate methods for nearest neighbor detection, in a framework that allows them to be easily switched within Bioconductor packages or workflows. The exact algorithm is implemented using pre-clustering with the k-means algorithm, as described by Wang (2012). This is faster than conventional kd-trees for neighbor searching in higher (> 20) dimensional data. The approximate method uses the Annoy algorithm. Functions are also provided to search for all neighbors within a given distance. Parallelization is achieved for all methods using the BiocParallel framework.

Author: Aaron Lun [aut, cre, cph]

Maintainer: Aaron Lun <infinite.monkeys.with.keyboards at>

Citation (from within R, enter citation("BiocNeighbors")):


To install this package, start R (version "3.5") and enter:

if (!requireNamespace("BiocManager", quietly = TRUE))

For older versions of R, please refer to the appropriate Bioconductor release.


To view documentation for the version of this package installed in your system, start R and enter:



HTML R Script 1. Detecting exact nearest neighbors
HTML R Script 2. Detecting approximate nearest neighbors
HTML R Script 3. Detecting neighbors within range
PDF   Reference Manual
Text   NEWS


biocViews Classification, Clustering, Software
Version 1.0.0
In Bioconductor since BioC 3.8 (R-3.5) (0.5 years)
License GPL-3
Depends R (>= 3.5), BiocParallel
Imports Rcpp, S4Vectors, stats, methods
LinkingTo Rcpp, RcppAnnoy
Suggests testthat, BiocStyle, knitr, rmarkdown, FNN, RcppAnnoy
SystemRequirements C++11
Depends On Me simpleSingleCell
Imports Me cydar, scran
Suggests Me
Links To Me
Build Report  

Package Archives

Follow Installation instructions to use this package in your R session.

Source Package BiocNeighbors_1.0.0.tar.gz
Windows Binary (32- & 64-bit)
Mac OS X 10.11 (El Capitan) BiocNeighbors_1.0.0.tgz
Source Repository git clone
Source Repository (Developer Access) git clone
Package Short Url
Package Downloads Report Download Stats

Documentation »


R / CRAN packages and documentation

Support »

Please read the posting guide. Post questions about Bioconductor to one of the following locations: