nat.nblast v1.6.5


Monthly downloads



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) <doi: 10.1016/j.neuron.2016.06.012>).



natverse Release Version CRAN status Build Status Docs

nat.nblast is part of the NeuroAnatomy Toolbox suite of R packages.

Quick Start

For the impatient ...

# install
if (!require("devtools")) install.packages("devtools")
devtools::install_github(c("natverse/nat", "natverse/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

Costa M, Manton JD, Ostrovsky AD, Prohaska S, Jefferis GS. NBLAST: Rapid, Sensitive Comparison of Neuronal Structure and Construction of Neuron Family Databases.Neuron. 2016 Jul 20;91(2):293-311. doi: 10.1016/j.neuron.2016.06.012.

In addition to basic pairwise comparison, the package implements search of databases of neurons. There is also support 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 will be installed as dependency.

You will probably find the following online documentation helpful:


This package has been released to CRAN (since v1.5), but we generally recommend installing the development version from GitHub, especially if you notice a bug.

CRAN release


Development version

Use devtools to install the development version:

# install devtools if required
if (!require("devtools")) install.packages("devtools")
# then nat.nblast

Note that this will also update the nat package to the latest development version from github. Windows users need Rtools to install this way.

Functions in nat.nblast

Name Description
smat.fcwb Scoring matrices for neuron similarities in FCWB template brain
fill_pairs_sparse_score_mat Add forwards, reverse and self scores for a pair of neurons to a sparse score matrix
subset.hclust Return the labels of items in 1 or more groups cut from hclust object
[ Extract parts of a sparse spam matrix
nat.nblast-package Neuron similarity, search and clustering tools
show_similarity Display two neurons with segments in the query coloured by similarity
sub_dist_mat Convert (a subset of) a raw score matrix to a distance matrix
sub_score_mat Return scores (or distances) for given query and target neurons
plot3d.hclust Methods to identify and plot groups of neurons cut from an hclust object
neuron_pairs Utility function to generate all or random pairs of neurons
sparse_score_mat Convert a subset of a square score matrix to a sparse representation
nhclust Cluster a set of neurons
nblast Calculate similarity score for neuron morphologies
nblast_allbyall Wrapper function to compute all by all NBLAST scores for a set of neurons
NeuriteBlast Produce similarity score for neuron morphologies
calc_score_matrix Calculate scoring matrix from probability matrices for matching and non-matching sets of neurons
diagonal Extract diagonal terms from a variety of matrix types
calc_dists_dotprods Calculate distances and dot products between two sets of neurons
create_scoringmatrix Create a scoring matrix given matching and non-matching sets of neurons
WeightedNNBasedLinesetMatching Compute point & tangent vector similarity score between two linesets
fctraces20 20 traced Drosophila neurons from Chiang et al 2011
calc_prob_mat Calculate probability matrix from distances and dot products between neuron segments
fill_in_sparse_score_mat Add one or more submatrices to a sparse score matrix
No Results!

Vignettes of nat.nblast

No Results!

Last month downloads


Type Package
License GPL-3
LazyData yes
VignetteBuilder knitr
RoxygenNote 7.0.2
Language en-GB
Encoding UTF-8
NeedsCompilation no
Packaged 2020-01-23 13:47:22 UTC; James Manton
Repository CRAN
Date/Publication 2020-01-23 14:10:05 UTC

Include our badge in your README