natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
64 stars 28 forks source link

bug in endpoints with multiple subtrees #376

Open Erginkayam opened 6 years ago

Erginkayam commented 6 years ago
> endpoints(lptcin.mids[[1]], subtrees = 1:2)
Error in UseMethod("as.ngraph") : 
  no applicable method for 'as.ngraph' applied to an object of class "c('seglist', 'list')"
> traceback()
6: as.ngraph(x)
5: endpoints(as.ngraph(x))
4: FUN(X[[i]], ...)
3: lapply(x$SubTrees[subtrees], function(x) endpoints(as.ngraph(x)))
2: endpoints.neuron(lptcin.mids[[1]], subtrees = 1:2)
1: endpoints(lptcin.mids[[1]], subtrees = 1:2)
jefferis commented 5 years ago

Hi @Erginkayam somehow dropped this last summer, but hit it recently myself. One workaround was to convert the neuron to an ngraph object, but this returns all endpoints rather than allowing you to retrieve them for identified subtrees:

ng=lptcin.mids[[1]]
endpoints(ng)
jefferis commented 5 years ago

I will commit a fix shortly.

Erginkayam commented 5 years ago

Great, thank you for the heads up!