ngraph: ngraph: a graph to encode a neuron's connectivity

Description Usage Arguments Details Value Connectivity Morphology See Also Examples

View source: R/ngraph.R

Description

the ngraph class contains a (completely general) graph representation of a neuron's connectivity in an igraph object. It may additionally contain vertex label or position data. See details.

ngraph() creates an ngraph from edge and vertex information.

as.ngraph converts an object to an ngraph

as.ngraph.dataframe construct ngraph from a data.frame containing SWC format data

as.ngraph.neuron construct ngraph from a neuron

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
ngraph(
  el,
  vertexlabels,
  xyz = NULL,
  diam = NULL,
  directed = TRUE,
  weights = FALSE,
  vertex.attributes = NULL,
  graph.attributes = NULL
)

as.ngraph(x, ...)

## S3 method for class 'data.frame'
as.ngraph(x, directed = TRUE, ...)

## S3 method for class 'neuron'
as.ngraph(x, directed = TRUE, method = c("swc", "seglist"), ...)

Arguments

el

A two columm matrix (start, end) defining edges. start means closer to the root (soma) of the neuron.

vertexlabels

Integer labels for graph - the edge list is specified using these labels.

xyz

3D coordinates of vertices (optional, Nx3 matrix, or Nx4 matrix when 4th column is assumed to be diameter)

diam

Diameter of neuron at each vertex (optional)

directed

Whether the resultant graph should be directed (default TRUE)

weights

Logical value indicating whether edge weights defined by the 3D distance between points should be added to graph (default FALSE) or a numeric vector of weights.

vertex.attributes, graph.attributes

List of named attributes to be added to the graph. The elements of vertex.attributes must be vectors whose length is compatible with the number of elements in the graph. See set.vertex.attribute for details.

x

Object to convert (see method descriptions)

...

Arguments passed to methods

method

Whether to use the swc data (x$d) or the seglist to define neuronal connectivity to generate graph.

Details

Note that the as.ngraph.neuron method always keeps the original vertex labels (a.k.a. PointNo) as read in from the original file.

Value

an igraph object with additional class ngraph, having a vertex for each entry in vertexlabels, each vertex having a label attribute. All vertices are included whether connected or not.

Connectivity

We make the following assumptions about neurons coming in

We make no attempt to determine the root points at this stage.

The raw vertex ids in the graph will be in the order of vertexlabels and can therefore be used to index a block of vertex coordinates. The vertexlabels will be stored using the vertex attribute label

When the graph is directed (default) the edges will be from the root to the other tips of the neuron.

Morphology

The morphology of the neuron is encoded by the combination of connectivity information (i.e. the graph) and spatial data encoded as the 3D position and diameter of each vertex. Position information is stored as vertex attributes X, Y, and Z.

See Also

igraph, set.vertex.attribute, subset.neuron for example of graph-based manipulation of a neuron.

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

Examples

1
2
3
4
g=as.ngraph(Cell07PNs[[1]])
library(igraph)
# check that vertex attributes of graph match X position
all.equal(V(g)$X, Cell07PNs[[1]]$d$X)

nat documentation built on Sept. 6, 2021, 5:09 p.m.