pymaid.get_neuron

pymaid.get_neuron(x, with_connectors=True, with_tags=True, with_history=False, with_merge_history=False, with_abutting=False, return_df=False, fetch_kwargs={}, init_kwargs={}, raise_missing=True, remote_instance=None)[source]

Retrieve 3D skeleton data as CatmaidNeuron/List.

Parameters
  • x

    Can be either:

    1. list of skeleton ID(s), int or str

    2. list of neuron name(s), str, exact match

    3. an annotation: e.g. ‘annotation:PN right’

    4. CatmaidNeuron or CatmaidNeuronList object

  • with_connectors (bool, optional) – If True, will include connector data. Note: the CATMAID API endpoint does currently not support retrieving abutting connectors this way. Please use with_abutting=True to include abutting connectors.

  • with_tags (bool, optional) – If True, will include node tags.

  • with_history (bool, optional) –

    If True, the returned node data will contain creation date and last modified for each node.

    ATTENTION: if with_history=True, nodes/connectors that have been moved since their creation will have multiple entries reflecting their changes in position! Each state has the date it was modified as creation date and the next state’s date as last modified. The most up to date state has the original creation date as last modified. The creator_id is always the original creator though.

  • with_abutting (bool, optional) – If True, will retrieve abutting connectors. For some reason they are not part of compact-json, so they have to be retrieved via a separate API endpoint -> will show up as connector type 3!

  • return_df (bool, optional) – If True, a pandas.DataFrame instead of CatmaidNeuron/CatmaidNeuronList is returned.

  • fetch_kwargs (dict, optional) – Above BOOLEAN parameters can also be passed as dict. This is then used in CatmaidNeuron objects to override implicitly set parameters!

  • init_kwargs (dict, optional) – Keyword arguments passed when initializing CatmaidNeuron/CatmaidNeuronList.

  • raise_missing (bool, optional) – If True and any of the queried neurons can not be found, raise an exception. Else just log a warning.

  • remote_instance (CatmaidInstance, optional) – If not passed directly, will try using global.

Returns

Notes

The returned objects contain for each neuron:

neuron_name :           str
skeleton_id :           str
nodes / connectors :    pandas.DataFrames containing node/connector
                        ID, coordinates, parent nodes, etc.
tags :                  dict containing the node tags:
                        ``{'tag': [node_id, node_id, ...]}``

Dataframe column titles for nodes and connectors should be self-explanatory with the exception of relation in connector table. This columns describes the connection (“relation”) from the neuron’s node TO the connector:

connectors['relation']

            0 = "presynaptic_to" -> this is a presynapse for this neuron
            1 = "postsynaptic_to" -> this is a postsynapse for this neuron
            2 = "gapjunction_with"
            3 = "abutting" (not returned by default)
            -1 = other (hypothetical as CATMAID does only return the above)

Examples

>>> # Get a single neuron by skeleton id
>>> n = pymaid.get_neuron(16)
>>> # Get a bunch of neurons by annotation
>>> n = pymaid.get_neuron('annotation:glomerulus DA1')