Dear Ming Hao,
Thanks for your interest in the NBLAST method. Please direct any future
questions to the nat-user group (cced) so that others can potentially
benefit from the discussion. There is an example available as part of
the documentation:
http://jefferislab.github.io/nat.nblast/articles/NBLAST-Clustering.html
I have given a full worked example below that includes reading in some
SWC format neurons. Please note that your input neurons need to be
co-registered in the same space – otherwise the results will not be so
useful.
Best wishes,
Greg.
library(nat.nblast)
# generate URLs for some sample neurons available on flycircuit website
sampleurls=sprintf("
http://flycircuit.tw/download/swc/Cha-F-%s.swc",400001:400020)
# read in those URLs - would be the same if you have the neurons
downloaded on disk
samplen=read.neurons(sampleurls)
# convert to dotprops format (the input format needed by NBLAST - see
Neuron paper for details)
# resample=1 means resample to 1 micron steps, k=5 means 5 nearest
neighbours to estimate tangent vectors
# see also ?dotprops help
samplen.dps=dotprops(samplen, k=5, resample=1)
# calculate all by all similarity matrix
aba=nblast_allbyall(samplen.dps)
# cluster that
hc=nhclust(scoremat=aba)
plot(hc)
abline(h=2)
# Cut dendrogram at h=2 and plot neurons in 3d, coloured by resultant
clusters
plot3d(hc, h=2, db=samplen)
# If you wanted to get the normalised distance matrix to pass to your
own clustering/analysis method
# (0 => identical neuron) you could do that like this
sub_dist_mat(scoremat = aba)
On 20 Feb 2017, at 8:15, @明 wrote:
> Hi jefferis, I am a student in Beijing University of Technology. I
> want to do some research about neuron classification. I have installed
> R on Windows 10 and installed nblast. I got many neurons (swc file),
> I want to calculate the similarity matrix about these neurons. How can
> I load the swc files into R and calculate the similarity matrix?
--
Gregory Jefferis, PhD Tel:
+44 1223 267048
Division of Neurobiology
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge, CB2 OQH, UK
http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis
http://jefferislab.org
http://www.zoo.cam.ac.uk/departments/connectomics