Assemble a data frame/csv for random sampling of a neuron's synapses or connections. The units sampled can be outgoing connections ("downstream), incoming connections ("upstream"), or outgoing synapses (connectors in CATMAID). Optionally, the sample can be limited to a certain number of connections or synapses, or constrained to the section of a neuron either within a neuropil or up-/downstream of a particular node.

sample_connections(neuron, number = NULL, type = c("downstream",
  "upstream", "connector"), fileout = NULL, node.id = NULL,
  node.direction = c("downstream", "upstream"), volume = NULL,
  plot = FALSE)

Arguments

neuron

Required; a CATMAID neuron object.

number

Optional; the number of units (connections or synapses) to return. Will return all if not specified.

type

The type of unit to sample. Options are "downstream" (samples outgoing connections), "upstream" (samples incoming connections), and "connector" (samples outgoing synapses). Defaults to "downstream".

fileout

Optional; the path to a CSV file where the result should be written.

node.id

Optional; the id of a treenode where the neuron should be cut, if limiting sample to up-/downstream portion of the neuron.

node.direction

If node.id is specfied, the section of cut neuron to retain. Options are "downstream" (i.e. distal to the cut point) or "upstream" (proximal to the cut point). Defaults to "downstream".

volume

Optional; the name of a neuropil (in the FAFB brain, see FAFBNP.surf) that the sample should be constrained to.

plot

Optional; whether or not to generate a 3D plot of the neuron highlighting the portion retained and which connectors are included in the sample. Defaults to FALSE.

Value

A data frame containing the randomised connections or synapses, with a column of URLs to the items in CATMAID. Additional columns in the data frame will vary by type, but will include further information about the units sampled (e.g. CATMAID IDs, coordinates, etc.). If fileout is specified, this data frame will also be written to a CSV.