Extract a single data frame describing synapse/connection types, partners, locations and position on a neuron's axon/dendrite. You can either get all synapses returned or all unitary connections to a neuron's partners returned. Broken down by axon/dendrite (Label), and pre/postsynapses or pre/postsynaptic partners. Note that hemibrain_extract_compartment_edgelist will only return connections between neurons given in the argument x.

hemibrain_extract_synapses(x, prepost = c("BOTH", "PRE", "POST"), ...)

hemibrain_extract_connections(
  x,
  prepost = c("BOTH", "PRE", "POST"),
  meta = NULL,
  ...
)

hemibrain_extract_compartment_edgelist(x, meta = NULL, ...)

Arguments

x

a nat::neuronlist or nat::neuron object. It is assumed that this neuron has been read in by neuprintr::neuprint_read_neurons or possibly catmaid::read.neurons.catmaid.

prepost

whether to get presynapses, postsynapses or both

...

Additional arguments passed to methods or eventually to nat::nlapply

meta

a data frame giving neuron metrics (i.e. as generated by hemibrain_compartment_metrics) and transmitter predictions (column top_nt) for the neurons supplied to these functions.

Value

a data.frame. Depending on which synapse function was called, it can contain the columns:

  • "treenode_id" - the position of the node in the SWC-style table found at neuron$d, where the neuron is the skeleton for bodyid.

  • "connector_id" - the unique ID for a pre/post synapse, as read from neuPrint. If this is not given, you are looking at a connection not a synapse. In this case count should be given, which shows the number of synapses in this connection.

  • "prepost" - whether the given synapse is a pre-synapse (0, output synapse) or postsynapse (1, input synapse). Alternatively, if a connection is given, whether this connection is presynaptic to bodyid (0, bodyid is target) or postsynaptic (1, bodyid is source).

  • "x" - x coordinate for the root point.

  • "y" - y coordinate for the root point.

  • "z" - z coordinate for the root point.

  • "confidence" - FlyEM's confidence level. The lower the score, the more likely this synapse is an artefact.

  • "bodyid" - The neuPrint neuron/body related to the synapse/connection given in each row.

  • "partner" - The neuron connecting to bodyid by the given synapse/connection.

  • "pre" - The body ID for the presynaptic (source) neuron.

  • "partner" - The body ID for the presynaptic (target) neuron.

  • "Label" - The compartment of the bodyid neuron on which the synapse is placed / which receives/makes the given connection. See ?standardise.

  • "partner_Label" - The compartment of the partner neuron on which the synapse is placed / which receives/makes the given connection.

  • "count" - The number of synapses that make the given connection. Sometimes referred to as 'weight'.

  • "norm" - The normalised synapse weight. count is divided by the total number of inputs that the target neuron's (post) compartment (Label) has. I.e. this normalisation is by total_inputs onto a dendrite or axon, not the whole neuron.

  • "connection" - The type of compartment-compartment connection specified by this row. The first compartment is the source (pre), the second, the target (post).

See also

Examples

if (FALSE) { # Choose bodyids some.pns = sample(pn.ids, 20) # Read in these neurons neurons = neuprintr::neuprint_read_neurons(some.pns) # Re-root neurons.flow = flow_centrality(neurons, polypre = TRUE, mode = "centrifugal", split = "distance") # Let's check that this worked syns = hemibrain_extract_synapses(neurons.flow) # Get the edgelist by compartment elist = hemibrain_extract_compartment_edgelist(neurons.flow) # See result library(nat) plot3d_split(neuron.flow) points3d(xyzmatrix(subset(syns,prepost==1)), col = "cyan") points3d(xyzmatrix(subset(syns,prepost==0)), col = "red") }