R/random_sampling.R
sample_connections.Rd
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)
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 |
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 |
volume | Optional; the name of a neuropil (in the FAFB brain, see |
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 |
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.