cable lengh

28 views
Skip to first unread message

Arthur Zhao

unread,
Jul 8, 2019, 6:43:26 PM7/8/19
to nat-user
Hi,

Is there a function for calculating the cable length (skeleton distance) between two given nodes on a neuron ?

Thanks!
Arthur

Greg Jefferis

unread,
Jul 8, 2019, 7:03:55 PM7/8/19
to nat-user
Dear Arthur,

Thanks for your message. For this kind of work the ngraph representation of neurons is pretty useful. There is an article on the documentation site which gives an overview and worked examples 

Is there a function for calculating the cable length (skeleton distance) between two given nodes on a neuron ?
 
For your specific question, see this section of the article: 


and in brief if you have a neuron, n

n=Cell07PNs[[1]]
ng
=as.ngraph(n, weights=TRUE)
igraph
::distances(ng, v=180, to=1)

note that in this case node indices (i.e. values between 1 and N, the number of nodes in the neuron) are being used.

You can also use the CATMAID id of the vertex (arbitrary integer). In that case you need to quote the ids (because they are used as the names of the nodes in the ngraph representation).


dl4=read.neurons.catmaid('glomerulus DL4 right')
ng=as.ngraph(dl4[[1]], weights=TRUE)
igraph::distances(ng, v=1, to=20)
igraph::distances(ng, v='7737299', to='44767283')

The whole article I mention above is worth a read and you can also look at this section of the function reference


Best wishes,

Greg.


Arthur Zhao

unread,
Jul 9, 2019, 11:13:28 AM7/9/19
to nat-user
Dear Greg,

Thank you for the timely answer!  This is very helpful.

I guess in order to obtain the physical distance (since the nodes are not evenly spaced), the best way would be first getting the shortest_path, then adding up the pairwise distances? 

Best,
Arthur

Gregory Jefferis

unread,
Jul 9, 2019, 1:02:27 PM7/9/19
to Arthur Zhao, nat-user
Actually this already returns the physical distance if you make the ngraph object with weights=T. If you don’t do this, then you get the number of nodes in the path. Best, Greg.

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages