catpy.applications.export module

class catpy.applications.export.ExportWidget(catmaid_client)[source]

Bases: catpy.applications.base.CatmaidClientApplication

Attributes:
base_url
project_id

Methods

fetch(*args, **kwargs) Interact with the CATMAID server in a manner very similar to the javascript CATMAID.fetch API.
from_json(credentials, *args, **kwargs) Return a CatmaidClientApplication instance whose underlying CatmaidClient object is instantiated from the JSON file as per its own from_json method.
get(relative_url[, params, raw]) Get data from a running instance of CATMAID.
get_connector_archive(*args, **kwargs) Not implemented: requires an async job
get_networkx(*skeleton_ids) Get a networkx MultiDiGraph of the given skeletons.
get_networkx_dict(*skeleton_ids) Get the data for a networkx graph of the given skeletons in node-link format.
get_neuroml(skeleton_ids[, skeleton_inputs]) Get NeuroML v1.8.1 (level 3, NetworkML) for the given skeletons, possibly with their input synapses constrained to another set of skeletons.
get_swc(skeleton_id[, linearize_ids]) Get a single skeleton in SWC format.
get_treenode_and_connector_geometry(…) Get the treenode and connector information for the given skeletons.
get_treenode_archive(*args, **kwargs) Not implemented: requires an async job
post(relative_url[, data, raw]) Post data to a running instance of CATMAID.
get_connector_archive(*args, **kwargs)[source]

Not implemented: requires an async job

get_networkx(*skeleton_ids)[source]

Get a networkx MultiDiGraph of the given skeletons.

Parameters:
skeleton_ids : array-like of (int or str)
Returns:
networkx.MultiDiGraph
get_networkx_dict(*skeleton_ids)[source]

Get the data for a networkx graph of the given skeletons in node-link format.

In networkx 1.x, as used by CATMAID and therefore returned by this method, “source” and “target” in the dicts in “links” refer to nodes by their indices in the “nodes” array.

See convert_nodelink_data function to convert into networkx 2.x-compatible format.

https://networkx.readthedocs.io/en/networkx-1.11/reference/generated/networkx.readwrite.json_graph.node_link_data.html

Parameters:
skeleton_ids : array-like of (int or str)
Returns:
dict
get_neuroml(skeleton_ids, skeleton_inputs=())[source]

Get NeuroML v1.8.1 (level 3, NetworkML) for the given skeletons, possibly with their input synapses constrained to another set of skeletons.

N.B. If len(skeleton_ids) > 1, skeleton_inputs will be ignored and only synapses within the first skeleton
set will be used in the model.
Parameters:
skeleton_ids : array-like

Skeletons whose NeuroML to return

skeleton_inputs : array-like, optional

If specified, only input synapses from these skeletons will be added to the NeuroML

Returns:
str

NeuroML output string

get_swc(skeleton_id, linearize_ids=False)[source]

Get a single skeleton in SWC format.

Parameters:
skeleton_id : int or str
linearize_ids : bool
Returns:
str
get_treenode_and_connector_geometry(*skeleton_ids)[source]

Get the treenode and connector information for the given skeletons. The returned dictionary will be of the form

{
“skeletons”: {
skeleton_id1: {
“treenodes”: {
treenode_id1: {
“location”: [x, y, z], “parent_id”: id_of_parent_treenode

}, treenode_id2: …

}, “connectors”: {

connector_id1: {
“location”: [x, y, z], “presynaptic_to”: [list, of, treenode, ids], “postsynaptic_to”: [list, of, treenode, ids]

}, connector_id2: …

}

}, skeleton_id2: …

}

}

Parameters:
skeleton_ids : array-like of (int or str)
Returns:
dict
get_treenode_archive(*args, **kwargs)[source]

Not implemented: requires an async job

NetworkX serialises graphs differently in v1.x and v2.x.

This converts v1-style data (as emitted by CATMAID) to v2-style data.

See issue #26 https://github.com/catmaid/catpy/issues/26

Parameters:
jso : dict
Returns:
dict