Connectomics

[1]:
# Install all used libraries
!pip install -r ../../../requirements.txt --quiet
!pip install ../../../ --quiet

[2]:
# Import libs and initialise API objects
from vfb_connect import vfb
import pandas as pd

import pymaid
import navis

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

# Connect to VFB's 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}')

Welcome to the Virtual Fly Brain API
See the documentation at: https://virtualflybrain.org/docs/tutorials/apis/

Establishing connections to https://VirtualFlyBrain.org services...
Session Established!

Type vfb. and press tab to see available queries. You can run help against any query e.g. help(vfb.get_TermInfo)
INFO  : Global CATMAID instance set. Caching is ON. (pymaid)
Server is running CATMAID version 2020.02.15-102-gce1dee4

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.

[3]:
vfb.get_terms_by_xref(['Trh-F-500041'], db='FlyCircuit')
[3]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 Trh-F-500041 VFB_00014110 [Entity, Adult, Anatomy, Cell, Expression_patt... OutAge: Adult 5~15 days [adult neuron, expression pattern fragment] [FBbt_00047095, VFBext_0000004] [FlyCircuit] [Trh-F-500041] [FlyCircuit:Trh-F-500041] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
[4]:
neurons_in_DA3 = vfb.get_instances("'neuron' that 'overlaps' some 'antennal lobe glomerulus DA3'")
neurons_in_DA3
[4]:
label symbol id tags parents_label parents_id data_source accession xrefs templates dataset license description
0 Uniglomerular mALT DA3 adPN#R2 (FAFB:65465) VFB_00101240 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [catmaid_fafb] [65465] [catmaid_fafb:65465] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4.... NaN
1 Uniglomerular mALT DA3 adPN#R1 (FAFB:57349) VFB_00101239 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [catmaid_fafb] [57349] [catmaid_fafb:57349] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4.... NaN
2 Uniglomerular mALT DA3 adPN#L2 (FAFB:2350853) VFB_0010122u [Entity, Adult, Anatomy, Cell, Chemosensory_sy... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [catmaid_fafb] [2350853] [catmaid_fafb:2350853] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4.... NaN
3 Uniglomerular mALT DA3 adPN#L1 (FAFB:2449792) VFB_0010123h [Entity, Adult, Anatomy, Cell, Chemosensory_sy... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [catmaid_fafb] [2449792] [catmaid_fafb:2449792] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4.... NaN
4 ORN_DA3_R (FlyEM-HB:1703683060) ORN_DA3_R VFB_jrchk183 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [neuprint_JRC_Hemibrain_1point1] [1703683060] [neuronbridge:1703683060, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Orphan, cropped-None
... ... ... ... ... ... ... ... ... ... ... ... ... ...
153 lLN2T_a(Tortuous)_R (FlyEM-HB:5813055277) lLN2T_a(Tortuous)_R VFB_jrchk8bf [Entity, Adult, Anatomy, Cell, Individual, Ner... [adult antennal lobe local neuron lLN2T, adult... [FBbt_00049816, FBbt_00049526] [neuprint_JRC_Hemibrain_1point1] [5813055277] [neuprint_JRC_Hemibrain_1point1:5813055277, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
154 lLN2T_c(Tortuous)_R (FlyEM-HB:1671292719) lLN2T_c(Tortuous)_R VFB_jrchk8bo [Entity, Adult, Anatomy, Cell, Individual, Ner... [adult antennal lobe local neuron lLN2T] [FBbt_00049816] [neuprint_JRC_Hemibrain_1point1] [1671292719] [neuronbridge:1671292719, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
155 lLN2T_b(Tortuous)_R (FlyEM-HB:5813034493) lLN2T_b(Tortuous)_R VFB_jrchk8bm [Entity, Adult, Anatomy, Cell, Individual, Ner... [adult serotonergic neuron, adult antennal lob... [FBbt_00049526, FBbt_00049816] [neuprint_JRC_Hemibrain_1point1] [5813034493] [neuronbridge:5813034493, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
156 v2LN3b_R (FlyEM-HB:1888199872) v2LN3b_R VFB_jrchk8fg [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult antennal lobe local neuron v2LN3B, chol... [FBbt_20003755, FBbt_00007403] [neuprint_JRC_Hemibrain_1point1] [1888199872] [neuronbridge:1888199872, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
157 v2LN3b_R (FlyEM-HB:5813034455) v2LN3b_R VFB_jrchk8ff [Entity, Adult, Anatomy, Cell, Cholinergic, In... [cholinergic local interneuron of the adult an... [FBbt_00007403, FBbt_20003755] [neuprint_JRC_Hemibrain_1point1] [5813034455] [neuronbridge:5813034455, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False

158 rows × 13 columns

[5]:
# Find all GABA-regic inputs onto descending neurons

vfb.get_connected_neurons_by_type(upstream_type='GABAergic neuron',
                                 downstream_type='adult descending neuron',
                                 weight=10).sort_values('weight', ascending=False, ignore_index=True)
[5]:
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
0 VFB_jrchk79q SMP594(SCB017)_R (FlyEM-HB:976934253) 492 VFB_jrchk70f SMP454_R (FlyEM-HB:326253554) adult superior medial protocerebrum neuron 594 adult superior medial protocerebrum neuron 454 None None None None
1 VFB_jrchk79q SMP594(SCB017)_R (FlyEM-HB:976934253) 393 VFB_jrchjsri CL138_R (FlyEM-HB:707190304) adult superior medial protocerebrum neuron 594 adult clamp neuron 138 None None None None
2 VFB_jrchjrof AVLP080_R (FlyEM-HB:5813027276) 373 VFB_jrchk4wd PVLP136_R (FlyEM-HB:5813057178) adult anterior ventrolateral protocerebrum neu... adult posterior ventrolateral protocerebrum ne... None None None None
3 VFB_jrchjrek AOTU019(ADM10)_L (FlyEM-HB:1605518663) 362 VFB_jrchk47t PS017_R (FlyEM-HB:5813069484) adult anterior optic tubercle neuron 019 adult posterior slope neuron 017 None None None None
4 VFB_jrchjrob AVLP076_R (FlyEM-HB:1135441187) 349 VFB_jrchk4wd PVLP136_R (FlyEM-HB:5813057178) adult anterior ventrolateral protocerebrum neu... adult posterior ventrolateral protocerebrum ne... None None None None
... ... ... ... ... ... ... ... ... ... ... ...
1354 VFB_jrchk79p SMP593(SCB014)_R (FlyEM-HB:549282467) 10 VFB_jrchk4a1 PS066(AVM08)_L (FlyEM-HB:1284675398) adult superior medial protocerebrum neuron 593 adult posterior slope neuron 066 None None None None
1355 VFB_jrchjrgi AOTU053_R (FlyEM-HB:5813097142) 10 VFB_jrchk4a1 PS066(AVM08)_L (FlyEM-HB:1284675398) adult anterior optic tubercle neuron 053 adult posterior slope neuron 066 None None None None
1356 VFB_jrchjrej AOTU019_R (FlyEM-HB:799868224) 10 VFB_jrchk0ve MDN_R (FlyEM-HB:698016469) adult anterior optic tubercle neuron 019 adult moonwalker descending neuron None None None None
1357 VFB_jrchjuut IB060(PVL21)_L (FlyEM-HB:760806798) 10 VFB_jrchk7f7 VES029(AVM14)_L (FlyEM-HB:1099800130) adult inferior bridge neuron 060 adult vest neuron 029 None None None None
1358 VFB_jrchk4yr SAD013_R (FlyEM-HB:5813024035) 10 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475) adult saddle neuron 013 descending neuron of the posterior brain DNp04 None None None None

1359 rows × 11 columns

[6]:
# Get connections between pacemaker neurons
clock_neuron_connectome = vfb.get_connected_neurons_by_type(upstream_type='pacemaker neuron',
                                 downstream_type='pacemaker neuron',
                                 weight=10).sort_values('weight', ascending=False)
clock_neuron_connectome
[6]:
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
12 VFB_jrchjtex DN1a_R (FlyEM-HB:264083994) 79 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) DN1a neuron adult cholinergic neuron|LNd neuron None None None None
15 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) 75 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) DN1a neuron adult cholinergic neuron|LNd neuron None None None None
25 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) 63 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) DN1a neuron adult cholinergic neuron|adult s-LNv neuron None None None None
28 VFB_jrchjtex DN1a_R (FlyEM-HB:264083994) 55 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) DN1a neuron adult cholinergic neuron|adult s-LNv neuron None None None None
30 VFB_jrchk089 LPN_R (FlyEM-HB:480029788) 43 VFB_jrchk08a LPN_R (FlyEM-HB:450034902) adult LP neuron|adult dopaminergic neuron adult LP neuron None None None None
16 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) 40 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) adult cholinergic neuron|adult s-LNv neuron adult cholinergic neuron|LNd neuron None None None None
24 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 37 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) adult cholinergic neuron|LNd neuron adult cholinergic neuron|adult s-LNv neuron None None None None
19 VFB_jrchjtf0 DN1pA_R (FlyEM-HB:324846570) 37 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) ventro-contralateral-projecting DN1p neuron|ad... adult cholinergic neuron|LNd neuron None None None None
18 VFB_jrchjtf2 DN1pA_R (FlyEM-HB:387944118) 34 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|LNd neuron None None None None
26 VFB_jrchjtf1 DN1pA_R (FlyEM-HB:325529237) 33 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|adult s-LNv neuron None None None None
13 VFB_jrchjtf1 DN1pA_R (FlyEM-HB:325529237) 30 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|LNd neuron None None None None
31 VFB_jrchk08a LPN_R (FlyEM-HB:450034902) 30 VFB_jrchk089 LPN_R (FlyEM-HB:480029788) adult LP neuron adult LP neuron|adult dopaminergic neuron None None None None
11 VFB_jrchjtf3 DN1pA_R (FlyEM-HB:387166379) 30 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) ventro-contralateral-projecting DN1p neuron|ad... adult cholinergic neuron|LNd neuron None None None None
20 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 29 VFB_jrchjzxw LNd_R (FlyEM-HB:5813056917) adult cholinergic neuron|LNd neuron adult cholinergic neuron|LNd neuron None None None None
8 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) 25 VFB_jrchjzxx LNd_R (FlyEM-HB:5813021192) adult cholinergic neuron|adult s-LNv neuron LNd neuron None None None None
29 VFB_jrchjtf3 DN1pA_R (FlyEM-HB:387166379) 25 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) ventro-contralateral-projecting DN1p neuron|ad... adult cholinergic neuron|adult s-LNv neuron None None None None
27 VFB_jrchjtez DN1pA_R (FlyEM-HB:5813010153) 25 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|adult s-LNv neuron None None None None
22 VFB_jrchjtf0 DN1pA_R (FlyEM-HB:324846570) 25 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) ventro-contralateral-projecting DN1p neuron|ad... adult cholinergic neuron|adult s-LNv neuron None None None None
23 VFB_jrchjtf2 DN1pA_R (FlyEM-HB:387944118) 22 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|adult s-LNv neuron None None None None
9 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 21 VFB_jrchjzxx LNd_R (FlyEM-HB:5813021192) adult cholinergic neuron|LNd neuron LNd neuron None None None None
21 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) 17 VFB_jrchjzxw LNd_R (FlyEM-HB:5813056917) adult cholinergic neuron|adult s-LNv neuron adult cholinergic neuron|LNd neuron None None None None
14 VFB_jrchjtez DN1pA_R (FlyEM-HB:5813010153) 15 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) adult glutamatergic neuron|ventro-contralatera... adult cholinergic neuron|LNd neuron None None None None
6 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) 14 VFB_jrchjtf3 DN1pA_R (FlyEM-HB:387166379) adult cholinergic neuron|adult s-LNv neuron ventro-contralateral-projecting DN1p neuron|ad... None None None None
4 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 14 VFB_jrchjtf1 DN1pA_R (FlyEM-HB:325529237) adult cholinergic neuron|LNd neuron adult glutamatergic neuron|ventro-contralatera... None None None None
7 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 13 VFB_jrchjtf3 DN1pA_R (FlyEM-HB:387166379) adult cholinergic neuron|LNd neuron ventro-contralateral-projecting DN1p neuron|ad... None None None None
10 VFB_jrchjtf0 DN1pA_R (FlyEM-HB:324846570) 13 VFB_jrchjzxx LNd_R (FlyEM-HB:5813021192) ventro-contralateral-projecting DN1p neuron|ad... LNd neuron None None None None
3 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) 12 VFB_jrchjtf1 DN1pA_R (FlyEM-HB:325529237) adult cholinergic neuron|adult s-LNv neuron adult glutamatergic neuron|ventro-contralatera... None None None None
17 VFB_jrchjtf5 DN1pB_R (FlyEM-HB:5813071319) 11 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) anterior-projecting DN1p neuron|adult glutamat... adult cholinergic neuron|LNd neuron None None None None
0 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) 11 VFB_jrchjtex DN1a_R (FlyEM-HB:264083994) DN1a neuron DN1a neuron None None None None
1 VFB_jrchjtex DN1a_R (FlyEM-HB:264083994) 10 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) DN1a neuron DN1a neuron None None None None
5 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 10 VFB_jrchjtez DN1pA_R (FlyEM-HB:5813010153) adult cholinergic neuron|LNd neuron adult glutamatergic neuron|ventro-contralatera... None None None None
2 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 10 VFB_jrchjtf2 DN1pA_R (FlyEM-HB:387944118) adult cholinergic neuron|LNd neuron adult glutamatergic neuron|ventro-contralatera... None None None None
[7]:
# Get connections between visual projectsion neurons and descending neurons
visPN2DC = vfb.get_connected_neurons_by_type(upstream_type='visual projection neuron',
                                 downstream_type='adult descending neuron',
                                 weight=10).sort_values('weight', ascending=False)
visPN2DC
[7]:
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
1701 VFB_jrchk09j LT51(aSP29a)_R (FlyEM-HB:1282348408) 319 VFB_jrchjtfr DNb01_R (FlyEM-HB:1566597156) adult glutamatergic neuron|lobula tangential n... descending neuron of the anterior ventral brai... None None None None
53 VFB_jrchk7g6 VES044_R (FlyEM-HB:5812979017) 262 VFB_jrchk7eb VES009_R (FlyEM-HB:1140923511) adult vest neuron 044 adult vest neuron 009 None None None None
1332 VFB_jrchk09h LT51_R (FlyEM-HB:5813069020) 238 VFB_jrchk7e7 VES006_R (FlyEM-HB:642728308) lobula tangential neuron LT51|adult glutamater... adult vest neuron 006 None None None None
1668 VFB_jrchk0bu LT86_R (FlyEM-HB:1285849916) 228 VFB_jrchk7g4 VES042_R (FlyEM-HB:1875284107) lobula tangential neuron|adult cholinergic neuron adult vest neuron 042 None None None None
11 VFB_jrchk09c LT51_R (FlyEM-HB:1444351896) 221 VFB_jrchjtfg DNa03_R (FlyEM-HB:1139909038) adult glutamatergic neuron|lobula tangential n... descending neuron of the anterior dorsal brain... None None None None
... ... ... ... ... ... ... ... ... ... ... ...
1026 VFB_jrchjzoi LLPC2a (FlyEM-HB:5813039328) 10 VFB_jrchjtfo DNa10_R (FlyEM-HB:707116522) lobula-lobula plate columnar neuron LLPC descending neuron of the posterior brain DNp10 None None None None
1020 VFB_jrchjwwh LC10 (FlyEM-HB:5813016041) 10 VFB_jrchjtfo DNa10_R (FlyEM-HB:707116522) adult cholinergic neuron|lobula columnar neuro... descending neuron of the posterior brain DNp10 None None None None
1019 VFB_jrchjzul LLPC3 (FlyEM-HB:1777956777) 10 VFB_jrchjtfo DNa10_R (FlyEM-HB:707116522) lobula-lobula plate columnar neuron LLPC descending neuron of the posterior brain DNp10 None None None None
1014 VFB_jrchjy7z LC35_R (FlyEM-HB:1502364155) 10 VFB_jrchjtge DNp10_R (FlyEM-HB:5813026936) lobula columnar neuron|adult cholinergic neuron descending neuron of the posterior brain DNp10 None None None None
1706 VFB_jrchjuts IB043_R (FlyEM-HB:883514695) 10 VFB_jrchjtfr DNb01_R (FlyEM-HB:1566597156) adult inferior bridge neuron 043 descending neuron of the anterior ventral brai... None None None None

1707 rows × 11 columns

[8]:
visPN2DC['upstream_class'].value_counts(normalize=True).plot(kind = 'bar') # Excercise - sum up weights for each type.  Note - some types here subsume others
[8]:
<Axes: xlabel='upstream_class'>
../_images/tutorials_connectomics_9_1.png

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.

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

upstream_of_DNp04 = vfb.get_neurons_upstream_of('DNp04_R (FlyEM-HB:1405231475)', weight = 20)
upstream_of_DNp04
[9]:
query_neuron_id query_neuron_name weight target_neuron_id target_neuron_name
0 VFB_jrchjy9x LC4 (FlyEM-HB:1938544937) 98 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
1 VFB_jrchjy9p LC4 (FlyEM-HB:1815070402) 97 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
2 VFB_jrchjyad LC4 (FlyEM-HB:1908226457) 93 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
3 VFB_jrchjya0 LC4 (FlyEM-HB:5812998136) 92 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
4 VFB_jrchjyah LC4 (FlyEM-HB:1938207942) 90 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
... ... ... ... ... ...
82 VFB_jrchk063 LPLC2_R (FlyEM-HB:5813034151) 24 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
83 VFB_jrchk4oy PVLP023_R (FlyEM-HB:1598296804) 23 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
84 VFB_jrchjrof AVLP080_R (FlyEM-HB:5813027276) 22 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
85 VFB_jrchk4p4 PVLP026_R (FlyEM-HB:1570565128) 21 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
86 VFB_jrchk4pd PVLP031_R (FlyEM-HB:1630342124) 20 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)

87 rows × 5 columns

[10]:
vfb.get_TermInfo(upstream_of_DNp04['query_neuron_id'])
[10]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 LPLC2_R (FlyEM-HB:5813034151) LPLC2_R VFB_jrchk063 [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [lobula plate-lobula columnar neuron LPLC2] [FBbt_00111763] [neuprint_JRC_Hemibrain_1point1] [5813034151] [neuronbridge:5813034151, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1 LC4 (FlyEM-HB:1625080038) LC4 VFB_jrchjy9e [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1625080038] [neuprint_JRC_Hemibrain_1point1:1625080038, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
2 LC4 (FlyEM-HB:1782668028) LC4 VFB_jrchjy9o [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1782668028] [neuronbridge:1782668028, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
3 LC4 (FlyEM-HB:1874035952) LC4 VFB_jrchjy9z [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1874035952] [neuprint_JRC_Hemibrain_1point1:1874035952, ne... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
4 LC4 (FlyEM-HB:1810956698) LC4 VFB_jrchjy9j [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1810956698] [neuprint_JRC_Hemibrain_1point1:1810956698, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
82 SAD017_R (FlyEM-HB:1630678915) SAD017_R VFB_jrchk4z0 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult saddle neuron 017] [FBbt_20002226] [neuprint_JRC_Hemibrain_1point1] [1630678915] [neuronbridge:1630678915, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
83 PVLP142_R (FlyEM-HB:1876565477) PVLP142_R VFB_jrchk4wk [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult cholinergic neuron, adult posterior ven... [FBbt_00058205, FBbt_20002200] [neuprint_JRC_Hemibrain_1point1] [1876565477] [neuronbridge:1876565477, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
84 PVLP151(SCB004)_L (FlyEM-HB:1628973439) PVLP151(SCB004)_L VFB_jrchk4x2 [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002209] [neuprint_JRC_Hemibrain_1point1] [1628973439] [neuronbridge:1628973439, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
85 PVLP100_R (FlyEM-HB:1375845363) PVLP100_R VFB_jrchk4u3 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002158] [neuprint_JRC_Hemibrain_1point1] [1375845363] [neuronbridge:1375845363, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
86 PVLP094_R (FlyEM-HB:1503733177) PVLP094_R VFB_jrchk4tm [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002152] [neuprint_JRC_Hemibrain_1point1] [1503733177] [neuprint_JRC_Hemibrain_1point1:1503733177, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...

87 rows × 13 columns

[11]:
vfb.get_TermInfo(upstream_of_DNp04['query_neuron_id'])
[11]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 LPLC2_R (FlyEM-HB:5813034151) LPLC2_R VFB_jrchk063 [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [lobula plate-lobula columnar neuron LPLC2] [FBbt_00111763] [neuprint_JRC_Hemibrain_1point1] [5813034151] [neuronbridge:5813034151, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1 LC4 (FlyEM-HB:1625080038) LC4 VFB_jrchjy9e [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1625080038] [neuprint_JRC_Hemibrain_1point1:1625080038, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
2 LC4 (FlyEM-HB:1782668028) LC4 VFB_jrchjy9o [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1782668028] [neuronbridge:1782668028, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
3 LC4 (FlyEM-HB:1874035952) LC4 VFB_jrchjy9z [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1874035952] [neuprint_JRC_Hemibrain_1point1:1874035952, ne... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
4 LC4 (FlyEM-HB:1810956698) LC4 VFB_jrchjy9j [Entity, Adult, Anatomy, Cell, Cholinergic, Gl... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [neuprint_JRC_Hemibrain_1point1] [1810956698] [neuprint_JRC_Hemibrain_1point1:1810956698, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
82 SAD017_R (FlyEM-HB:1630678915) SAD017_R VFB_jrchk4z0 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult saddle neuron 017] [FBbt_20002226] [neuprint_JRC_Hemibrain_1point1] [1630678915] [neuronbridge:1630678915, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
83 PVLP142_R (FlyEM-HB:1876565477) PVLP142_R VFB_jrchk4wk [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult cholinergic neuron, adult posterior ven... [FBbt_00058205, FBbt_20002200] [neuprint_JRC_Hemibrain_1point1] [1876565477] [neuronbridge:1876565477, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
84 PVLP151(SCB004)_L (FlyEM-HB:1628973439) PVLP151(SCB004)_L VFB_jrchk4x2 [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002209] [neuprint_JRC_Hemibrain_1point1] [1628973439] [neuronbridge:1628973439, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
85 PVLP100_R (FlyEM-HB:1375845363) PVLP100_R VFB_jrchk4u3 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002158] [neuprint_JRC_Hemibrain_1point1] [1375845363] [neuronbridge:1375845363, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
86 PVLP094_R (FlyEM-HB:1503733177) PVLP094_R VFB_jrchk4tm [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult posterior ventrolateral protocerebrum n... [FBbt_20002152] [neuprint_JRC_Hemibrain_1point1] [1503733177] [neuprint_JRC_Hemibrain_1point1:1503733177, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...

87 rows × 13 columns

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

[12]:
vfb.get_neurons_downstream_of('LC4 (FlyEM-HB:1249932198)', classification="'adult descending neuron'", weight = 10)
[12]:
query_neuron_id query_neuron_name weight target_neuron_id target_neuron_name
0 VFB_jrchjy8y LC4 (FlyEM-HB:1249932198) 78 VFB_jrchjtg7 DNp04_R (FlyEM-HB:1405231475)
1 VFB_jrchjy8y LC4 (FlyEM-HB:1249932198) 65 VFB_jrchjtgf DNp11_R (FlyEM-HB:1281324958)
2 VFB_jrchjy8y LC4 (FlyEM-HB:1249932198) 30 VFB_jrchjup1 Giant Fiber_R (FlyEM-HB:2307027729)
3 VFB_jrchjy8y LC4 (FlyEM-HB:1249932198) 11 VFB_jrchjtg6 DNp03_R (FlyEM-HB:1565846637)

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.

[13]:
# Using VFB to get neurons by type
DA1 = vfb.get_instances("'adult antennal lobe projection neuron DA1'")
len(DA1)
DA1
Warning: called a non existant id:VFB_00102294
[13]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 Gad1-F-400088 VFB_00009611 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [expression pattern fragment, adult antennal l... [VFBext_0000004, FBbt_00067372] [FlyCircuit] [Gad1-F-400088] [FlyCircuit:Gad1-F-400088] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
1 Uniglomerular mALT DA1 lPN#L1 (FAFB:4207871) VFB_0010126e [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [catmaid_fafb] [4207871] [catmaid_fafb:4207871] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
2 Uniglomerular mALT DA1 lPN#L6 (FAFB:2381753) VFB_0010123b [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [catmaid_fafb] [2381753] [catmaid_fafb:2381753] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
3 Uniglomerular mALT DA1 lPN#L3 (FAFB:2345089) VFB_0010122p [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [catmaid_fafb] [2345089] [catmaid_fafb:2345089] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
4 Uniglomerular mlALT DA1 vPN#L1 (FAFB:2334841) VFB_0010122m [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [catmaid_fafb] [2334841] [catmaid_fafb:2334841] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
5 Uniglomerular mALT DA1 lPN#L2 (FAFB:2319457) VFB_0010122k [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [catmaid_fafb] [2319457] [catmaid_fafb:2319457] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
6 Uniglomerular mALT DA1 lPN#L7 (FAFB:3239781) VFB_0010124l [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [catmaid_fafb] [3239781] [catmaid_fafb:3239781] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
7 Uniglomerular mALT DA1 lPN#L5 (FAFB:2380564) VFB_0010122z [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [catmaid_fafb] [2380564] [catmaid_fafb:2380564] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
8 Uniglomerular mlALT DA1 vPN#R1 (FAFB:1811442) VFB_0010121x [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [catmaid_fafb] [1811442] [catmaid_fafb:1811442] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
9 Uniglomerular mALT DA1 lPN#R5 (FAFB:2863104) VFB_0010124e [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [catmaid_fafb] [2863104] [catmaid_fafb:2863104] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
10 Uniglomerular mALT DA1 lPN#L4 (FAFB:2379517) VFB_0010122y [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [catmaid_fafb] [2379517] [catmaid_fafb:2379517] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
11 Uniglomerular mALT DA1 lPN#R4 (FAFB:755022) VFB_00101205 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [755022] [catmaid_fafb:755022] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
12 Uniglomerular mALT DA1 lPN#R7 (FAFB:57353) VFB_00101202 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [57353] [catmaid_fafb:57353] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
13 Uniglomerular mALT DA1 lPN#R1 (FAFB:57323) VFB_00101201 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [57323] [catmaid_fafb:57323] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
14 Uniglomerular mALT DA1 lPN#R3 (FAFB:61221) VFB_00101204 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [61221] [catmaid_fafb:61221] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
15 Uniglomerular mALT DA1 lPN#R2 (FAFB:57311) VFB_00101200 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [57311] [catmaid_fafb:57311] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
16 Uniglomerular mALT DA1 lPN#R8 (FAFB:57381) VFB_00101203 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [57381] [catmaid_fafb:57381] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
17 Multiglomerular mALT lvPN#R45 (FAFB:57035) VFB_001011z3 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [57035] [catmaid_fafb:57035] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
18 Multiglomerular mALT lvPN#R46 (FAFB:57179) VFB_001011zb [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [57179] [catmaid_fafb:57179] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
19 Multiglomerular mALT lvPN#R44 (FAFB:57158) VFB_001011z9 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [57158] [catmaid_fafb:57158] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
20 Uniglomerular mALT DA1 lPN#R6 (FAFB:27295) VFB_00101199 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [catmaid_fafb] [27295] [catmaid_fafb:27295] [JRC2018Unisex] [Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
21 Cha-F-300252 VFB_00005625 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [expression pattern fragment, adult ALl1 linea... [VFBext_0000004, FBbt_00050025, FBbt_00067350,... [FlyCircuit] [Cha-F-300252] [FlyCircuit:Cha-F-300252] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
22 VGlut-F-800329 VFB_00005957 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [antennal lobe projection neuron of ALl1 linea... [FBbt_00067362, FBbt_00067350, VFBext_0000004,... [FlyCircuit] [VGlut-F-800329] [FlyCircuit:VGlut-F-800329] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
23 VGlut-F-800317 VFB_00005913 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [antennal lobe projection neuron of ALl1 linea... [FBbt_00067362, VFBext_0000004, FBbt_00050025,... [FlyCircuit] [VGlut-F-800317] [FlyCircuit:VGlut-F-800317] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
24 VGlut-F-000655 VFB_00006552 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, ad... [FBbt_00048096, FBbt_00050025, FBbt_00067362, ... [FlyCircuit] [VGlut-F-000655] [FlyCircuit:VGlut-F-000655] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
25 VGlut-F-200574 VFB_00006638 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [medial antennal lobe tract projection neuron,... [FBbt_00067350, VFBext_0000004, FBbt_00048096,... [FlyCircuit] [VGlut-F-200574] [FlyCircuit:VGlut-F-200574] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
26 fru-F-400149 VFB_00006344 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [medial antennal lobe tract projection neuron,... [FBbt_00067350, VFBext_0000004, FBbt_00048096,... [FlyCircuit] [fru-F-400149] [FlyCircuit:fru-F-400149] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
27 M_lvPNm45_R (FlyEM-HB:792023887) M_lvPNm45_R VFB_jrchk0xm [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [neuprint_JRC_Hemibrain_1point1] [792023887] [neuronbridge:792023887, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
28 M_lvPNm45_R (FlyEM-HB:757591093) M_lvPNm45_R VFB_jrchk0xl [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [neuprint_JRC_Hemibrain_1point1] [757591093] [neuprint_JRC_Hemibrain_1point1:757591093, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
29 M_lvPNm45_R (FlyEM-HB:757258507) M_lvPNm45_R VFB_jrchk0xk [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [neuprint_JRC_Hemibrain_1point1] [757258507] [neuprint_JRC_Hemibrain_1point1:757258507, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
30 Multiglomerular mALT lvPN#L3 (FAFB:4520615) VFB_00102dvz [Entity, Adult, Anatomy, Cell, Chemosensory_sy... Multiglomerular mALT lvPN#L3, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [4520615] [catmaid_fafb:4520615] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
31 Multiglomerular mALT lvPN#L2 (FAFB:7710838) VFB_00102dw8 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... Multiglomerular mALT lvPN#L2, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [7710838] [catmaid_fafb:7710838] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
32 Multiglomerular mALT lvPN#L1 (FAFB:4520197) VFB_00102dvy [Entity, Adult, Anatomy, Cell, Chemosensory_sy... Multiglomerular mALT lvPN#L1, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [catmaid_fafb] [4520197] [catmaid_fafb:4520197] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
33 DA1_lPN_R (FlyEM-HB:5813039315) DA1_lPN_R VFB_jrchjtdd [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [neuprint_JRC_Hemibrain_1point1] [5813039315] [neuronbridge:5813039315, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
34 DA1_lPN_R (FlyEM-HB:1734350908) DA1_lPN_R VFB_jrchjtdb [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [neuprint_JRC_Hemibrain_1point1] [1734350908] [neuprint_JRC_Hemibrain_1point1:1734350908, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
35 DA1_lPN_R (FlyEM-HB:754534424) DA1_lPN_R VFB_jrchjtde [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [neuprint_JRC_Hemibrain_1point1] [754534424] [neuronbridge:754534424, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
36 DA1_vPN_R (FlyEM-HB:733316908) DA1_vPN_R VFB_jrchjtdh [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [neuprint_JRC_Hemibrain_1point1] [733316908] [neuronbridge:733316908, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
37 DA1_lPN_R (FlyEM-HB:1765040289) DA1_lPN_R VFB_jrchjtdc [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [neuprint_JRC_Hemibrain_1point1] [1765040289] [neuronbridge:1765040289, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
38 DA1_lPN_R (FlyEM-HB:722817260) DA1_lPN_R VFB_jrchjtda [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [neuprint_JRC_Hemibrain_1point1] [722817260] [neuprint_JRC_Hemibrain_1point1:722817260, neu... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
39 DA1_lPN_R (FlyEM-HB:1734350788) DA1_lPN_R VFB_jrchjtdf [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [neuprint_JRC_Hemibrain_1point1] [1734350788] [neuprint_JRC_Hemibrain_1point1:1734350788, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
40 DA1_lPN_R (FlyEM-HB:754538881) DA1_lPN_R VFB_jrchjtdg [Entity, Adult, Anatomy, Cell, Chemosensory_sy... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [neuprint_JRC_Hemibrain_1point1] [754538881] [neuronbridge:754538881, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
41 Cha-F-500006 VFB_00010085 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [adult ALl1 lineage neuron, expression pattern... [FBbt_00050025, VFBext_0000004, FBbt_00048096,... [FlyCircuit] [Cha-F-500006] [FlyCircuit:Cha-F-500006] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
42 VGlut-F-000280 VFB_00010758 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, me... [FBbt_00048096, FBbt_00067350, FBbt_00067362, ... [FlyCircuit] [VGlut-F-000280] [FlyCircuit:VGlut-F-000280] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
43 VGlut-F-600450 VFB_00010984 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [medial antennal lobe tract projection neuron,... [FBbt_00067350, FBbt_00048096, FBbt_00067362, ... [FlyCircuit] [VGlut-F-600450] [FlyCircuit:VGlut-F-600450] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
44 VGlut-F-700188 VFB_00010912 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [antennal lobe projection neuron of ALl1 linea... [FBbt_00067362, FBbt_00050025, FBbt_00048096, ... [FlyCircuit] [VGlut-F-700188] [FlyCircuit:VGlut-F-700188] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
45 Gad1-F-200064 VFB_00011249 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [antennal lobe projection neuron of ALl1 linea... [FBbt_00067362, FBbt_00048096, FBbt_00050025, ... [FlyCircuit] [Gad1-F-200064] [FlyCircuit:Gad1-F-200064] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
46 Gad1-F-200010 VFB_00012622 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, ad... [FBbt_00048096, FBbt_00050025, FBbt_00067362, ... [FlyCircuit] [Gad1-F-200010] [FlyCircuit:Gad1-F-200010] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
47 VGlut-F-600326 VFB_00012155 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [expression pattern fragment, medial antennal ... [VFBext_0000004, FBbt_00067350, FBbt_00050025,... [FlyCircuit] [VGlut-F-600326] [FlyCircuit:VGlut-F-600326] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
48 VGlut-F-700040 VFB_00013061 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [expression pattern fragment, adult antennal l... [VFBext_0000004, FBbt_00048096, FBbt_00067362,... [FlyCircuit] [VGlut-F-700040] [FlyCircuit:VGlut-F-700040] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
49 fru-M-200319 VFB_00000323 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [antennal lobe projection neuron of ALl1 linea... [FBbt_00067362, FBbt_00067350, VFBext_0000004,... [FlyCircuit] [fru-M-200319] [FlyCircuit:fru-M-200319] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
50 npf-M-300006 VFB_00001755 [Entity, Adult, Anatomy, Cell, Chemosensory_sy... OutAge: Adult 5~15 days [medial antennal lobe tract projection neuron,... [FBbt_00067350, FBbt_00067362, FBbt_00050025, ... [FlyCircuit] [npf-M-300006] [FlyCircuit:npf-M-300006] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
[14]:
# Map neurons to CATMAID Skeleton IDs (skids)

da1_skids = vfb.vfb_id_2_xrefs(DA1['id'], db='catmaid_fafb', reverse_return=True)
da1_skids_int = list(map(int, da1_skids))
print(da1_skids_int)

# print is just used so we can see the list as a single line
33mWarning: The following IDs do not match DB &/or id_type constraints: {'VFB_00101200', 'VFB_00101201', 'VFB_jrchjtdf', 'VFB_00101202', 'VFB_0010122m', 'VFB_00005957', 'VFB_0010122z', 'VFB_00101204', 'VFB_00001755', 'VFB_00012155', 'VFB_0010123b', 'VFB_00010984', 'VFB_jrchk0xl', 'VFB_jrchjtdh', 'VFB_00009611', 'VFB_00102dvy', 'VFB_00010912', 'VFB_00010758', 'VFB_jrchk0xk', 'VFB_0010121x', 'VFB_00006344', 'VFB_00013061', 'VFB_00012622', 'VFB_00000323', 'VFB_00010085', 'VFB_00006638', 'VFB_jrchk0xm', 'VFB_00005913', 'VFB_jrchjtde', 'VFB_0010122y', 'VFB_jrchjtdb', 'VFB_001011z9', 'VFB_001011z3', 'VFB_jrchjtdc', 'VFB_00102dw8', 'VFB_00101205', 'VFB_jrchjtdd', 'VFB_0010124e', 'VFB_0010122k', 'VFB_001011zb', 'VFB_0010122p', 'VFB_00102dvz', 'VFB_0010126e', 'VFB_00101203', 'VFB_jrchjtda', 'VFB_00011249', 'VFB_00101199', 'VFB_0010124l', 'VFB_00005625', 'VFB_00006552', 'VFB_jrchjtdg'}
[2381753, 7710838, 4520197, 57179, 2379517, 3239781, 57158, 57035, 2345089, 57311, 27295, 2380564, 2319457, 4520615, 57323, 2334841, 755022, 1811442, 61221, 57353, 4207871, 57381, 2863104]

Generate a connectivity table for neurons downstream of DA1 neurons

[15]:
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 23 neurons (pymaid)
INFO  : Done. Found 0 pre-, 301 postsynaptic and 0 gap junction-connected neurons (pymaid)
[15]:
neuron_name skeleton_id num_nodes relation 2381753 7710838 4520197 57179 2379517 3239781 ... 57323 2334841 755022 1811442 61221 57353 4207871 57381 2863104 total
0 Uniglomerular mlALT DA1 vPN mlALTed Milk 18114... 1811442 11769 downstream 0 0 0 0 0 0 ... 20 0 32 0 26 3 0 4 30 152
1 Uniglomerular mlALT DA1 vPN mlALTed Milk 23348... 2334841 6362 downstream 32 0 0 0 28 26 ... 0 0 0 0 0 0 17 0 0 139
2 LHAV4c1#1 488056 downstream DA1 GSXEJ 488055 12137 downstream 0 0 0 13 0 0 ... 11 0 15 0 15 3 0 0 15 111
3 LHAV4a4#1 1911125 FML PS RJVR 1911124 6969 downstream 0 0 0 0 0 0 ... 15 0 19 0 13 6 0 9 23 109
4 LHAV2a3#1 1870231 RJVR AJES PS 1870230 14820 downstream 0 0 0 0 0 0 ... 7 0 19 1 7 23 0 28 5 105

5 rows × 28 columns

[16]:
# 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 584 neurons matching the search parameters (pymaid)
[16]:
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 × 584 columns

[17]:
import seaborn as sns

ax = sns.clustermap(adj, vmax=10, cmap='Greys')
# ax = sns.heatmap(adj, vmax=10, cmap='Greys')

/Users/robbiecourt/GIT/VFB_connect/.conda/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning: Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
  warnings.warn(msg)
/Users/robbiecourt/GIT/VFB_connect/.conda/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning: Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
  warnings.warn(msg)
../_images/tutorials_connectomics_23_1.png
[18]:
# Axo-axonic connections between two different types of DA1 PNs
cn = pymaid.get_connectors_between(2863104, 1811442)
cn.head()
[18]:
connector_id connector_loc node1_id source_neuron confidence1 creator1 node1_loc node2_id target_neuron confidence2 creator2 node2_loc
0 17870563 [363219.0, 169182.0, 153920.0] 6903652 2863104 5 NaN [362894.0, 169511.0, 153920.0] 6546760 1811442 5 NaN [363421.0, 168741.0, 153920.0]
1 6795747 [355030.0, 154048.0, 145800.0] 6795749 2863104 5 NaN [355045.0, 154180.0, 145800.0] 6795745 1811442 5 NaN [355024.0, 153946.0, 145760.0]
2 6826199 [358042.0, 160788.0, 147600.0] 6826200 2863104 5 NaN [355948.0, 160126.0, 147600.0] 6826198 1811442 5 NaN [358194.0, 160883.0, 147600.0]
3 6835037 [354306.0, 154100.0, 152320.0] 6835043 2863104 5 NaN [354088.0, 153842.0, 152320.0] 6835033 1811442 5 NaN [354400.0, 154346.0, 152360.0]
4 7032350 [355192.0, 167586.0, 158320.0] 7032356 2863104 5 NaN [354814.0, 167861.0, 158320.0] 17870268 1811442 5 NaN [356626.0, 167779.0, 158200.0]
[19]:
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")
              )

Data type cannot be displayed: application/vnd.plotly.v1+json

neuprint connectivity queries

To programmatically interface with neuprint, we will use neuprint-python (link). It requires an API token which you can get via the website and is bound to the Google account that you use to log into neuprint. For this workshop we provide such a token as environment variable but you will need to start using your own token after the workshop is over.

These examples use the hemibrain v1.1 dataset.

neuprint-python

First we have to initialize the connection.

[20]:
!pip install neuprint-python --quiet

import neuprint as neu
client = neu.Client('https://neuprint.janelia.org',
                    dataset='hemibrain:v1.1',
                    token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InZmYndvcmtzaG9wLm5ldXJvZmx5MjAyMEBnbWFpbC5jb20iLCJsZXZlbCI6Im5vYXV0aCIsImltYWdlLXVybCI6Imh0dHBzOi8vbGg2Lmdvb2dsZXVzZXJjb250ZW50LmNvbS8tWXFDN21NRXd3TlEvQUFBQUFBQUFBQUkvQUFBQUFBQUFBQUEvQU1adXVjbU5zaXhXZDRhM0VyTTQ0ODBMa2IzNDdvUlpfUS9zOTYtYy9waG90by5qcGc_c3o9NTA_c3o9NTAiLCJleHAiOjE3OTQwOTE4ODd9.ceg4mrj2o-aOhK0NHNGmBacg8R34PBPoLBwhCo4uOCQ')

Most functions in neuprint-python accept neu.NeuronCriteria which is effectively a filter for body IDs, types, cellbody fibers (~lineages), etc:

[21]:
help(neu.NeuronCriteria)
Help on class NeuronCriteria in module neuprint.queries.neuroncriteria:

class NeuronCriteria(builtins.object)
 |  NeuronCriteria(matchvar='n', *, bodyId=None, type=None, instance=None, regex='guess', status=None, statusLabel=None, rois=None, inputRois=None, outputRois=None, roi_req='all', min_roi_inputs=1, min_roi_outputs=1, group=None, serial=None, cropped=None, birthtime=None, cellBodyFiber=None, class_=None, entryNerve=None, exitNerve=None, hemilineage=None, longTract=None, modality=None, origin=None, predictedNt=None, serialMotif=None, somaNeuromere=None, somaSide=None, subclass=None, synonyms=None, systematicType=None, target=None, label=None, min_pre=0, min_post=0, somaLocation=None, tosomaLocation=None, rootLocation=None, soma=None, client=None)
 |
 |  Neuron selection criteria.
 |
 |  Specifies which fields to filter by when searching for a Neuron (or Segment).
 |  This class does not send queries itself, but you use it to specify search
 |  criteria for various query functions.
 |
 |  Note:
 |      For simple queries involving only particular bodyId(s) or type(s)/instance(s),
 |      you can usually just pass the ``bodyId`` or ``type`` to the query function,
 |      without constructing a full ``NeuronCriteria``.
 |
 |      .. code-block:: python
 |
 |          from neuprint import fetch_neurons, NeuronCriteria as NC
 |
 |          # Equivalent
 |          neuron_df, conn_df = fetch_neurons(NC(bodyId=329566174))
 |          neuron_df, conn_df = fetch_neurons(329566174)
 |
 |          # Equivalent
 |          # (Criteria is satisfied if either type or instance matches.)
 |          neuron_df, conn_df = fetch_neurons(NC(type="OA-VPM3", instance="OA-VPM3"))
 |          neuron_df, conn_df = fetch_neurons("OA-VPM3")
 |
 |  Methods defined here:
 |
 |  __eq__(self, value)
 |      Implement comparison between criteria.
 |      Note: 'matchvar' is not considered during the comparison.
 |
 |  __init__(self, matchvar='n', *, bodyId=None, type=None, instance=None, regex='guess', status=None, statusLabel=None, rois=None, inputRois=None, outputRois=None, roi_req='all', min_roi_inputs=1, min_roi_outputs=1, group=None, serial=None, cropped=None, birthtime=None, cellBodyFiber=None, class_=None, entryNerve=None, exitNerve=None, hemilineage=None, longTract=None, modality=None, origin=None, predictedNt=None, serialMotif=None, somaNeuromere=None, somaSide=None, subclass=None, synonyms=None, systematicType=None, target=None, label=None, min_pre=0, min_post=0, somaLocation=None, tosomaLocation=None, rootLocation=None, soma=None, client=None)
 |      All criteria must be passed as keyword arguments.
 |
 |      .. note::
 |          Only ``bodyId``, ``type``, ``instance``, and ROI-related criteria are
 |          applicable to all datasets.  The applicability of all other criteria depends
 |          on the dataset being accessed (e.g. hemibrain,  manc, etc.).
 |
 |      .. note::
 |
 |          **Options for specifying ROI criteria**
 |
 |          The ``rois`` argument merely matches neurons that intersect the given ROIs at all
 |          (without distinguishing between inputs and outputs).
 |
 |          The ``inputRois`` and ``outputRois`` arguments allow you to put requirements
 |          on whether or not neurons have inputs or outputs in the listed ROIs.
 |          It produces a more expensive query, but it's more selective.
 |          It also enables you to require a minimum number of connections in the given
 |          ``inputRois`` or ``outputRois`` using the ``min_roi_inputs`` and ``min_roi_outputs``
 |          criteria.
 |
 |          In either case, use use ``roi_req`` to specify whether a neuron must match just
 |          one (``any``) of the listed ROIs, or ``all`` of them.
 |
 |      .. note::
 |
 |          **Matching against missing values (NULL)**
 |
 |          To search for neurons which are missing given property entirely,
 |          you can use a list containing ``None``, or the special value ``neuprint.IsNull``.
 |          For example, to find neurons with no `type`, use ``type=[None]`` or ``type=IsNull``.
 |
 |          **Matching against any value (NOT NULL)**
 |
 |          To search for any non-null value, you can use ``neuprint.NotNull``. For
 |          example, to find neurons that have a type (no matter what the
 |          type is), use ``type=NotNull``.
 |
 |      Args:
 |          matchvar (str):
 |              An arbitrary cypher variable name to use when this
 |              ``NeuronCriteria`` is used to construct cypher queries.
 |              Must begin with a lowercase letter.
 |
 |          bodyId (int or list of ints):
 |              List of bodyId values.
 |
 |          type (str or list of str):
 |              Cell type.  Matches depend on the the ``regex`` argument.
 |              If both ``type`` and ``instance`` criteria are supplied, any neuron that
 |              matches EITHER criteria will match the overall criteria.
 |
 |          instance (str or list of str):
 |              Cell instance (specific cell name).  Matches depend on the the ``regex`` argument.
 |              If both ``type`` and ``instance`` criteria are supplied, any neuron that
 |              matches EITHER criteria will match the overall criteria.
 |
 |          regex (bool):
 |              If ``True``, the ``instance`` and ``type`` arguments will be interpreted as
 |              regular expressions, rather than exact match strings.
 |              If ``False``, only exact matches will be found.
 |              By default, the matching method will be automatically chosen by inspecting the
 |              ``type`` and ``instance`` strings.  If they contain regex-like characters,
 |              then we assume you intend regex matching. (You can see which method was chosen by
 |              checking the ``regex`` field after the ``NeuronCriteria`` is constructed.)
 |
 |          status (str or list of str):
 |              Indicates the status of the neuron's reconstruction quality.
 |              Typically, named/annotated neurons have ``Traced`` status,
 |              the best quality.
 |          statusLabel (str or list of str):
 |             ``statusLabel`` is typically more fine-grained than ``status``,
 |             and mostly of interest during the construction of the connectome,
 |             not for end-users.  The possible values of ``statusLabel`` do not
 |             correspond one-to-one to those of ``status``.
 |
 |          rois (str or list of str):
 |              ROIs that merely intersect the neuron, without specifying whether
 |              they're intersected by input or output synapses.
 |              If not provided, will be auto-set from ``inputRois`` and ``outputRois``.
 |
 |          inputRois (str or list of str):
 |              Only Neurons which have inputs in EVERY one of the given ROIs will be matched.
 |              ``regex`` does not apply to this parameter.
 |
 |          outputRois (str or list of str):
 |              Only Neurons which have outputs in EVERY one of the given ROIs will be matched.
 |              ``regex`` does not apply to this parameter.
 |
 |          min_roi_inputs (int):
 |              How many input (post) synapses a neuron must have in each ROI to satisfy the
 |              ``inputRois`` criteria.  Can only be used if you provided ``inputRois``.
 |
 |          min_roi_outputs (int):
 |              How many output (pre) synapses a neuron must have in each ROI to satisfy the
 |              ``outputRois`` criteria.   Can only be used if you provided ``outputRois``.
 |
 |          roi_req (Either ``'any'`` or ``'all'``):
 |              Whether a neuron must intersect all of the listed input/output ROIs, or any of the listed input/output ROIs.
 |              When using 'any', each neuron must still match at least one input AND at least one output ROI.
 |
 |          group (int or list of int)
 |              In some datasets, the ``group`` ID is used to associate neurons morphological type,
 |              including left-right homologues. Neurons with the same group ID have matching morphology.
 |
 |          serial (int or list of int)
 |              Similar to ``group``, but used for associating neurons across segmental neuropils in the nerve cord.
 |              Neurons with the same ``serial`` ID are analogous to one another, but in different leg segments.
 |
 |          cropped (bool):
 |              If given, restrict results to neurons that are cropped or not.
 |
 |          birthtime (str or list of str):
 |          cellBodyFiber (str or list of str):
 |          class\_ (str or list of str):
 |              Matches for the neuron ``class`` field.
 |          entryNerve (str or list of str):
 |          exitNerve (str or list of str):
 |          hemilineage (str or list of str):
 |          longTract (str or list of str):
 |          modality (str or list of str):
 |          origin (str or list of str):
 |          predictedNt (str or list of str):
 |          serialMotif (str or list of str):
 |          somaNeuromere (str or list of str):
 |          somaSide  (str or list of str):
 |              Valid choices are 'RHS', 'LHS', 'Midline'
 |          subclass (str or list of str):
 |          synonyms (str or list of str):
 |          systematicType (str or list of str):
 |          target (str or list of str):
 |
 |          label (Either ``'Neuron'`` or ``'Segment'``):
 |              Which node label to match with.
 |              (In neuprint, all ``Neuron`` nodes are also ``Segment`` nodes.)
 |              By default, ``'Neuron'`` is used, unless you provided a non-empty ``bodyId`` list.
 |              In that case, ``'Segment'`` is the default. (It's assumed you're really interested
 |              in the bodies you explicitly listed, whether or not they have the ``'Neuron'`` label.)
 |
 |          min_pre (int):
 |              Exclude neurons that don't have at least this many t-bars (outputs) overall,
 |              regardless of how many t-bars exist in any particular ROI.
 |
 |          min_post (int):
 |              Exclude neurons that don't have at least this many PSDs (inputs) overall,
 |              regardless of how many PSDs exist in any particular ROI.
 |
 |          somaLocation:
 |              The ``somaLocation`` property of ``:Neuron`` objects contains
 |              the ``[X,Y,Z]`` coordinate (in voxels) of the cell body.
 |              ``NeuronCriteria`` does not allow you to match a specific coordinate,
 |              but you may set this argument to ``NotNull` (or ```IsNull``) to
 |              search for cells with (or without) a recorded cell body.
 |
 |          tosomaLocation:
 |              Neurons which could not be successfully attached to their cell body do not have
 |              a recorded ``somaLocation``.  Instead, they have an annotaiton on the cell body
 |              fiber, on the severed end extending out toward the cell body.
 |              Like ``somaLocation``, you can't match a specific coordinate using ``NeuronCriteria``,
 |              but you can use ``NotNull``/``IsNull``.
 |
 |          rootLocation:
 |              Some (but not all) Neurons which have no soma in the tissue sample are tagged with
 |              a ``rootLocation``, indicating where they enter/exit the sample.
 |              Like ``somaLocation``, you can't match a specific coordinate using ``NeuronCriteria``,
 |              but you can use ``NotNull``/``IsNull``.
 |
 |          soma (Either ``True``, ``False``, or ``None``)
 |              DEPRECATED.  Use ``somaLocation=NotNull`` or ``somaLocation=IsNull``.
 |
 |          client (:py:class:`neuprint.client.Client`):
 |              Used to validate ROI names.
 |              If not provided, the global default ``Client`` will be used.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  all_conditions(self, *vars, prefix=0, comments=True)
 |
 |  basic_conditions(self, prefix=0, comments=True)
 |      Construct a WHERE clause based on the basic conditions
 |      in this criteria (i.e. everything except for the "directed ROI" conditions.)
 |
 |  basic_exprs(self)
 |      Return the list of expressions that correspond
 |      to the members in this NeuronCriteria object.
 |      They're intended be combined (via 'AND') in
 |      the WHERE clause of a cypher query.
 |
 |  directed_rois_condition(self, *vars, prefix=0, comments=True)
 |      Construct the ```WITH...WHERE``` statements that apply the "directed ROI"
 |      conditions specified by this criteria's ``inputRois`` and ``outputRois``
 |      members.
 |
 |      These conditions are expensive to evaluate, so it's usually a good
 |      idea to position them LAST in your cypher query, once the result set
 |      has already been narrowed down by eariler filters.
 |
 |  global_vars(self)
 |
 |  global_with(self, *vars, prefix=0)
 |
 |  rois_expr(self)
 |
 |  typeinst_expr(self)
 |      Unlike all other fields, type and instance OR'd together.
 |      Either match satisfies the criteria.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  combined_conditions(neuron_conditions, vars=[], prefix=0, comments=True) from builtins.type
 |      Combine the conditions from multiple NeuronCriteria into a single string,
 |      putting the "cheap" conditions first and the "expensive" conditions last.
 |      (That is, basic conditions first and the directed ROI conditions last.)
 |
 |  combined_global_with(neuron_conditions, vars=[], prefix=0) from builtins.type
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  MAX_LITERAL_LENGTH = 3
 |
 |  __hash__ = None

Fetching neurons

Let’s say we want to find all antennnal lobe projection neurons (PNs). Their type nomenclature adheres to {glomerulus}_{lineage}PN (e.g. DA1_lPN)for uniglomerular PNs and a M_{lineage}PN{tract}{type} (e.g. M_vPNml50 = “multiglomerular ventral lineage PN mediolateral tract type 50) for multiglomerular PNs.

To get them all, we need to use regex patterns (see this cheatsheet):

[22]:
# Define the filter criteria
nc = neu.NeuronCriteria(type='.*?_.*?PN.*?', regex=True)

# Get general info for these neurons
pns, roi_info = neu.fetch_neurons(nc)

print(f'{pns.shape[0]} PNs found.')

pns.head()
/Users/robbiecourt/GIT/VFB_connect/.conda/lib/python3.10/site-packages/neuprint/client.py:609: FutureWarning:

Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`

337 PNs found.
[22]:
bodyId instance type pre post downstream upstream size status cropped statusLabel cellBodyFiber somaRadius somaLocation roiInfo notes inputRois outputRois
0 294792184 M_vPNml53_R M_vPNml53 92 344 730 344 420662445 Traced False Roughly traced AVM04 336.5 [18923, 34319, 35424] {'SNP(R)': {'pre': 70, 'post': 155, 'downstrea... None [AL(R), AL-D(R), AL-DA2(R), AL-DA4m(R), AL-DC1... [AL(R), AL-DC1(R), LH(R), PLP(R), SIP(R), SLP(...
1 329599710 M_lvPNm32_R M_lvPNm32 247 285 2052 285 343478957 Traced False Roughly traced AVM06 NaN None {'SNP(R)': {'pre': 180, 'post': 93, 'downstrea... None [AL(R), AL-DC4(R), AL-DL2v(R), AL-DM1(R), AL-D... [AL(R), AL-DL2v(R), AL-DM1(R), AL-DM4(R), AL-D...
2 417199910 M_lvPNm36_R M_lvPNm36 162 347 1590 347 387058559 Traced False Roughly traced AVM06 351.5 [13823, 33925, 34176] {'SNP(R)': {'pre': 156, 'post': 95, 'downstrea... None [AL(R), AL-DL5(R), AL-DM4(R), AL-DP1m(R), AL-V... [AL(R), AL-DL5(R), AL-DM4(R), AL-VP1d(R), AL-V...
3 480927537 M_vPNml70_R M_vPNml70 82 276 692 276 240153322 Traced False Roughly traced AVM04 NaN None {'SNP(R)': {'pre': 15, 'post': 18, 'downstream... None [AL(R), AL-DA2(R), AL-DA4l(R), AL-DA4m(R), AL-... [LH(R), SLP(R), SNP(R)]
4 481268653 M_vPNml89_R M_vPNml89 146 58 1614 58 265085609 Traced False Roughly traced AVM04 NaN None {'SNP(R)': {'pre': 10, 'post': 2, 'downstream'... None [AL(R), AL-VC3l(R), AL-VC4(R), AL-VP1m(R), LH(... [LH(R), SLP(R), SNP(R)]
[23]:
# Check that the regex did not have any accidental by-catch
pns['type'].unique()
[23]:
array(['M_vPNml53', 'M_lvPNm32', 'M_lvPNm36', 'M_vPNml70', 'M_vPNml89',
       'VP1l+_lvPN', 'M_vPNml69', 'DM1_lPN', 'DM4_vPN', 'M_vPNml79',
       'VP4+_vPN', 'DA4l_adPN', 'M_vPNml87', 'DM4_adPN', 'M_vPNml83',
       'VA5_lPN', 'DA4m_adPN', 'M_lvPNm24', 'M_vPNml85', 'VP1l+VP3_ilPN',
       'M_vPNml77', 'M_vPNml84', 'VC1_lPN', 'M_lvPNm39', 'M_vPNml50',
       'DM2_lPN', 'VC5_lvPN', 'M_vPNml88', 'M_vPNml58', 'VP4_vPN',
       'DP1m_vPN', 'DP1m_adPN', 'DM5_lPN', 'VC5_adPN', 'M_vPNml80',
       'M_lvPNm25', 'VC3m_lvPN', 'VP3+_vPN', 'VP1m+_lvPN', 'DA3_adPN',
       'V_l2PN', 'M_vPNml56', 'VC3l_adPN', 'VM7v_adPN', 'DL5_adPN',
       'VM4_adPN', 'VM2_adPN', 'M_lvPNm40', 'DC4_vPN', 'V_ilPN',
       'M_vPNml74', 'Z_lvPNm1', 'DA1_lPN', 'DP1l_adPN', 'VM4_lvPN',
       'M_vPNml71', 'DP1l_vPN', 'M_lvPNm41', 'M_spPN5t10', 'DA1_vPN',
       'VC4_adPN', 'DM3_adPN', 'M_lvPNm45', 'VL1_vPN', 'M_lvPNm44',
       'M_vPNml78', 'M_vPNml67', 'M_adPNm5', 'M_smPNm1', 'DM6_adPN',
       'DL2d_adPN', 'M_adPNm6', 'M_adPNm8', 'M_lvPNm43', 'Z_vPNml1',
       'M_vPNml59', 'DA2_lPN', 'M_lPNm11A', 'M_vPNml52', 'DL2d_vPN',
       'VL2p_vPN', 'VA1d_adPN', 'M_lPNm11B', 'M_lvPNm48', 'M_lPNm11C',
       'M_lvPNm42', 'VA1v_vPN', 'M_vPNml68', 'M_vPNml55', 'M_vPNml62',
       'VL2a_vPN', 'M_vPNml60', 'M_vPNml65', 'VM5d_adPN', 'M_l2PNm16',
       'M_vPNml61', 'M_vPNml57', 'M_vPNml64', 'M_lv2PN9t49',
       'VP2+VC5_l2PN', 'M_spPN4t9', 'M_vPNml66', 'M_vPNml75', 'M_vPNml63',
       'M_vPNml72', 'M_lvPNm38', 'D_adPN', 'M_vPNml76', 'M_vPNml54',
       'DM3_vPN', 'M_vPNml86', 'DL3_lPN', 'VA4_lPN', 'VP1d_il2PN',
       'DC1_adPN', 'M_l2PN3t18', 'M_lvPNm35', 'DL4_adPN', 'M_lvPNm28',
       'M_lvPNm27', 'M_ilPNm90', 'M_l2PNl20', 'M_lvPNm29', 'VA7l_adPN',
       'M_lPNm13', 'M_l2PNl21', 'DL1_adPN', 'M_imPNl92', 'M_vPNml73',
       'M_ilPN8t91', 'M_l2PNm14', 'VP1d+VP4_l2PN1', 'M_lvPNm26',
       'DL2v_adPN', 'VP3+VP1l_ivPN', 'M_lvPNm33', 'VA1v_adPN',
       'VP3+_l2PN', 'M_l2PN10t19', 'VP4+VL1_l2PN', 'M_l2PNl22',
       'M_l2PNm15', 'M_lPNm11D', 'MZ_lv2PN', 'DC2_adPN', 'M_lvPNm46',
       'VC2_lPN', 'VM1_lPN', 'VM3_adPN', 'VM7d_adPN', 'M_lvPNm47',
       'M_lPNm12', 'DC3_adPN', 'VP2+_adPN', 'VP1m+VP2_lvPN2',
       'VP1m+VP2_lvPN1', 'VA6_adPN', 'VA7m_lPN', 'M_adPNm7', 'M_adPNm4',
       'VA1d_vPN', 'VA3_adPN', 'VL1_ilPN', 'M_l2PNl23', 'M_lvPNm31',
       'VP1m+VP5_ilPN', 'VL2p_adPN', 'MZ_lvPN', 'VP2_adPN', 'VA2_adPN',
       'VM5v_adPN', 'VP5+VP2_l2PN', 'VP5+VP3_l2PN', 'VP5+_l2PN',
       'M_vPNml51', 'M_smPN6t2', 'M_lvPNm37', 'M_vPNml82', 'M_adPNm3',
       'VP1m_l2PN', 'DC4_adPN', 'VP5+Z_adPN', 'VL2a_adPN', 'VP2_l2PN',
       'M_lvPNm34', 'VP2+Z_lvPN', 'M_lvPNm30', 'M_l2PNm17', 'M_vPNml81',
       'VP1d+VP4_l2PN2'], dtype=object)

We can find the same neuron types using VFB instead. This allows curated neuron classes to be used and doesn’t depend on knowing naming conventions and using potentially error prone regex pattern matching.

[24]:
#This will get all ALPNs from ALL datasets on VFB
ALPNs = vfb.get_instances("'adult antennal lobe projection neuron'")
# Explode the lists in the 'data_source' column into separate rows as each image can potentialy have multiple data sources. Note this can be done for any column with lists
exploded_ALPNs = ALPNs.explode('data_source')
#Select only rows from Hemibrain1.1 dataset
ALPNs=exploded_ALPNs[exploded_ALPNs['data_source'] == 'neuprint_JRC_Hemibrain_1point1']
ALPNs
Warning: called a non existant id:VFB_00102294
[24]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
896 OA-VUMa2_R (FlyEM-HB:1670265016) OA-VUMa2_R VFB_jrchk10i [Entity, Adult, Anatomy, Cell, Individual, Ner... tracing status-Roughly traced, cropped-False [octopaminergic VUMa2 neuron] [FBbt_00110157] neuprint_JRC_Hemibrain_1point1 [1670265016] [neuronbridge:1670265016, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
897 M_vPNml89_R (FlyEM-HB:1694850602) M_vPNml89_R VFB_jrchk100 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult multiglomerular... [FBbt_00058207, FBbt_20003864] neuprint_JRC_Hemibrain_1point1 [1694850602] [neuronbridge:1694850602, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
898 M_vPNml89_R (FlyEM-HB:1819326555) M_vPNml89_R VFB_jrchk101 [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003864, FBbt_00058207] neuprint_JRC_Hemibrain_1point1 [1819326555] [neuprint_JRC_Hemibrain_1point1:1819326555, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
899 OA-VUMa2_R (FlyEM-HB:638481581) OA-VUMa2_R VFB_jrchk10j [Entity, Adult, Anatomy, Cell, Individual, Ner... tracing status-Roughly traced, cropped-False [octopaminergic VUMa2 neuron] [FBbt_00110157] neuprint_JRC_Hemibrain_1point1 [638481581] [neuprint_JRC_Hemibrain_1point1:638481581, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
900 M_lvPNm40_R (FlyEM-HB:1732313117) M_lvPNm40_R VFB_jrchk0xb [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003819] neuprint_JRC_Hemibrain_1point1 [1732313117] [neuronbridge:1732313117, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1237 VP2_l2PN(lALT)_R (FlyEM-HB:5813069447) VP2_l2PN(lALT)_R VFB_jrchk7ja [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult cholinergic neuron, adult antennal lobe... [FBbt_00058205, FBbt_00049730] neuprint_JRC_Hemibrain_1point1 [5813069447] [neuronbridge:5813069447, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1238 Z_vPNml1(noAL+SEZ)_R (FlyEM-HB:792364888) Z_vPNml1(noAL+SEZ)_R VFB_jrchk7zs [Entity, Adult, Anatomy, Cell, GABAergic, Indi... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron, adult ... [FBbt_00067123, FBbt_00058207] neuprint_JRC_Hemibrain_1point1 [792364888] [neuronbridge:792364888, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1239 Z_vPNml1(noAL+SEZ)_R (FlyEM-HB:729608317) Z_vPNml1(noAL+SEZ)_R VFB_jrchk7zr [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron, adult ... [FBbt_00067123, FBbt_00058205] neuprint_JRC_Hemibrain_1point1 [729608317] [neuprint_JRC_Hemibrain_1point1:729608317, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1240 Z_vPNml1(noAL+SEZ)_R (FlyEM-HB:698565676) Z_vPNml1(noAL+SEZ)_R VFB_jrchk7zq [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult cholinergic neuron, adult antennal lobe... [FBbt_00058205, FBbt_00067123] neuprint_JRC_Hemibrain_1point1 [698565676] [neuronbridge:698565676, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
1241 Z_vPNml1(noAL+SEZ)_R (FlyEM-HB:698569832) Z_vPNml1(noAL+SEZ)_R VFB_jrchk7zp [Entity, Adult, Anatomy, Cell, Cholinergic, In... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron, adult ... [FBbt_00067123, FBbt_00058205] neuprint_JRC_Hemibrain_1point1 [698569832] [neuronbridge:698569832, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...

339 rows × 13 columns

Fetching synaptic partners

Looks good! Next: What’s downstream of those PNs?

[25]:
exploded_ALPNs = ALPNs.explode('accession')
ds = neu.fetch_simple_connections(upstream_criteria=list(map(int, exploded_ALPNs['accession'])))
#using hemibrain regex
#ds = neu.fetch_simple_connections(upstream_criteria=neu.NeuronCriteria(bodyId=pns.bodyId.values))
ds
[25]:
bodyId_pre bodyId_post weight type_pre type_post instance_pre instance_post conn_roiInfo
0 635062078 1671292719 390 DP1m_adPN lLN2T_c DP1m_adPN_R lLN2T_c(Tortuous)_R {'AL(R)': {'pre': 390, 'post': 390}, 'AL-DP1m(...
1 635062078 1704347707 326 DP1m_adPN lLN2T_c DP1m_adPN_R lLN2T_c(Tortuous)_R {'AL(R)': {'pre': 324, 'post': 324}, 'AL-DP1m(...
2 542634818 1704347707 322 DM1_lPN lLN2T_c DM1_lPN_R lLN2T_c(Tortuous)_R {'AL(R)': {'pre': 322, 'post': 322}, 'AL-DM1(R...
3 635062078 1640922516 320 DP1m_adPN lLN2T_e DP1m_adPN_R lLN2T_e(Tortuous)_R {'AL(R)': {'pre': 317, 'post': 316}, 'AL-DP1m(...
4 724816115 1670916819 318 DP1l_adPN lLN2P_a DP1l_adPN_R lLN2P_a(Patchy)_R {'AL(R)': {'pre': 318, 'post': 318}, 'AL-DP1l(...
... ... ... ... ... ... ... ... ...
101862 5901222910 5813086037 1 DM2_lPN None DM2_lPN_R None {'LH(R)': {'pre': 1, 'post': 1}}
101863 5901222910 5813095915 1 DM2_lPN KCg-m DM2_lPN_R KCg-m_R {'MB(R)': {'pre': 1, 'post': 1}, 'CA(R)': {'pr...
101864 5901222910 5813129316 1 DM2_lPN LHAV6a1_b DM2_lPN_R LHAV6a1_b_R {'LH(R)': {'pre': 1, 'post': 1}}
101865 5901222910 5901193783 1 DM2_lPN LHAV4g4_a DM2_lPN_R LHAV4g4_a_R {'LH(R)': {'pre': 1, 'post': 1}}
101866 5901222910 5901203780 1 DM2_lPN LHAV4g11 DM2_lPN_R LHAV4g11_R {'LH(R)': {'pre': 1, 'post': 1}}

101867 rows × 8 columns

Each row is now a connections from a single up- to a single downstream neuron. The “weight” is the number of synapses between the pre- and the postsynaptic neuron. Let’s simplify by grouping by type:

[26]:
by_type = ds.groupby(['type_pre', 'type_post'], as_index=False).weight.sum()
by_type.sort_values('weight', ascending=False, inplace=True)
by_type.reset_index(drop=True, inplace=True)
by_type
[26]:
type_pre type_post weight
0 DC3_adPN KCg-m 3670
1 VM5d_adPN KCg-m 3219
2 DC1_adPN KCg-m 3215
3 VL2a_adPN KCg-m 3096
4 DA1_lPN KCg-m 3078
... ... ... ...
40631 M_vPNml50 WEDPN4 1
40632 M_vPNml50 WEDPN12 1
40633 M_vPNml50 V_ilPN 1
40634 M_vPNml50 VP4+VL1_l2PN 1
40635 Z_vPNml1 mALD2 1

40636 rows × 3 columns

The strongest connections are between PNs and Kenyon Cells (KCs). That’s not much of a surprise since there are thousands of KCs. For the sake of the argument let’s say we want to know where these connections occur:

[27]:
#First find KCs in VFB
KCs = vfb.get_instances("'adult Kenyon cell'")
#Select only rows from Hemibrain1.1 dataset
exploded_KCs = KCs.explode('data_source')
KCs=exploded_KCs[exploded_KCs['data_source'] == 'neuprint_JRC_Hemibrain_1point1']
KCs
[27]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
909 KCa\'b\'-ap2_R (FlyEM-HB:5813020057) KCa\'b\'-ap2_R VFB_jrchjv6v [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [alpha'/beta' anterior-posterior type 2 Kenyon... [FBbt_00049837, FBbt_00048138, FBbt_00058206] neuprint_JRC_Hemibrain_1point1 [5813020057] [neuprint_JRC_Hemibrain_1point1:5813020057, ne... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
910 KCa\'b\'-m_R (FlyEM-HB:579928928) KCa\'b\'-m_R VFB_jrchjv88 [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [mushroom body dopaminergic neuron, alpha'/bet... [FBbt_00048138, FBbt_00100253, FBbt_00058206] neuprint_JRC_Hemibrain_1point1 [579928928] [neuronbridge:579928928, neuprint_JRC_Hemibrai... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
911 KCa\'b\'-m_R (FlyEM-HB:5813062842) KCa\'b\'-m_R VFB_jrchjv9w [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [alpha'/beta' middle Kenyon cell, adult dopami... [FBbt_00100253, FBbt_00058206, FBbt_00048138] neuprint_JRC_Hemibrain_1point1 [5813062842] [neuronbridge:5813062842, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
912 KCa\'b\'-ap2_R (FlyEM-HB:662409582) KCa\'b\'-ap2_R VFB_jrchjv6p [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [mushroom body dopaminergic neuron, adult dopa... [FBbt_00048138, FBbt_00058206, FBbt_00049837] neuprint_JRC_Hemibrain_1point1 [662409582] [neuprint_JRC_Hemibrain_1point1:662409582, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
913 KCa\'b\'-m_R (FlyEM-HB:5813056305) KCa\'b\'-m_R VFB_jrchjv82 [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [adult dopaminergic neuron, mushroom body dopa... [FBbt_00058206, FBbt_00048138, FBbt_00100253] neuprint_JRC_Hemibrain_1point1 [5813056305] [neuronbridge:5813056305, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
5094 KCg-m_R (FlyEM-HB:1141687352) KCg-m_R VFB_jrchjwch [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [gamma main Kenyon cell, mushroom body dopamin... [FBbt_00111061, FBbt_00048138, FBbt_00058206] neuprint_JRC_Hemibrain_1point1 [1141687352] [neuronbridge:1141687352, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
5095 KCg-m_R (FlyEM-HB:693837780) KCg-m_R VFB_jrchjwcq [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [mushroom body dopaminergic neuron, gamma main... [FBbt_00048138, FBbt_00111061, FBbt_00058206] neuprint_JRC_Hemibrain_1point1 [693837780] [neuronbridge:693837780, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
5096 KCg-m_R (FlyEM-HB:1101353948) KCg-m_R VFB_jrchjwe3 [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [mushroom body dopaminergic neuron, adult dopa... [FBbt_00048138, FBbt_00058206, FBbt_00111061] neuprint_JRC_Hemibrain_1point1 [1101353948] [neuronbridge:1101353948, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
5097 KCg-m_R (FlyEM-HB:540389646) KCg-m_R VFB_jrchjwcg [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [mushroom body dopaminergic neuron, adult dopa... [FBbt_00048138, FBbt_00058206, FBbt_00111061] neuprint_JRC_Hemibrain_1point1 [540389646] [neuronbridge:540389646, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...
5098 KCg-m_R (FlyEM-HB:693841887) KCg-m_R VFB_jrchjwci [Entity, Adult, Anatomy, Cell, Cholinergic, Do... tracing status-Roughly traced, cropped-False [adult dopaminergic neuron, mushroom body dopa... [FBbt_00058206, FBbt_00048138, FBbt_00111061] neuprint_JRC_Hemibrain_1point1 [693841887] [neuronbridge:693841887, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l...

1927 rows × 13 columns

[28]:
# Fixes for conda environment to ensure full jupyterlab compatibility
import subprocess

# Check if conda is available
try:
    subprocess.run(["conda", "--version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    conda_available = True
except subprocess.CalledProcessError:
    conda_available = False

# Only run these commands if conda is available
if conda_available:
    try:
        # Update conda base environment
        subprocess.run(["conda", "update", "-n", "base", "-c", "defaults", "conda", "-y"], check=True)
        # Install jupyterlab_widgets
        subprocess.run(["conda", "install", "-n", "base", "-c", "conda-forge", "jupyterlab_widgets", "-y"], check=True)
        # Install ipywidgets
        subprocess.run(["conda", "install", "-n", "base", "-c", "conda-forge", "ipywidgets", "-y"], check=True)
        print("Conda packages updated successfully.")
    except subprocess.CalledProcessError as e:
        print(f"An error occurred while running a conda command: {e}")
else:
    print("Conda is not available in this environment.")

Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working...

The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/osx-64::conda==23.1.0=py310hecd8cb5_0
done


==> WARNING: A newer version of conda exists. <==
  current version: 23.1.0
  latest version: 24.7.1

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=24.7.1



## Package Plan ##

  environment location: /usr/local/Caskroom/miniconda/base

  added / updated specs:
    - conda


The following NEW packages will be INSTALLED:

  brotli-python      pkgs/main/osx-64::brotli-python-1.0.9-py310hcec6c5f_8
  libcxx             pkgs/main/osx-64::libcxx-14.0.6-h9765a3e_0
  lz4-c              pkgs/main/osx-64::lz4-c-1.9.4-hcec6c5f_1
  pip                pkgs/main/osx-64::pip-24.2-py310hecd8cb5_0
  pluggy             pkgs/main/osx-64::pluggy-1.0.0-py310hecd8cb5_1
  zstd               pkgs/main/osx-64::zstd-1.5.5-hc035e20_2

The following packages will be UPDATED:

  bzip2                                    1.0.8-h1de35cc_0 --> 1.0.8-h6c40b1e_6
  cffi                               1.15.1-py310h6c40b1e_3 --> 1.16.0-py310h6c40b1e_1
  charset-normalizer                     2.0.4-pyhd3eb1b0_0 --> 3.3.2-pyhd3eb1b0_0
  conda-package-han~                  2.0.2-py310hecd8cb5_0 --> 2.3.0-py310hecd8cb5_0
  conda-package-str~                  0.7.0-py310hecd8cb5_0 --> 0.10.0-py310hecd8cb5_0
  cryptography                       38.0.4-py310hf6deb26_0 --> 42.0.5-py310h30e54ef_1
  idna                                  3.4-py310hecd8cb5_0 --> 3.7-py310hecd8cb5_0
  libffi                                   3.4.2-hecd8cb5_6 --> 3.4.4-hecd8cb5_1
  openssl            conda-forge::openssl-1.1.1w-h8a1eda9_0 --> pkgs/main::openssl-3.0.14-h46256e1_0
  pycosat                             0.6.4-py310hca72f7f_0 --> 0.6.6-py310h6c40b1e_1
  pyopenssl          pkgs/main/noarch::pyopenssl-22.0.0-py~ --> pkgs/main/osx-64::pyopenssl-24.2.1-py310hecd8cb5_0
  python                                  3.10.9-h218abb5_0 --> 3.10.14-h5ee71fb_1
  requests                           2.28.1-py310hecd8cb5_0 --> 2.32.3-py310hecd8cb5_0
  sqlite                                  3.40.1-h880c91c_0 --> 3.45.3-h6c40b1e_0
  tk                                      8.6.12-h5d9f67b_0 --> 8.6.14-h4d00af3_0
  tqdm                               4.64.1-py310hecd8cb5_0 --> 4.66.4-py310h20db666_0
  tzdata                                   2022g-h04d1e81_0 --> 2024a-h04d1e81_0
  urllib3                           1.26.14-py310hecd8cb5_0 --> 2.2.2-py310hecd8cb5_0
  xz                                      5.2.10-h6c40b1e_1 --> 5.4.6-h6c40b1e_1
  zlib                                    1.2.13-h4dc903c_0 --> 1.2.13-h4b97444_1
  zstandard                          0.18.0-py310hca72f7f_0 --> 0.22.0-py310h2d76c9a_0

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    conda-forge::ca-certificates-2024.7.4~ --> pkgs/main::ca-certificates-2024.7.2-hecd8cb5_0
  certifi            conda-forge/noarch::certifi-2024.7.4-~ --> pkgs/main/osx-64::certifi-2024.7.4-py310hecd8cb5_0



Downloading and Extracting Packages

Preparing transaction: ...working... done
Verifying transaction: ...working... failed

RemoveError: 'pluggy' is a dependency of conda and cannot be removed from
conda's operating environment.

An error occurred while running a conda command: Command '['conda', 'update', '-n', 'base', '-c', 'defaults', 'conda', '-y']' returned non-zero exit status 1.
[29]:
exploded_KCs = KCs.explode('accession')
adj, roi_info2 = neu.fetch_adjacencies(sources=list(map(int, exploded_ALPNs['accession'][:300])), targets=list(map(int, exploded_KCs['accession'][:300])))
roi_info2.head()
[29]:
bodyId_pre bodyId_post roi weight
0 542634818 477900945 CA(R) 21
1 542634818 487160828 CA(R) 31
2 542634818 508599194 CA(R) 17
3 542634818 508616471 CA(R) 9
4 542634818 508616471 NotPrimary 2
[30]:
# Group by region of interest (ROI)
by_roi = roi_info2.groupby('roi').weight.sum()
by_roi.head()
[30]:
roi
CA(R)         34060
NotPrimary      359
SCL(R)           20
SLP(R)          135
Name: weight, dtype: int64
[31]:
ax = by_roi.plot.bar()
ax.set_xlabel('')
ax.set_ylabel('PN to KC synapses')
[31]:
Text(0, 0.5, 'PN to KC synapses')
../_images/tutorials_connectomics_46_1.png
[32]:

adj = roi_info2[roi_info2.roi == 'CA(R)'].pivot(columns="bodyId_pre", index="bodyId_post", values="weight").fillna(0)
[33]:
sns.clustermap(adj, cmap='Greys')
/Users/robbiecourt/GIT/VFB_connect/.conda/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:

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

/Users/robbiecourt/GIT/VFB_connect/.conda/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:

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

[33]:
<seaborn.matrix.ClusterGrid at 0x7fe3d3f45540>
../_images/tutorials_connectomics_48_2.png

Querying paths

Let’s say we want to find out how to go from a PN (second order olfactory neurons) all the way to a descending neuron (presumably leading to motor neurons in the VNC).

[34]:
#First find DNs in VFB
DNs = vfb.get_instances("'adult descending neuron'")
#Select only rows from Hemibrain1.1 dataset
exploded_DNs = DNs.explode('data_source')
DNs=exploded_DNs[exploded_DNs['data_source'] == ('neuprint_JRC_Hemibrain_1point1')]
DNs
[34]:
label symbol id tags parents_label parents_id data_source accession xrefs templates dataset license description
15 NPFP1_R (FlyEM-HB:1043117106) NPFP1_R VFB_jrchk103 [Entity, Adult, Anatomy, Cell, Individual, Ner... [adult octopaminergic neuron, adult NPF P1 neu... [FBbt_00058203, FBbt_00048120] neuprint_JRC_Hemibrain_1point1 [1043117106] [neuronbridge:1043117106, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
16 NPFP1(PDM12)_L (FlyEM-HB:5813068915) NPFP1(PDM12)_L VFB_jrchk104 [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult NPF P1 neuron, adult cholinergic neuron] [FBbt_00048120, FBbt_00058205] neuprint_JRC_Hemibrain_1point1 [5813068915] [neuronbridge:5813068915, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
17 MDN(PDM13)_L (FlyEM-HB:5813021079) MDN(PDM13)_L VFB_jrchk0vf [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult moonwalker descending neuron] [FBbt_00111308] neuprint_JRC_Hemibrain_1point1 [5813021079] [neuprint_JRC_Hemibrain_1point1:5813021079, ne... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
18 MDN(PDM13)_L (FlyEM-HB:729742221) MDN(PDM13)_L VFB_jrchk0vc [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult moonwalker descending neuron] [FBbt_00111308] neuprint_JRC_Hemibrain_1point1 [729742221] [neuronbridge:729742221, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
19 MDN_R (FlyEM-HB:698016469) MDN_R VFB_jrchk0ve [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult moonwalker descending neuron] [FBbt_00111308] neuprint_JRC_Hemibrain_1point1 [698016469] [neuronbridge:698016469, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
... ... ... ... ... ... ... ... ... ... ... ... ... ...
263 WED105_R (FlyEM-HB:1375284097) WED105_R VFB_jrchk7rz [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult wedge neuron 105] [FBbt_20003655] neuprint_JRC_Hemibrain_1point1 [1375284097] [neuronbridge:1375284097, neuprint_JRC_Hemibra... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
264 oviDNb(PDM15)_L (FlyEM-HB:642763374) oviDNb(PDM15)_L VFB_jrchk8dn [Entity, Adult, Anatomy, Cell, Cholinergic, In... [oviposition descending neuron oviDNb] [FBbt_00049921] neuprint_JRC_Hemibrain_1point1 [642763374] [neuprint_JRC_Hemibrain_1point1:642763374, neu... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
265 oviDNa_R (FlyEM-HB:550655668) oviDNa_R VFB_jrchk8dm [Entity, Adult, Anatomy, Cell, Cholinergic, In... [oviposition descending neuron oviDNa] [FBbt_00049920] neuprint_JRC_Hemibrain_1point1 [550655668] [neuronbridge:550655668, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
266 oviDNb_R (FlyEM-HB:519949044) oviDNb_R VFB_jrchk8do [Entity, Adult, Anatomy, Cell, Cholinergic, In... [oviposition descending neuron oviDNb] [FBbt_00049921] neuprint_JRC_Hemibrain_1point1 [519949044] [neuronbridge:519949044, neuprint_JRC_Hemibrai... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Roughly traced, cropped-False
267 vpoDN_R (FlyEM-HB:5813057864) vpoDN_R VFB_jrchk8rz [Entity, Adult, Anatomy, Cell, Cholinergic, In... [adult doublesex pMN2 (female) neuron] [FBbt_00048405] neuprint_JRC_Hemibrain_1point1 [5813057864] [neuronbridge:5813057864, neuprint_JRC_Hemibra... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point1] [https://creativecommons.org/licenses/by/4.0/l... tracing status-Traced, cropped-False

249 rows × 13 columns

[35]:
# First fetch the DNs
exploded_DNs = DNs.explode('accession')
dns, _ = neu.fetch_neurons(list(map(int, exploded_DNs['accession'])))
#with regex
#dns, _ = neu.fetch_neurons(neu.NeuronCriteria(type='(.*DN[^1]{0,}.*|Giant Fiber)', regex=True))
dns
[35]:
bodyId instance type pre post downstream upstream size status cropped statusLabel cellBodyFiber somaRadius somaLocation roiInfo notes inputRois outputRois
0 297925719 SMP478_R SMP478 11 514 33 514 887352389 Traced False Roughly traced PDM15 301.0 [18670, 15472, 12256] {'SNP(R)': {'pre': 8, 'post': 411, 'downstream... pMP1 candidates [INP, SCL(R), SIP(R), SLP(R), SMP(L), SMP(R), ... [SIP(R), SMP(R), SNP(R)]
1 298961895 SMP478_R SMP478 8 569 38 569 862856817 Traced False Roughly traced PDM15 301.0 [17329, 15560, 10624] {'SNP(R)': {'pre': 5, 'post': 317, 'downstream... pMP1 candidates [INP, SCL(R), SMP(L), SMP(R), SNP(L), SNP(R)] [SMP(L), SMP(R), SNP(L), SNP(R)]
2 299298593 SMP478(PDM15)_L SMP478 5 289 16 289 613001071 Traced False Roughly traced None NaN None {'SNP(R)': {'pre': 1, 'post': 80, 'downstream'... pMP1 candidates [SMP(L), SMP(R), SNP(L), SNP(R)] [SMP(L), SMP(R), SNP(L), SNP(R)]
3 326253554 SMP454_R SMP454 2613 9756 21869 9756 8166517062 Traced False Roughly traced PDM12 465.5 [22142, 20149, 5600] {'SNP(R)': {'pre': 1374, 'post': 3627, 'downst... None [ATL(R), AVLP(R), CAN(R), CRE(-ROB,-RUB)(R), C... [AOTU(R), AVLP(R), CRE(-ROB,-RUB)(R), CRE(-RUB...
4 327255181 SMP290_R SMP290 147 455 1028 455 816661754 Traced False Roughly traced PDM05 396.0 [23064, 11810, 14912] {'SNP(R)': {'pre': 63, 'post': 390, 'downstrea... pMP5 candidates [FLA(R), PENP, SMP(L), SMP(R), SNP(L), SNP(R),... [FLA(R), PENP, SMP(R), SNP(R), mALT(R)]
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
244 5813078352 PS133_R PS133 9 1041 30 1041 1572727885 Traced False Roughly traced PDM17 351.0 [26154, 14795, 14256] {'INP': {'post': 252, 'upstream': 252}, 'SCL(R... None [CAN(R), EPA(L), EPA(R), GNG, GOR(L), GOR(R), ... [CAN(R), GOR(R), IPS(R), PENP, SPS(L), SPS(R),...
245 5813082237 PS212_R PS212 77 5047 299 5047 2290180209 Traced False Roughly traced PVM02 456.5 [20933, 11422, 19304] {'INP': {'pre': 14, 'post': 613, 'downstream':... None [EPA(R), GNG, GOR(R), IB, ICL(R), INP, IPS(R),... [GNG, IB, ICL(R), INP, IPS(R), PLP(R), SPS(R),...
246 5813095193 DNp16_R DNp16 70 683 429 683 292910198 Traced False Roughly traced PVM02 276.0 [25941, 10730, 20000] {'INP': {'post': 34, 'upstream': 34}, 'IB': {'... None [CAN(R), GNG, IB, INP, IPS(R), PENP, SPS(R), V... [CAN(R), GNG, IPS(R), PENP, SPS(R), VMNP]
247 5813096489 VES081_R VES081 14 1321 71 1321 928031787 Traced False Roughly traced PVM15 451.0 [15106, 10109, 20144] {'VMNP': {'pre': 5, 'post': 1190, 'downstream'... None [AL(R), GNG, IPS(R), LAL(-GA)(R), LAL(R), LX(R... [GNG, VES(R), VMNP]
248 5813108230 DNp16/17_R DNp16/17 5 177 16 177 304268206 Traced False Roughly traced PVM02 321.5 [23677, 10111, 18544] {'INP': {'post': 2, 'upstream': 2}, 'IB': {'po... None [GNG, IB, INP, IPS(R), SPS(R), VMNP] [IPS(R), SPS(R), VMNP]

249 rows × 18 columns

Neuprint lets you query paths from a single source to a single target. For multi-source or -target queries, your best bet is to download the entire graph and run the queries locally using networkx or igraph.

[36]:
# Find all paths from A PN to A DNs
paths = neu.fetch_shortest_paths(upstream_bodyId=list(map(int, exploded_ALPNs['accession']))[0],
                                 downstream_bodyId=list(map(int, exploded_DNs['accession']))[0],
                                 min_weight=10)
paths
[36]:
path bodyId type weight
0 0 1670265016 OA-VUMa2 0
1 0 328533761 PPL201 14
2 0 360259229 LHAV3h1 11
3 0 1043117106 NPFP1 13
4 1 1670265016 OA-VUMa2 0
5 1 328533761 PPL201 14
6 1 329225149 LHCENT10 12
7 1 1043117106 NPFP1 10
8 2 1670265016 OA-VUMa2 0
9 2 574688051 LHPV12a1 23
10 2 360259229 LHAV3h1 17
11 2 1043117106 NPFP1 13
12 3 1670265016 OA-VUMa2 0
13 3 577542489 M_lvPNm24 10
14 3 456847100 SLP130 10
15 3 1043117106 NPFP1 10
16 4 1670265016 OA-VUMa2 0
17 4 1700307582 M_l2PNl21 12
18 4 360259229 LHAV3h1 15
19 4 1043117106 NPFP1 13
20 5 1670265016 OA-VUMa2 0
21 5 1700307582 M_l2PNl21 12
22 5 329897255 LHCENT10 15
23 5 1043117106 NPFP1 16

So it looks like there are three separate 7-hop paths to go from M_vPNml53 to DN1a. Let’s visualize the neurons involved!

Fetching meshes & skeletons

You can fetch skeletons as SWCs directly via neuprint-python. For visualization however it’s easiest to load neuron morphologies via navis. For that navis wraps neuprint-python and adds some convenience functions (see also the tutorial):

[37]:
# Import the wrapped neuprint-python
# -> this exposes ALL base functions plus a couple navis-specific extras
import navis
import navis.interfaces.neuprint as neu

#client = neu.Client('https://neuprint.janelia.org', dataset='hemibrain:v1.1')

# Fetch neurons in the first path
bodyIDS = paths.loc[(paths.path == 0), 'bodyId']
# nl = neu.fetch_skeletons(paths.loc[(paths.path == 0), 'bodyId'])
# nl

xrefs = ['neuprint_JRC_Hemibrain_1point1:' + str(id) for id in bodyIDS]

nl_terms = vfb.terms(xrefs)
nl_terms.load_skeletons(template='JRC_FlyEM_Hemibrain')
nl = [term.skeleton for term in nl_terms]
nl_terms.summary
INFO: Resolved xref neuprint_JRC_Hemibrain_1point1:1670265016 to VFB_jrchk10i
INFO: Resolved xref neuprint_JRC_Hemibrain_1point1:328533761 to VFB_jrchk45u
INFO: Resolved xref neuprint_JRC_Hemibrain_1point1:360259229 to VFB_jrchjyu5
INFO: Resolved xref neuprint_JRC_Hemibrain_1point1:1043117106 to VFB_jrchk103
[37]:
ID Name Description URL Related Terms Parents License Cross References Datasets
0 VFB_jrchk10i OA-VUMa2_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk10i [Rel(relation=MinimalEdgeInfo(label=capable of... [OA-VUMa2] CC-BY_4.0 [https://neuronbridge.janelia.org/search?q=167... [JRC_FlyEM_Hemibrain neurons Version 1.1]
1 VFB_jrchk45u PPL201_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk45u [Rel(relation=MinimalEdgeInfo(label=capable of... [PPL201] CC-BY_4.0 [https://neuronbridge.janelia.org/search?q=328... [JRC_FlyEM_Hemibrain neurons Version 1.1]
2 VFB_jrchjyu5 LHAV3h1_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchjyu5 [Rel(relation=MinimalEdgeInfo(label=capable of... [LHAV3h1, adult cholinergic neuron] CC-BY_4.0 [https://neuprint.janelia.org/results?dataset=... [JRC_FlyEM_Hemibrain neurons Version 1.1]
3 VFB_jrchk103 NPFP1_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk103 [Rel(relation=MinimalEdgeInfo(label=capable of... [adult octopaminergic neuron, NPFP1] CC-BY_4.0 [https://neuronbridge.janelia.org/search?q=104... [JRC_FlyEM_Hemibrain neurons Version 1.1]
[38]:
# Let's also get some ROI meshes

# al = neu.fetch_roi('AL(R)')
# lh = neu.fetch_roi('LH(R)')
# ca = neu.fetch_roi('CA(R)')

# If the neuprint server fails to return the meshes (often due to capacity issues), we can use the VFB API to get the meshes instead
[al,lh,ca] = [term.mesh for term in vfb.terms(['AL(R) on JRC_FlyEM_Hemibrain','LH(R) on JRC_FlyEM_Hemibrain','CA(R) on JRC_FlyEM_Hemibrain'])]

[39]:
# Plot
navis.plot3d([nl, lh, al, ca])

Data type cannot be displayed: application/vnd.plotly.v1+json

Plotting graphs

There are various ways of plotting static graphs. In theory Jupyter notebooks lend themselves to interactive graphs too but unfortunately DeepNote does not yet support the required libraries (e.g. ipywidgets). That being said: if you want to run this locally or on Google colab, check out ipycytoscape.

There are numerous options to do this but we will use networkx to plot a static graph:

[40]:
import networkx as nx
import numpy as np

# Initialize the graph
G = nx.DiGraph()

# Generate edges from the paths
edges = []
for p in paths.path.unique():
    this_path = paths.loc[(paths.path == p)]
    this_edges = list(zip(this_path.values[:-1], this_path.values[1:]))

    for i in range(this_path.shape[0] - 1):
        edges.append([this_path.bodyId.values[i], this_path.bodyId.values[i + 1], this_path.weight.values[i + 1]])

# Add the edges
G.add_weighted_edges_from(edges)

# Add some names to the nodes
nx.set_node_attributes(G, paths.set_index('bodyId')['type'].to_dict(), name='name')
[41]:
import matplotlib.pyplot as plt

# Draw using a simple force-directed layout
pos = nx.kamada_kawai_layout(G)

# We could draw everything in one step but this way we have more control over the plot
fig, ax = plt.subplots(figsize=(10, 10))

# Draw nodes
nx.draw_networkx_nodes(G, pos=pos, ax=ax)

# Draw edges
weights = np.array([e[2]['weight'] for e in G.edges(data=True)])
nx.draw_networkx_edges(G, pos=pos, width=(weights / 12).tolist())

# Add node labels
nx.draw_networkx_labels(G, pos=pos, labels=dict(G.nodes('name')), font_size=14)

# Turn axes of
ax.set_axis_off()
../_images/tutorials_connectomics_60_0.png

In general, I recommend exporting your graph to e.g. graphml and importing it into e.g. cytoscape if you want to explore an interactive network graph. see nx.write_gml