spine: Compute the longest path (aka spine or backbone) of a neuron

View source: R/ngraph.R

spineR Documentation

Compute the longest path (aka spine or backbone) of a neuron

Description

Compute the longest path (aka spine or backbone) of a neuron

Usage

spine(
  n,
  UseStartPoint = FALSE,
  SpatialWeights = TRUE,
  invert = FALSE,
  rval = c("neuron", "length", "ids")
)

Arguments

n

the neuron to consider.

UseStartPoint

Whether to use the StartPoint of the neuron (often the soma) as the starting point of the returned spine.

SpatialWeights

logical indicating whether spatial distances (default) should be used to weight segments instead of weighting each edge equally.

invert

When invert=TRUE the spine is pruned away instead of being selected. This is only valid when rval='neuron' or rval='ids'.

rval

Character vector indicating the return type, one of 'neuron', 'length' or 'ids'. See Value section.

Details

Note that when UseStartPoint=FALSE, spine will find the path between all end points (including the root if it is an end point). Since the longest path must include an end point, this is equivalent to searching the whole graph for the longest path, but considerably faster.

Value

Either

  • a neuron object corresponding to the longest path or

  • the length of the longest path (when rval="length") or

  • an integer vector of raw point indices (when rval="ids").

See Also

diameter, shortest.paths, prune_strahler for removing lower order branches from a neuron, prune for removing parts of a neuron by spatial criteria.

Other neuron: neuron(), ngraph(), plot.dotprops(), potential_synapses(), prune(), resample(), rootpoints(), subset.neuron()

Examples

pn.spine=spine(Cell07PNs[[1]])

plot3d(Cell07PNs[[1]])
plot3d(pn.spine, lwd=4, col='black')

# just extract length
spine(Cell07PNs[[1]], rval='length')
# same result since StartPoint is included in longest path
spine(Cell07PNs[[1]], rval='length', UseStartPoint=TRUE)

# extract everything but the spine
antispine=spine(Cell07PNs[[1]], invert=TRUE)

plot3d(Cell07PNs[[1]])
plot3d(antispine, lwd=4, col='red')



natverse/nat documentation built on Feb. 19, 2024, 7:19 a.m.