NeuroAnatomy Toolbox ('nat') Extension for Assessing Neuron Similarity and Clustering

Extends package 'nat' (NeuroAnatomy Toolbox) by providing a collection of NBLAST-related functions for neuronal morphology comparison (Costa et al. (2016) ).

Release Version CRAN_Status_Badge Build Status

Quick Start

For the impatient ...

# install
if (!require("devtools")) install.packages("devtools")
devtools::install_github(c("jefferis/nat", "jefferislab/nat.nblast"))
# use
# run examples for search
# run examples for clustering
# get overview help for package
# help for functions
# run tests


This R package implements the NBLAST neuron similarity algorithm described in a preprint available at In addition to basic pairwise comparison, the package implements search of databases of neurons. There is also suport for all x all comparison for a group of neurons. This can produce a distance matrix suitable for hierarchical clustering, which is also implemented in the package.

These tools are designed as an addon for the NeuroAnatomy Toolbox (nat) R package, which you must first install.


This package has now been released to CRAN (as of v1.5), but since this is the first official release, you may wish to install the development version from GitHub, especially if you notice a bug. Although nat (the main dependency) is available on CRAN, it it recommended that you install the development version of both packages if you want to install the development version of nat.nblast: nat.nblast is evolving fast and has required several minor tweaks to nat, which is otherwise quite mature.

CRAN release


Development version

You can download the tar ball, and run R CMD INSTALL on it, or (recommended) use the devtools package to install the development version:

# install devtools if required
if (!require("devtools")) install.packages("devtools")
# then install nat
# then nat.nblast
devtools::install_github("nat.nblast", "jefferislab")

Note: Windows users need Rtools to install this way.


nat.nblast 1.6

  • fix handling of non-square matrices in sub_score_mat
  • minor doc fixes

nat.nblast 1.5

  • switch from importing nat to depending on it

nat.nblast 1.4

  • use nabor package, not RANN, for finding nearest neighbours
  • add functions for creating sparse score matrices, using spam package
  • speed up extraction of diagonal elements for on-disk score matrices
  • nblast now handles all combinations of neuron and dotprops objects

nat.nblast 1.3

  • functions to create scoring matrices; see create_scoringmatrix for details.
  • fix: really use nhclust's distfun argument
  • new nblast_allbyall function
  • add plyr support (gives parallelisation and progress bar options)

nat.nblast 1.2

  • add nhclust, plot3d.hclust, subset.hclust to help cluster/plot based on nblast scores (all ported from flycircuit package).
  • rename showSimilarity -> show_similarity
  • dev: make sure tests run during check()
  • test: update baselines given score matrix changes in 1.1

nat.nblast 1.1

  • fix: make smat.fcwb the default scoring matrix (rather than smat_alpha) when nblast's UseAlpha paramater is FALSE (the default) and smat_alpha.fcwb the default when UseAlpha=TRUE.
  • rename smat->smat.fcwb and smat_alpha->smat_alpha.fcwb to make it clear that these are defined in the FCWB template space (though they should work OK for other fly template brains that have an absolute physical scale)
  • don't set options("nat.nblast.defaultsmat""), just query it.
  • doc: basic package documentations

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.6.5 by James Manton, 2 years ago,

Report a bug at

Browse source code at

Authors: Gregory Jefferis [aut] , James Manton [aut, cre]

Documentation:   PDF Manual  

GPL-3 license

Imports nabor, dendroextras, plyr, spam

Depends on rgl, methods, nat

Suggests spelling, bigmemory, ff, testthat, knitr, rmarkdown

See at CRAN