fafbseg.synapses.get_neuron_synapses

fafbseg.synapses.get_neuron_synapses(x, pre=True, post=True, collapse_connectors=False, score_thresh=30, ol_thresh=2, dist_thresh=1000, attach=True, drop_autapses=True, drop_duplicates=True, db=None, verbose=True, ret='catmaid', progress=True)[source]

Fetch synapses for a given neuron.

Works by:
  1. Fetch segment IDs corresponding to a neuron

  2. Fetch Buhmann et al. synapses associated with these segment IDs

  3. Do some clean-up. See parameters for details.

Notes

  1. If collapse_connectors=False the connector_id column is a simple enumeration and is effectively meaningless.

  2. The x/y/z coordinates always correspond to the presynaptic site (like with CATMAID connectors). These columns are renamed from “pre_{x|y|z}” in the database.

  3. Some of the clean-up assumes that the query neurons are unique neurons and not fragments of the same neuron. If that is the case, you might be better of running this function for each fragment individually.

Parameters
  • x (navis.Neuron | pymaid.CatmaidNeuron | NeuronList) – Neurons to fetch synapses for.

  • pre/post (bool) – Whether to fetch pre- and/or postsynapses.

  • collapse_connectors (bool) – If True, we will pool presynaptic connections into CATMAID-like connectors. If False each row represents a connections.

  • ol_thresh (int, optional) – If provided, will required a minimum node overlap between a neuron and a segment for that segment to be included (see step 1 above).

  • score_thresh (int, optional) – If provided will only return synapses with a cleft score of this or higher.

  • dist_thresh (int) – Synapses further away than the given distance [nm] from any node in the neuron than given distance will be discarded. This is always with respect to the cleft site irrespective of whether our neuron is pre- or postsynaptic to it.

  • attach (bool) – If True, will attach synapses as .connectors to neurons. If False, will return DataFrame with synapses.

  • drop_autapses (bool) – If True, will drop synapses where pre- and postsynapse point to the same neuron. Autapses are wrong in 99.9% of all cases we’ve seen.

  • drop_duplicates (bool) – If True, will merge synapses which connect the same pair of pre-post segmentation IDs and are within less than 2500nm.

  • db (str, optional) – Must point to SQL database containing the synapse data. If not provided will look for a BUHMANN_SYNAPSE_DB environment variable.

  • ret ("catmaid" | "brief" | "full") – If “full” will return all synapse properties. If “brief” will return more relevant subset. If “catmaid” will return only CATMAID-like columns.

  • progress (bool) – Whether to show progress bars or not.

Returns

Only if attach=False.

Return type

pd.DataFrame