Connectomics

How to explore published connectomic data.
!pip install --upgrade vfb_connect
!pip install --upgrade git+git://github.com/schlegelp/navis@master
!pip install --upgrade git+git://github.com/schlegelp/pymaid@master
!pip install --upgrade ipywidgets
!pip install --upgrade jsonpath_rw
!pip install --upgrade seaborn
!pip install --upgrade neuprint-python
!pip install --upgrade flybrains
# Import libs and initialise API objects
from vfb_connect.cross_server_tools import VfbConnect
import pandas as pd
vc = VfbConnect()

import pymaid
import navis

navis.set_pbars(jupyter=False)
pymaid.set_pbars(jupyter=False)

# Connect to the VFB CATMAID server hosting the FAFB data
rm = pymaid.connect_catmaid(server="https://fafb.catmaid.virtualflybrain.org/", api_token=None, max_threads=10)

# Test call to see if connection works 
print(f'Server is running CATMAID version {rm.catmaid_version}')
WARNING: Could not load OpenGL library.
INFO  : Global CATMAID instance set. Caching is ON. (pymaid)
Server is running CATMAID version 2020.02.15-905-g93a969b37

VFB provides a simple methods for exploring connectomics data

get_connected_neurons_by_type allows queries for connections between defined upstream and downstream neuron types/classes. This supports a level of abstraction not available without VFB, where grouping of neurons by higher level classifications is limited to extraction of classification from standardised names. The following examples take advantage of the abstract clasifications on VFB to explore direct synaptic connections.

# Find all GABA-regic inputs onto descending neurons

vc.get_connected_neurons_by_type(upstream_type='GABAergic neuron',
                                 downstream_type='adult descending neuron',
                                 weight=10).sort_values('weight', ascending=False, ignore_index=True)
# Get connections between pacemaker neurons
vc.get_connected_neurons_by_type(upstream_type='pacemaker neuron',
                                 downstream_type='pacemaker neuron',
                                 weight=10).sort_values('weight', ascending=False)

upstream_neuron_id upstream_neuron_name weight downstream_neuron_id downstream_neuron_name upstream_class downstream_class up_data_source up_accession down_source down_accession
28 VFB_jrchjtex DN1a_R - 264083994 79 VFB_jrchjzxy LNd_R - 5813069648 DN1a neuron LNd neuron neuprint_JRC_Hemibrain_1point1 264083994 neuprint_JRC_Hemibrain_1point1 5813069648
26 VFB_jrchjtey DN1a_R - 5813022274 75 VFB_jrchjzxy LNd_R - 5813069648 DN1a neuron LNd neuron neuprint_JRC_Hemibrain_1point1 5813022274 neuprint_JRC_Hemibrain_1point1 5813069648
23 VFB_jrchjtey DN1a_R - 5813022274 63 VFB_jrchk8e0 5th s-LNv - 511051477 DN1a neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 5813022274 neuprint_JRC_Hemibrain_1point1 511051477
22 VFB_jrchjtex DN1a_R - 264083994 55 VFB_jrchk8e0 5th s-LNv - 511051477 DN1a neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 264083994 neuprint_JRC_Hemibrain_1point1 511051477
3 VFB_jrchk089 LPN_R - 480029788 43 VFB_jrchk08a LPN_R - 450034902 LP neuron LP neuron neuprint_JRC_Hemibrain_1point1 480029788 neuprint_JRC_Hemibrain_1point1 450034902
7 VFB_jrchk8e0 5th s-LNv - 511051477 40 VFB_jrchjzxy LNd_R - 5813069648 s-LNv neuron LNd neuron neuprint_JRC_Hemibrain_1point1 511051477 neuprint_JRC_Hemibrain_1point1 5813069648
1 VFB_jrchjzxy LNd_R - 5813069648 37 VFB_jrchk8e0 5th s-LNv - 511051477 LNd neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 511051477
5 VFB_jrchjtf0 DN1pA_R - 324846570 37 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 324846570 neuprint_JRC_Hemibrain_1point1 5813069648
16 VFB_jrchjtf2 DN1pA_R - 387944118 34 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 387944118 neuprint_JRC_Hemibrain_1point1 5813069648
20 VFB_jrchjtf1 DN1pA_R - 325529237 33 VFB_jrchk8e0 5th s-LNv - 511051477 DN1p neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 325529237 neuprint_JRC_Hemibrain_1point1 511051477
29 VFB_jrchjtf3 DN1pA_R - 387166379 30 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 387166379 neuprint_JRC_Hemibrain_1point1 5813069648
11 VFB_jrchjtf1 DN1pA_R - 325529237 30 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 325529237 neuprint_JRC_Hemibrain_1point1 5813069648
21 VFB_jrchk08a LPN_R - 450034902 30 VFB_jrchk089 LPN_R - 480029788 LP neuron LP neuron neuprint_JRC_Hemibrain_1point1 450034902 neuprint_JRC_Hemibrain_1point1 480029788
14 VFB_jrchjzxy LNd_R - 5813069648 29 VFB_jrchjzxw LNd_R - 5813056917 LNd neuron LNd neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 5813056917
10 VFB_jrchk8e0 5th s-LNv - 511051477 25 VFB_jrchjzxx LNd_R - 5813021192 s-LNv neuron LNd neuron neuprint_JRC_Hemibrain_1point1 511051477 neuprint_JRC_Hemibrain_1point1 5813021192
8 VFB_jrchjtf3 DN1pA_R - 387166379 25 VFB_jrchk8e0 5th s-LNv - 511051477 DN1p neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 387166379 neuprint_JRC_Hemibrain_1point1 511051477
4 VFB_jrchjtf0 DN1pA_R - 324846570 25 VFB_jrchk8e0 5th s-LNv - 511051477 DN1p neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 324846570 neuprint_JRC_Hemibrain_1point1 511051477
12 VFB_jrchjtez DN1pA_R - 5813010153 25 VFB_jrchk8e0 5th s-LNv - 511051477 DN1p neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 5813010153 neuprint_JRC_Hemibrain_1point1 511051477
15 VFB_jrchjtf2 DN1pA_R - 387944118 22 VFB_jrchk8e0 5th s-LNv - 511051477 DN1p neuron s-LNv neuron neuprint_JRC_Hemibrain_1point1 387944118 neuprint_JRC_Hemibrain_1point1 511051477
30 VFB_jrchjzxy LNd_R - 5813069648 21 VFB_jrchjzxx LNd_R - 5813021192 LNd neuron LNd neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 5813021192
2 VFB_jrchk8e0 5th s-LNv - 511051477 17 VFB_jrchjzxw LNd_R - 5813056917 s-LNv neuron LNd neuron neuprint_JRC_Hemibrain_1point1 511051477 neuprint_JRC_Hemibrain_1point1 5813056917
13 VFB_jrchjtez DN1pA_R - 5813010153 15 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 5813010153 neuprint_JRC_Hemibrain_1point1 5813069648
24 VFB_jrchk8e0 5th s-LNv - 511051477 14 VFB_jrchjtf3 DN1pA_R - 387166379 s-LNv neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 511051477 neuprint_JRC_Hemibrain_1point1 387166379
25 VFB_jrchjzxy LNd_R - 5813069648 14 VFB_jrchjtf1 DN1pA_R - 325529237 LNd neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 325529237
0 VFB_jrchjtf0 DN1pA_R - 324846570 13 VFB_jrchjzxx LNd_R - 5813021192 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 324846570 neuprint_JRC_Hemibrain_1point1 5813021192
17 VFB_jrchjzxy LNd_R - 5813069648 13 VFB_jrchjtf3 DN1pA_R - 387166379 LNd neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 387166379
9 VFB_jrchk8e0 5th s-LNv - 511051477 12 VFB_jrchjtf1 DN1pA_R - 325529237 s-LNv neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 511051477 neuprint_JRC_Hemibrain_1point1 325529237
19 VFB_jrchjtf5 DN1pB_R - 5813071319 11 VFB_jrchjzxy LNd_R - 5813069648 DN1p neuron LNd neuron neuprint_JRC_Hemibrain_1point1 5813071319 neuprint_JRC_Hemibrain_1point1 5813069648
31 VFB_jrchjtey DN1a_R - 5813022274 11 VFB_jrchjtex DN1a_R - 264083994 DN1a neuron DN1a neuron neuprint_JRC_Hemibrain_1point1 5813022274 neuprint_JRC_Hemibrain_1point1 264083994
18 VFB_jrchjzxy LNd_R - 5813069648 10 VFB_jrchjtez DN1pA_R - 5813010153 LNd neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 5813010153
27 VFB_jrchjtex DN1a_R - 264083994 10 VFB_jrchjtey DN1a_R - 5813022274 DN1a neuron DN1a neuron neuprint_JRC_Hemibrain_1point1 264083994 neuprint_JRC_Hemibrain_1point1 5813022274
6 VFB_jrchjzxy LNd_R - 5813069648 10 VFB_jrchjtf2 DN1pA_R - 387944118 LNd neuron DN1p neuron neuprint_JRC_Hemibrain_1point1 5813069648 neuprint_JRC_Hemibrain_1point1 387944118
# Get connections between visual projection neurons and descending neurons
vc.get_connected_neurons_by_type(upstream_type='visual projection neuron',
                                 downstream_type='adult descending neuron',
                                 weight=10).sort_values('weight', ascending=False)

upstream_neuron_id upstream_neuron_name weight downstream_neuron_id downstream_neuron_name upstream_class downstream_class up_data_source up_accession down_source down_accession
966 VFB_jrchk09j LT51(aSP29a)_R - 1282348408 319 VFB_jrchjtfr DNb01_R - 1566597156 lobula tangential neuron descending neuron of the anterior ventral brai... neuprint_JRC_Hemibrain_1point1 1282348408 neuprint_JRC_Hemibrain_1point1 1566597156
682 VFB_jrchk09c LT51_R - 1444351896 221 VFB_jrchjtfg DNa03_R - 1139909038 lobula tangential neuron descending neuron of the anterior dorsal brain... neuprint_JRC_Hemibrain_1point1 1444351896 neuprint_JRC_Hemibrain_1point1 1139909038
559 VFB_jrchk09j LT51(aSP29a)_R - 1282348408 169 VFB_jrchjthb DNp18_R - 5813068840 lobula tangential neuron descending neuron of the posterior brain DNp18 neuprint_JRC_Hemibrain_1point1 1282348408 neuprint_JRC_Hemibrain_1point1 5813068840
744 VFB_jrchk09i LT51_R - 1597493900 141 VFB_jrchjtfg DNa03_R - 1139909038 lobula tangential neuron descending neuron of the anterior dorsal brain... neuprint_JRC_Hemibrain_1point1 1597493900 neuprint_JRC_Hemibrain_1point1 1139909038
961 VFB_jrchk09l LT51(aSP29a)_R - 1261229600 104 VFB_jrchjtfr DNb01_R - 1566597156 lobula tangential neuron descending neuron of the anterior ventral brai... neuprint_JRC_Hemibrain_1point1 1261229600 neuprint_JRC_Hemibrain_1point1 1566597156
... ... ... ... ... ... ... ... ... ... ... ...
284 VFB_jrchjy92 LC4 - 5901215446 10 VFB_jrchjtg8 DNp05_R - 1466998977 lobula columnar neuron LC4 descending neuron of the posterior brain DNp05 neuprint_JRC_Hemibrain_1point1 5901215446 neuprint_JRC_Hemibrain_1point1 1466998977
710 VFB_jrchjznt LLPC1 - 5812996978 10 VFB_jrchjthl DNp26_R - 1100404634 lobula complex columnar neuron descending neuron of the posterior brain DNp26 neuprint_JRC_Hemibrain_1point1 5812996978 neuprint_JRC_Hemibrain_1point1 1100404634
713 VFB_jrchjzx3 LLPC3 - 1873811611 10 VFB_jrchjthl DNp26_R - 1100404634 lobula complex columnar neuron descending neuron of the posterior brain DNp26 neuprint_JRC_Hemibrain_1point1 1873811611 neuprint_JRC_Hemibrain_1point1 1100404634
953 VFB_jrchjzrz LLPC2c - 5812997067 10 VFB_jrchjtfh DNa04_R - 1262014782 lobula complex columnar neuron descending neuron of the anterior dorsal brain... neuprint_JRC_Hemibrain_1point1 5812997067 neuprint_JRC_Hemibrain_1point1 1262014782
0 VFB_jrchk04n LPLC2_R - 5812987894 10 VFB_jrchjtg7 DNp04_R - 1405231475 lobula complex columnar neuron LPLC2 descending neuron of the posterior brain DNp04 neuprint_JRC_Hemibrain_1point1 5812987894 neuprint_JRC_Hemibrain_1point1 1405231475

1085 rows × 11 columns

Get neurons downstream/downstream of a specific neuron

Starting from an individual neuron, in this case an individual neuron from hemibrain, find all neurons upstream or downstream, restricting to edges >= some specified wieght (synaptic connections) and optionally limiting the output by neuron type/class.

# Starting point - let's take one of the individual descending neurons from
# the previous exploratory queries and look for other inputs

vc.get_neurons_upstream_of('DNp04_R - 1405231475', weight = 20)

query_neuron_id query_neuron_name weight target_neuron_id target_neuron_name
0 VFB_jrchk4u3 PVLP100_R - 1375845363 44 VFB_jrchjtg7 DNp04_R - 1405231475
1 VFB_jrchjy8u LC4 - 1158864995 50 VFB_jrchjtg7 DNp04_R - 1405231475
2 VFB_jrchjy9f LC4 - 5813055129 46 VFB_jrchjtg7 DNp04_R - 1405231475
3 VFB_jrchjyal LC4 - 1907571222 78 VFB_jrchjtg7 DNp04_R - 1405231475
4 VFB_jrchjy9t LC4 - 2215161310 86 VFB_jrchjtg7 DNp04_R - 1405231475
... ... ... ... ... ...
82 VFB_jrchjyak LC4 - 1907933561 82 VFB_jrchjtg7 DNp04_R - 1405231475
83 VFB_jrchjy9d LC4 - 1627117134 46 VFB_jrchjtg7 DNp04_R - 1405231475
84 VFB_jrchjya7 LC4 - 1876471221 58 VFB_jrchjtg7 DNp04_R - 1405231475
85 VFB_jrchk4tm PVLP094_R - 1503733177 26 VFB_jrchjtg7 DNp04_R - 1405231475
86 VFB_jrchjya0 LC4 - 5812998136 92 VFB_jrchjtg7 DNp04_R - 1405231475

87 rows × 5 columns

Let’s try a similar query from one of the LC4 neurons to see what other descending neuron types are downstream of it.

vc.get_neurons_downstream_of('LC4 - 1249932198', classification="'adult descending neuron'", weight = 20)
Running query: FBbt:00047511
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00047511&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 139

query_neuron_id query_neuron_name weight target_neuron_id target_neuron_name
0 VFB_jrchjy8y LC4 - 1249932198 78 VFB_jrchjtg7 DNp04_R - 1405231475
1 VFB_jrchjy8y LC4 - 1249932198 30 VFB_jrchjup1 Giant Fiber_R - 2307027729
2 VFB_jrchjy8y LC4 - 1249932198 65 VFB_jrchjtgf DNp11_R - 1281324958

More sophisticated connectomics queries require direct queries of connectomics DB APIs

CATMAID connectivity queries

Broadly speaking, using pymaid to query CATMAID servers lets you fetch connectivity data as either lists of up- and downstream partners or as whole adjacency matrices.

These examples use the VFB FAFB server.

# Using VFB to get neurons by type
DA1 = vc.get_instances("'adult antennal lobe projection neuron DA1'", summary=True)
DA1_tab = pd.DataFrame.from_records(DA1)
len(DA1_tab)
DA1_tab
Running query: FBbt:00048096
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00048096&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 31

label symbol id tags parents_label parents_id data_source accession templates dataset license
0 Uniglomerular mALT DA1 lPN#L3 (FAFB:2345089) VFB_0010122p Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2345089 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
1 ALv1_P02(DA1)_0_2018U VFB_00102763 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 Yu2013 https://creativecommons.org/licenses/by-nc-sa/...
2 Uniglomerular mALT DA1 lPN#R3 (FAFB:61221) VFB_00101204 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 61221 adult brain template JFRC2|JRC2018Unisex Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
3 Uniglomerular mALT DA1 lPN#L1 (FAFB:4207871) VFB_0010126e Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 4207871 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
4 ALv1_P02(DA1)_0_2018U VFB_00103943 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 Yu2013 https://creativecommons.org/licenses/by-nc-sa/...
5 Uniglomerular mALT DA1 lPN#R1 (FAFB:57323) VFB_00101201 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 57323 JRC2018Unisex|adult brain template JFRC2 Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
6 DA1_lPN_R - 1734350908 VFB_jrchjtdb Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 1734350908 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
7 Uniglomerular mALT DA1 lPN#R5 (FAFB:2863104) VFB_0010124e Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2863104 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
8 Uniglomerular mALT DA1 lPN#R7 (FAFB:57353) VFB_00101202 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 57353 JRC2018Unisex|adult brain template JFRC2 Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
9 ALv1_P02(DA1)_0_2018U VFB_00102297 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 JRC2018Unisex Lee2020 https://creativecommons.org/licenses/by/4.0/le...
10 ALv1_P02(DA1)_0_2018U VFB_00104629 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 JRC2018Unisex Yu2013 https://creativecommons.org/licenses/by-nc-sa/...
11 ALv1_P02(DA1)_0_2018U VFB_00102294 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 Yu2013 https://creativecommons.org/licenses/by-nc-sa/...
12 Uniglomerular mlALT DA1 vPN#R1 (FAFB:1811442) VFB_0010121x Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 catmaid_fafb 1811442 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
13 Uniglomerular mlALT DA1 vPN#L1 (FAFB:2334841) VFB_0010122m Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 catmaid_fafb 2334841 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
14 Uniglomerular mALT DA1 lPN#L5 (FAFB:2380564) VFB_0010122z Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2380564 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
15 DA1_lPN_R - 754538881 VFB_jrchjtdg Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 754538881 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
16 Uniglomerular mALT DA1 lPN#R6 (FAFB:27295) VFB_00101199 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 27295 JRC2018Unisex|adult brain template JFRC2 Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
17 Uniglomerular mALT DA1 lPN#R8 (FAFB:57381) VFB_00101203 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 57381 adult brain template JFRC2|JRC2018Unisex Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
18 DA1_lPN_R - 1765040289 VFB_jrchjtdc Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 1765040289 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
19 Uniglomerular mALT DA1 lPN#R2 (FAFB:57311) VFB_00101200 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 57311 adult brain template JFRC2|JRC2018Unisex Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
20 DA1_lPN_R - 5813039315 VFB_jrchjtdd Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 5813039315 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
21 Uniglomerular mALT DA1 lPN#L6 (FAFB:2381753) VFB_0010123b Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2381753 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
22 DA1_lPN_R - 754534424 VFB_jrchjtde Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 754534424 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
23 DA1_lPN_R - 1734350788 VFB_jrchjtdf Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 1734350788 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
24 ALv1_P02(DA1)_0_2018U VFB_00104624 Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 Yu2013 https://creativecommons.org/licenses/by-nc-sa/...
25 Uniglomerular mALT DA1 lPN#L2 (FAFB:2319457) VFB_0010122k Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2319457 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
26 Uniglomerular mALT DA1 lPN#R4 (FAFB:755022) VFB_00101205 Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 755022 adult brain template JFRC2|JRC2018Unisex Zheng2018 https://creativecommons.org/licenses/by-sa/4.0...
27 Uniglomerular mALT DA1 lPN#L7 (FAFB:3239781) VFB_0010124l Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 3239781 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
28 Uniglomerular mALT DA1 lPN#L4 (FAFB:2379517) VFB_0010122y Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 catmaid_fafb 2379517 JRC2018Unisex BatesSchlegel2020 https://creativecommons.org/licenses/by-sa/4.0...
29 DA1_vPN_R - 733316908 VFB_jrchjtdh Entity|GABAergic|Adult|Anatomy|has_image|Cell|... adult antennal lobe projection neuron DA1 vPN FBbt_00067372 neuprint_JRC_Hemibrain_1point1 733316908 JRC_FlyEM_Hemibrain|JRC2018Unisex Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
30 DA1_lPN_R - 722817260 VFB_jrchjtda Entity|has_image|Adult|Anatomy|has_neuron_conn... adult antennal lobe projection neuron DA1 lPN FBbt_00067363 neuprint_JRC_Hemibrain_1point1 722817260 JRC2018Unisex|JRC_FlyEM_Hemibrain Xu2020NeuronsV1point1 https://creativecommons.org/licenses/by/4.0/le...
# Map neurons to CATMAID Skeleton IDs (skids)

da1_skids = vc.neo_query_wrapper.vfb_id_2_xrefs(DA1_tab['id'], db='catmaid_fafb', reverse_return=True)
da1_skids
{'2863104': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010124e'}],
 '57353': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101202'}],
 '2381753': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010123b'}],
 '1811442': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010121x'}],
 '57323': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101201'}],
 '57311': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101200'}],
 '2345089': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010122p'}],
 '27295': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101199'}],
 '2379517': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010122y'}],
 '2380564': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010122z'}],
 '755022': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101205'}],
 '61221': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101204'}],
 '57381': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_00101203'}],
 '3239781': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010124l'}],
 '4207871': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010126e'}],
 '2334841': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010122m'}],
 '2319457': [{'db': 'catmaid_fafb', 'vfb_id': 'VFB_0010122k'}]}
# Map neurons to CATMAID Skeleton IDs (skids)

da1_skids = vc.neo_query_wrapper.vfb_id_2_xrefs(DA1_tab['id'], db='catmaid_fafb', reverse_return=True)
da1_skids_int = list(map(int, da1_skids))
da1_skids_int
[2863104,
 57353,
 2381753,
 1811442,
 57323,
 57311,
 2345089,
 27295,
 2379517,
 2380564,
 755022,
 61221,
 57381,
 3239781,
 4207871,
 2334841,
 2319457]

Generate a connectivity table for neurons downstream of DA1 neurons

da1 = pymaid.get_neurons(da1_skids_int)
da1_ds = pymaid.get_partners(da1_skids_int,
                             threshold=3,  # anything with >= 3 synapses
                             directions=['outgoing']  # downstream partners only
                            )

# Result is a pandas DataFrame
da1_ds.head()
INFO  : Fetching connectivity table for 17 neurons (pymaid)
INFO  : Done. Found 0 pre-, 270 postsynaptic and 0 gap junction-connected neurons (pymaid)

neuron_name skeleton_id num_nodes relation 2863104 57353 2381753 1811442 57323 57311 ... 2379517 2380564 755022 61221 57381 3239781 4207871 2334841 2319457 total
0 Uniglomerular mlALT DA1 vPN mlALTed Milk 18114... 1811442 11769 downstream 30 3 0 0 20 21 ... 0 0 32 26 4 0 0 0 0 151.0
1 Uniglomerular mlALT DA1 vPN mlALTed Milk 23348... 2334841 6362 downstream 0 0 32 0 0 0 ... 28 0 0 0 0 26 17 0 22 139.0
2 LHAV4a4#1 1911125 FML PS RJVR 1911124 6969 downstream 23 6 0 0 15 19 ... 0 0 19 13 9 0 0 0 0 109.0
3 LHAV2a3#1 1870231 RJVR AJES PS 1870230 14820 downstream 5 23 0 1 7 5 ... 0 0 19 7 28 0 0 0 0 105.0
4 LHAV4c1#1 488056 downstream DA1 GSXEJ 488055 12137 downstream 15 3 0 0 11 17 ... 0 0 15 15 0 0 0 0 0 92.0

5 rows × 22 columns

# Get an adjacency matrix between all Bates, Schlegel et al. neurons
bates = pymaid.find_neurons(annotations='Paper: Bates and Schlegel et al 2020')
adj = pymaid.adjacency_matrix(bates)
adj.head()
INFO  : Found 583 neurons matching the search parameters (pymaid)

targets 2863104 57349 57353 16 57361 15738898 57365 4182038 3813399 11524119 ... 57323 4624362 1853423 2842610 57333 4624374 3080183 57337 4624378 57341
sources
2863104 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 2.0 0.0 12.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
57349 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
57353 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 5.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
16 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
57361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

5 rows × 583 columns

import seaborn as sns 

ax = sns.clustermap(adj, vmax=10, cmap='Greys')
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/matrix.py:649: UserWarning:

Clustering large matrix with scipy. Installing `fastcluster` may give better performance.

png

# Axo-axonic connections between two different types of DA1 PNs
cn = pymaid.get_connectors_between(2863104, 1811442)
cn.head()

connector_id connector_loc node1_id source_neuron confidence1 creator1 node1_loc node2_id target_neuron confidence2 creator2 node2_loc
0 6736296 [359448.44, 159319.03, 150560.0] 3163408 2863104 5 NaN [359487.3, 159145.66, 150600.0] 6736298 1811442 5 NaN [359611.9, 159541.48, 150560.0]
1 6795172 [356041.88, 149555.53, 147920.0] 6795195 2863104 5 NaN [354724.44, 149284.1, 147920.0] 6795153 1811442 5 NaN [356366.16, 149854.86, 147920.0]
2 6795291 [355189.5, 150232.48, 148240.0] 6795293 2863104 5 NaN [354595.62, 149464.8, 148240.0] 6795214 1811442 5 NaN [355472.28, 150294.75, 148160.0]
3 6795747 [355030.4, 154047.86, 145800.0] 6795749 2863104 5 NaN [355045.38, 154180.1, 145800.0] 6795745 1811442 5 NaN [355024.44, 153945.73, 145760.0]
4 6797452 [353221.4, 148570.9, 147320.0] 6797456 2863104 5 NaN [354213.9, 148397.44, 147320.0] 6797437 1811442 5 NaN [353447.6, 148704.88, 147560.0]
import numpy as np 

points = np.vstack(cn.connector_loc)

navis.plot3d([da1.idx[[1811442, 57353]],  # plot the two neurons
              points],  # plot the points of synaptic contacts as scatter 
              scatter_kws=dict(name="synaptic contacts")
              )
#neu_da1 = neu.fetch_skeletons(neu.NeuronCriteria(type='DA1_lPN.*', regex=True))
neu_da1

type name id n_nodes n_connectors n_branches n_leafs cable_length soma units
0 navis.TreeNeuron DA1_lPN_R 722817260 4336 3132 635 658 274910.568784 NaN 8 nanometer
1 navis.TreeNeuron DA1_lPN_R 754538881 4890 2943 626 642 291434.992623 860.0 8 nanometer
... ... ... ... ... ... ... ... ... ... ...
5 navis.TreeNeuron DA1_lPN_R 1765040289 5380 3099 624 642 324249.403013 2467.0 8 nanometer
6 navis.TreeNeuron DA1_lPN_R 5813039315 4300 2954 625 643 273403.049029 NaN 8 nanometer
split = navis.split_axon_dendrite(neu_da1[0])
split

type name id n_nodes n_connectors n_branches n_leafs cable_length soma units compartment
0 navis.TreeNeuron DA1_lPN_R 722817260 0 0 0 0 0.000000 None 8 nanometer cellbodyfiber
1 navis.TreeNeuron DA1_lPN_R 722817260 3575 2505 566 590 188806.744034 None 8 nanometer dendrite
2 navis.TreeNeuron DA1_lPN_R 722817260 193 14 0 1 30601.319501 None 8 nanometer linker
3 navis.TreeNeuron DA1_lPN_R 722817260 474 612 60 61 48872.448763 None 8 nanometer axon
navis.plot3d(split, connectors=True)
WARNING : Skipping empty neuron: DA1_lPN_R (722817260) (navis)