genepy3d.io package

Submodules

genepy3d.io.base module

class genepy3d.io.base.CatmaidApiTokenAuth(token)[source]

Bases: AuthBase

Attaches HTTP X-Authorization Token headers to the given Request.

This class is used for Catmaid server authentication.

token

authentication string.

Type

str

genepy3d.io.catmaid module

class genepy3d.io.catmaid.Catmaid(dfneu, dfcon=None)[source]

Bases: object

Support reading neuron data from catmaid.

dfneu

neuron table.

Type

pandas dataframe

dfcon

connector table.

Type

pandas dataframe

classmethod from_csv(neuronfile, confile=None)[source]

Support reading neuron data from catmaid csv files.

Parameters
  • neuronfile (str) – path to neuron csv file.

  • confile (str) – path to connector csv file.

classmethod from_server(host, token, project_id, neuron_id=None)[source]

Support reading neuron data from catmaid server.

Parameters
  • host (str) – catmaid host address.

  • token (str) – authentication token.

  • project_id (int) – project ID.

  • neuron_id (int|list of int) – list of neuron IDs.

get_innervation_relation(nb_innervations=1)[source]

Return neurons filtered by innervation relation.

Innervation: a neuron receives signals from one (mono) or many (multi) other neurons via its presynaptic gates. We assume innervated neuron as postsynaptic neuron, the ones who make innervation are presynaptic neurons.

Parameters

nb_innervations (int) – number innervated presynaptic neurons.

Returns

dictionary whose key is postsynaptic neuron, value is innervating presynaptic neurons.

get_neuron_id(neuron_name=None)[source]

Return neuron IDs from neuron names.

Parameters

neuron_name (str | array of str) – list of neuron names.

Returns

pandas Series whose index is name and value is ID.

static get_neuron_id_from_server(host, token, project_id)[source]

Return list of neuron IDs from given project ID.

Parameters

project_id (int) – project ID.

Returns

array of int.

get_neuron_name(neuron_id=None)[source]

Return neuron names from neuron IDs.

Parameters

neuron_id (int | array of int) – list of neuron names.

Returns

pandas Series whose index is ID and value is name.

get_neurons(neuron_id=None, scales=(1.0, 1.0, 1.0))[source]

Return neuron data of a given list of neuron IDs.

Parameters
  • neuron_id (int | array of int) – list of neuron IDs.

  • scales (tuple (float)) – define x, y, z scales

Returns

list of neurons (tree.Tree)

get_synaptic_relation(relation_id='presynaptic_to', nb_connectors=1)[source]

Return neurons and corresponding treenodes filtered by their synaptic relations.

A neuron can have multiple presynaptic gates (for receiving signals from others neurons), and only one postsynaptic gate (for sending signal).

Parameters
  • relation_id (str) – presynaptic_to or postsynaptic_to.

  • nb_connectors (uint) – number of connectors.

Returns

dictionary whose keys are neuron_id, values are treenode_ids.

to_csv(neuron_name='dfneu.csv', connector_name='dfcon.csv', neuron_id=None)[source]

Export trees into dfneu.csv and dfcon.csv

genepy3d.io.swc module

class genepy3d.io.swc.SWC(filepath, recursive=False)[source]

Bases: object

Support reading neuron data from swc files.

filepath

swc filename or directory containing swc files.

Type

str

recursive

if True, then search recursively all swc files in parent directory.

Type

bool

get_neuron_id()[source]

Return neuron IDs.

Returns

A pandas serie of (name,id).

get_neurons(neuron_id=None)[source]

Return list of neurons identified by IDs.

Returns

A dictionary where key is the neuron ID and value is the Tree instance.

Module contents