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.terms)
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, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult neuron, expression pattern fragment] [FBbt_00047095, VFBext_0000004] [FlyCircuit] [Trh-F-500041] [FlyCircuit:Trh-F-500041] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
[4]:
neurons_in_DA3 = vfb.get_instances("'neuron' that 'overlaps' some 'antennal lobe glomerulus DA3'", return_dataframe=True, limit=50)
neurons_in_DA3
Limiting to 50 terms out of 200
[4]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 FlyWire:720575940629461442 SPS.GNG.2 VFB_fw007255 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-efferent, superc... [descending neuron of the anterior ventral bra... [FBbt_00047586] [fw] [720575940629461442] [fw:720575940629461442, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
1 FlyWire:720575940621209513 AL.2610 VFB_fw042719 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [fw] [720575940621209513] [fw:720575940621209513, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
2 FlyWire:720575940621265249 NO_CONS.1112 VFB_fw044209 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940621265249] [fw:720575940621265249, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
3 FlyWire:720575940628683002 AL.2425 VFB_fw047713 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [fw] [720575940628683002] [fw:720575940628683002, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
4 FlyWire:720575940627185896 NO_CONS.1800 VFB_fw047933 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [fw] [720575940627185896] [fw:720575940627185896, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
5 CSD(5HT1)(AVM03)_L (FlyEM-HB:759810119) CSD(5HT1)(AVM03)_L VFB_jrchjtd6 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult CSD interneuron] [FBbt_00007405] [hb] [759810119] [neuronbridge:hemibrain:759810119, hb:759810119] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
6 DA3_adPN_R (FlyEM-HB:1703683361) DA3_adPN_R VFB_jrchjtdn [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [hb] [1703683361] [neuronbridge:hemibrain:1703683361, hb:1703683... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
7 DA4m_adPN_R (FlyEM-HB:574037266) DA4m_adPN_R VFB_jrchjtdq [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA4m adPN] [FBbt_00047714] [hb] [574037266] [neuronbridge:hemibrain:574037266, hb:574037266] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
8 DA3_adPN_R (FlyEM-HB:666135689) DA3_adPN_R VFB_jrchjtdo [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [hb] [666135689] [neuronbridge:hemibrain:666135689, hb:666135689] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
9 DL4_adPN_R (FlyEM-HB:1670934213) DL4_adPN_R VFB_jrchjteh [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DL4 adPN] [FBbt_00100382] [hb] [1670934213] [neuronbridge:hemibrain:1670934213, hb:1670934... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
10 ORN_DA3_R (FlyEM-HB:1703683060) ORN_DA3_R VFB_jrchk183 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Orphan, cropped-None [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1703683060] [hb:1703683060, neuronbridge:hemibrain:1703683... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
11 ORN_DA3 (FlyEM-HB:1670972802) ORN_DA3 VFB_jrchk184 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1670972802] [neuronbridge:hemibrain:1670972802, hb:1670972... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
12 ORN_DA3 (FlyEM-HB:1703151910) ORN_DA3 VFB_jrchk185 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult cholinergic neuron, adult olfactory rec... [FBbt_00058205, FBbt_00067033] [hb] [1703151910] [neuronbridge:hemibrain:1703151910, hb:1703151... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
13 ORN_DA3 (FlyEM-HB:1703683340) ORN_DA3 VFB_jrchk186 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1703683340] [hb:1703683340, neuronbridge:hemibrain:1703683... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
14 ORN_DA3 (FlyEM-HB:1733850183) ORN_DA3 VFB_jrchk182 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1733850183] [hb:1733850183, neuronbridge:hemibrain:1733850... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
15 ORN_DA3 (FlyEM-HB:1702811119) ORN_DA3 VFB_jrchk181 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1702811119] [hb:1702811119, neuronbridge:hemibrain:1702811... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
16 ORN_DA3 (FlyEM-HB:1703342127) ORN_DA3 VFB_jrchk180 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or23a] [FBbt_00067033] [hb] [1703342127] [hb:1703342127, neuronbridge:hemibrain:1703342... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
17 ORN_DL3_L (FlyEM-HB:1606205114) ORN_DL3_L VFB_jrchk1hb [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or65] [FBbt_00067011] [hb] [1606205114] [hb:1606205114, neuronbridge:hemibrain:1606205... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
18 ORN_DL5_R (FlyEM-HB:1639925326) ORN_DL5_R VFB_jrchk1lb [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult cholinergic neuron, adult olfactory rec... [FBbt_00058205, FBbt_00067005] [hb] [1639925326] [hb:1639925326, neuronbridge:hemibrain:1639925... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
19 ORN_DL5_L (FlyEM-HB:1640050851) ORN_DL5_L VFB_jrchk1lh [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult cholinergic neuron, adult olfactory rec... [FBbt_00058205, FBbt_00067005] [hb] [1640050851] [neuronbridge:hemibrain:1640050851, hb:1640050... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
20 ORN_DL5_L (FlyEM-HB:1669933011) ORN_DL5_L VFB_jrchk1li [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult cholinergic neuron, adult olfactory rec... [FBbt_00058205, FBbt_00067005] [hb] [1669933011] [hb:1669933011, neuronbridge:hemibrain:1669933... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
21 ORN_VA6 (FlyEM-HB:1921989317) ORN_VA6 VFB_jrchk2ao [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Leaves, cropped-True [adult olfactory receptor neuron Or82a] [FBbt_00067044] [hb] [1921989317] [neuronbridge:hemibrain:1921989317, hb:1921989... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
22 FlyWire:720575940639028312 AL.2664 VFB_fw045784 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940639028312] [neuronbridge:flywire_fafb:720575940639028312,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
23 FlyWire:720575940625187390 AL.2709 VFB_fw045776 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940625187390] [fw:720575940625187390, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
24 FlyWire:720575940622565514 NO_CONS.1277 VFB_fw045774 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940622565514] [fw:720575940622565514, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
25 FlyWire:720575940629782748 AL.2689 VFB_fw045781 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940629782748] [fw:720575940629782748, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
26 FlyWire:720575940626859797 NO_CONS.1762 VFB_fw045783 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940626859797] [neuronbridge:flywire_fafb:720575940626859797,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
27 FlyWire:720575940623031223 AL.2603 VFB_fw045778 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940623031223] [neuronbridge:flywire_fafb:720575940623031223,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
28 FlyWire:720575940611559653 NO_CONS.268 VFB_fw045788 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940611559653] [fw:720575940611559653, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
29 FlyWire:720575940630246778 NO_CONS.2170 VFB_fw045780 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [fw] [720575940630246778] [fw:720575940630246778, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
30 FlyWire:720575940619976686 AL.2620 VFB_fw045779 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940619976686] [neuronbridge:flywire_fafb:720575940619976686,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
31 FlyWire:720575940624163854 AL.2447 VFB_fw045777 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940624163854] [fw:720575940624163854, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
32 FlyWire:720575940632297263 AL.2547 VFB_fw045785 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940632297263] [neuronbridge:flywire_fafb:720575940632297263,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
33 FlyWire:720575940631315503 AL.2683 VFB_fw045787 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940631315503] [fw:720575940631315503, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
34 FlyWire:720575940625460784 NO_CONS.1602 VFB_fw045789 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940625460784] [neuronbridge:flywire_fafb:720575940625460784,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
35 FlyWire:720575940622098019 NO_CONS.1215 VFB_fw045786 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940622098019] [neuronbridge:flywire_fafb:720575940622098019,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
36 FlyWire:720575940603828704 AL.2761 VFB_fw045775 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940603828704] [neuronbridge:flywire_fafb:720575940603828704,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
37 FlyWire:720575940612417905 AL.2751 VFB_fw045782 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-afferent, superc... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940612417905] [fw:720575940612417905, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
38 v2LN35_R (FlyEM-HB:1733056086) v2LN35_R VFB_jrchk8ew [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [cholinergic local interneuron of the adult an... [FBbt_00007403, FBbt_20003766] [hb] [1733056086] [neuronbridge:hemibrain:1733056086, hb:1733056... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
39 FlyWire:720575940626873488 AL.2617 VFB_fw050130 [Entity, Individual, VFB, Neuron, Adult, Anato... status-outlier_bioFlyWire classification: flo... [adult olfactory receptor neuron Or23a] [FBbt_00067033] [fw] [720575940626873488] [fw:720575940626873488, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
40 FlyWire:720575940626399550 AL.2706 VFB_fw050126 [Entity, Individual, VFB, Neuron, Adult, Anato... status-outlier_segFlyWire classification: flo... [adult serotonergic neuron, adult olfactory re... [FBbt_00049526, FBbt_00067033] [fw] [720575940626399550] [neuronbridge:flywire_fafb:720575940626399550,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
41 lLN12a_R (FlyEM-HB:1826445251) lLN12a_R VFB_jrchk89g [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [cholinergic local interneuron of the adult an... [FBbt_00007403, FBbt_20003746] [hb] [1826445251] [hb:1826445251, neuronbridge:hemibrain:1826445... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
42 lLN10_R (FlyEM-HB:1825789179) lLN10_R VFB_jrchk89b [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [GABAergic local interneuron of the adult ante... [FBbt_00007402, FBbt_20003744] [hb] [1825789179] [hb:1825789179, neuronbridge:hemibrain:1825789... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
43 lLN16b_R (FlyEM-HB:1887168462) lLN16b_R VFB_jrchk89w [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe local neuron lLN16B] [FBbt_20003752] [hb] [1887168462] [neuronbridge:hemibrain:1887168462, hb:1887168... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
44 lLN11_R (FlyEM-HB:1670278227) lLN11_R VFB_jrchk89e [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe local neuron lLN11] [FBbt_20003745] [hb] [1670278227] [hb:1670278227, neuronbridge:hemibrain:1670278... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
45 lLN16a_R (FlyEM-HB:1702318692) lLN16a_R VFB_jrchk89t [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe local neuron lLN16A] [FBbt_20003751] [hb] [1702318692] [neuronbridge:hemibrain:1702318692, hb:1702318... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
46 il3LN6_R (FlyEM-HB:5813018460) il3LN6_R VFB_jrchk88v [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult serotonergic SE neuron, antennal lobe l... [FBbt_00047319, FBbt_00047710] [hb] [5813018460] [neuronbridge:hemibrain:5813018460, hb:5813018... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
47 lLN11_R (FlyEM-HB:2040301572) lLN11_R VFB_jrchk89d [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [cholinergic local interneuron of the adult an... [FBbt_00007403, FBbt_20003745] [hb] [2040301572] [neuronbridge:hemibrain:2040301572, hb:2040301... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
48 FlyWire:720575940649133945 SLP.LH.8 VFB_fw035291 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [fw] [720575940649133945] [neuronbridge:flywire_fafb:720575940649133945,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
49 FlyWire:720575940625924618 LH.158 VFB_fw035979 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA3 adPN] [FBbt_00100384] [fw] [720575940625924618] [neuronbridge:flywire_fafb:720575940625924618,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
[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_class upstream_class_id upstream_neuron_id upstream_neuron_name weight downstream_neuron_id downstream_neuron_name downstream_class downstream_class_id up_data_source up_accession down_source down_accession
0 adult superior medial protocerebrum neuron 594 FBbt_20003456 VFB_jrchk79q SMP594(SCB017)_R (FlyEM-HB:976934253) 492 VFB_jrchk70f SMP454_R (FlyEM-HB:326253554) adult superior medial protocerebrum neuron 454 FBbt_20003316 neuprint_JRC_Hemibrain_1point2point1 976934253 neuprint_JRC_Hemibrain_1point2point1 326253554
1 adult superior medial protocerebrum neuron 594 FBbt_20003456 VFB_jrchk79q SMP594(SCB017)_R (FlyEM-HB:976934253) 393 VFB_jrchjsri CL138_R (FlyEM-HB:707190304) adult clamp neuron 138 FBbt_20000843 neuprint_JRC_Hemibrain_1point2point1 976934253 neuprint_JRC_Hemibrain_1point2point1 707190304
2 adult anterior ventrolateral protocerebrum neu... FBbt_20000189 VFB_jrchjrof AVLP080_R (FlyEM-HB:5813027276) 373 VFB_jrchk4wd PVLP136_R (FlyEM-HB:5813057178) adult posterior ventrolateral protocerebrum ne... FBbt_20002194 neuprint_JRC_Hemibrain_1point2point1 5813027276 neuprint_JRC_Hemibrain_1point2point1 5813057178
3 adult anterior optic tubercle neuron 019 FBbt_20000018 VFB_jrchjrek AOTU019(ADM10)_L (FlyEM-HB:1605518663) 362 VFB_jrchk47t PS017_R (FlyEM-HB:5813069484) adult posterior slope neuron 017 FBbt_20001772 neuprint_JRC_Hemibrain_1point2point1 1605518663 neuprint_JRC_Hemibrain_1point2point1 5813069484
4 adult anterior ventrolateral protocerebrum neu... FBbt_20000185 VFB_jrchjrob AVLP076_R (FlyEM-HB:1135441187) 349 VFB_jrchk4wd PVLP136_R (FlyEM-HB:5813057178) adult posterior ventrolateral protocerebrum ne... FBbt_20002194 neuprint_JRC_Hemibrain_1point2point1 1135441187 neuprint_JRC_Hemibrain_1point2point1 5813057178
... ... ... ... ... ... ... ... ... ... ... ... ... ...
13070 adult fruitless vPR9 neuron FBbt_00111145 VFB_jrcv0bev IN00A026_T1_M (MANC:14791) 10 VFB_jrcv0abv TBD (MANC:13387) adult DNxl103 neuron FBbt_20008324 neuprint_JRC_Manc_1_2_1 14791 neuprint_JRC_Manc_1_2_1 13387
13071 adult fruitless vPR9 neuron FBbt_00111145 VFB_jrcv0bev IN00A026_T1_M (MANC:14791) 10 VFB_jrcv0abv TBD (MANC:13387) adult DNxl103 neuron FBbt_20008324 neuprint_JRC_Manc_1_2_1 14791 neuprint_JRC_Manc 13387
13072 adult fruitless vPR9 neuron FBbt_00111145 VFB_jrcv0bev IN00A026_T1_M (MANC:14791) 10 VFB_jrcv0abv TBD (MANC:13387) adult DNxl103 neuron FBbt_20008324 neuprint_JRC_Manc 14791 neuprint_JRC_Manc_1_2_1 13387
13073 adult fruitless vPR9 neuron FBbt_00111145 VFB_jrcv0bev IN00A026_T1_M (MANC:14791) 10 VFB_jrcv0abv TBD (MANC:13387) adult DNxl103 neuron FBbt_20008324 neuprint_JRC_Manc 14791 neuprint_JRC_Manc 13387
13074 adult DNxn182 neuron FBbt_20008440 VFB_jrcv090t TBD (MANC:11693) 10 VFB_jrcv097f TBD (MANC:11931) descending neuron of the posterior brain DNp34 FBbt_00047667 neuprint_JRC_Manc 11693 neuprint_JRC_Manc 11931

13075 rows × 13 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_class upstream_class_id upstream_neuron_id upstream_neuron_name weight downstream_neuron_id downstream_neuron_name downstream_class downstream_class_id up_data_source up_accession down_source down_accession
32 DN1a neuron FBbt_00007429 VFB_jrchjtex DN1a_R (FlyEM-HB:264083994) 79 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) LNd neuron FBbt_00004045 neuprint_JRC_Hemibrain_1point2point1 264083994 neuprint_JRC_Hemibrain_1point2point1 5813069648
29 DN1a neuron FBbt_00007429 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) 75 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) LNd neuron FBbt_00004045 neuprint_JRC_Hemibrain_1point2point1 5813022274 neuprint_JRC_Hemibrain_1point2point1 5813069648
26 DN1a neuron FBbt_00007429 VFB_00103owr DN1a_R (JRC_OpticLobe:14636) 67 VFB_00103m9i 5thsLNv_LNd6_R (JRC_OpticLobe:11901) LN period neuron FBbt_00004044 neuprint_JRC_OpticLobe_v1_0_1 14636 neuprint_JRC_OpticLobe_v1_0_1 11901
27 DN1a neuron FBbt_00007429 VFB_jrchjtey DN1a_R (FlyEM-HB:5813022274) 63 VFB_jrchk8e0 5th s-LNv (FlyEM-HB:511051477) adult s-LNv neuron FBbt_00007428 neuprint_JRC_Hemibrain_1point2point1 5813022274 neuprint_JRC_Hemibrain_1point2point1 511051477
25 DN1a neuron FBbt_00007429 VFB_00103owr DN1a_R (JRC_OpticLobe:14636) 57 VFB_00103m9j 5thsLNv_LNd6_R (JRC_OpticLobe:12254) LN period neuron FBbt_00004044 neuprint_JRC_OpticLobe_v1_0_1 14636 neuprint_JRC_OpticLobe_v1_0_1 12254
... ... ... ... ... ... ... ... ... ... ... ... ... ...
24 adult contralaterally-projecting DN1pD neuron FBbt_20003399 VFB_jrchk76k SMP537_R (FlyEM-HB:418641700) 10 VFB_jrchk76n SMP539_R (FlyEM-HB:357944930) adult ipsilateral DN1pD neuron FBbt_20003401 neuprint_JRC_Hemibrain_1point2point1 418641700 neuprint_JRC_Hemibrain_1point2point1 357944930
56 adult LP neuron FBbt_00007432 VFB_jrchk08a LPN_R (FlyEM-HB:450034902) 10 VFB_jrchk76e SMP532_R (FlyEM-HB:480391822) adult DN1pE neuron FBbt_20003394 neuprint_JRC_Hemibrain_1point2point1 450034902 neuprint_JRC_Hemibrain_1point2point1 480391822
22 adult DN1pC neuron FBbt_20003392 VFB_jrchk76b SMP530_R (FlyEM-HB:5813026613) 10 VFB_jrchk089 LPN_R (FlyEM-HB:480029788) adult LP neuron FBbt_00007432 neuprint_JRC_Hemibrain_1point2point1 5813026613 neuprint_JRC_Hemibrain_1point2point1 480029788
21 adult DN1pC neuron FBbt_20003392 VFB_jrchk76a SMP530_R (FlyEM-HB:389657555) 10 VFB_jrchk089 LPN_R (FlyEM-HB:480029788) adult LP neuron FBbt_00007432 neuprint_JRC_Hemibrain_1point2point1 389657555 neuprint_JRC_Hemibrain_1point2point1 480029788
50 LNd neuron FBbt_00004045 VFB_jrchjzxy LNd_R (FlyEM-HB:5813069648) 10 VFB_jrchjtf2 DN1pA_R (FlyEM-HB:387944118) ventro-contralateral-projecting DN1p neuron FBbt_00052273 neuprint_JRC_Hemibrain_1point2point1 5813069648 neuprint_JRC_Hemibrain_1point2point1 387944118

64 rows × 13 columns

[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_class upstream_class_id upstream_neuron_id upstream_neuron_name weight downstream_neuron_id downstream_neuron_name downstream_class downstream_class_id up_data_source up_accession down_source down_accession
310 lobula tangential neuron LT51 FBbt_00049861 VFB_jrchk09j LT51(aSP29a)_R (FlyEM-HB:1282348408) 319 VFB_jrchjtfr DNb01_R (FlyEM-HB:1566597156) descending neuron of the anterior ventral brai... FBbt_00047582 neuprint_JRC_Hemibrain_1point2point1 1282348408 neuprint_JRC_Hemibrain_1point2point1 1566597156
361 adult vest neuron 044 FBbt_20003510 VFB_jrchk7g6 VES044_R (FlyEM-HB:5812979017) 262 VFB_jrchk7eb VES009_R (FlyEM-HB:1140923511) adult vest neuron 009 FBbt_20003475 neuprint_JRC_Hemibrain_1point2point1 5812979017 neuprint_JRC_Hemibrain_1point2point1 1140923511
282 lobula tangential neuron LT51 FBbt_00049861 VFB_jrchk09h LT51_R (FlyEM-HB:5813069020) 238 VFB_jrchk7e7 VES006_R (FlyEM-HB:642728308) adult vest neuron 006 FBbt_20003472 neuprint_JRC_Hemibrain_1point2point1 5813069020 neuprint_JRC_Hemibrain_1point2point1 642728308
260 lobula tangential neuron FBbt_00003859 VFB_jrchk0bu LT86_R (FlyEM-HB:1285849916) 228 VFB_jrchk7g4 VES042_R (FlyEM-HB:1875284107) adult vest neuron 042 FBbt_20003508 neuprint_JRC_Hemibrain_1point2point1 1285849916 neuprint_JRC_Hemibrain_1point2point1 1875284107
335 lobula tangential neuron LT51 FBbt_00049861 VFB_jrchk09c LT51_R (FlyEM-HB:1444351896) 221 VFB_jrchjtfg DNa03_R (FlyEM-HB:1139909038) descending neuron of the anterior dorsal brain... FBbt_00047574 neuprint_JRC_Hemibrain_1point2point1 1444351896 neuprint_JRC_Hemibrain_1point2point1 1139909038
... ... ... ... ... ... ... ... ... ... ... ... ... ...
339 lobula tangential neuron LT51 FBbt_00049861 VFB_jrchk09c LT51_R (FlyEM-HB:1444351896) 10 VFB_jrchk48y PS039_R (FlyEM-HB:1963523237) adult posterior slope neuron 039 FBbt_20001794 neuprint_JRC_Hemibrain_1point2point1 1444351896 neuprint_JRC_Hemibrain_1point2point1 1963523237
1522 lobula columnar neuron LC4 FBbt_00003874 VFB_jrchjya6 LC4 (FlyEM-HB:1876894387) 10 VFB_jrchjtg6 DNp03_R (FlyEM-HB:1565846637) descending neuron of the posterior brain DNp03 FBbt_00047636 neuprint_JRC_Hemibrain_1point2point1 1876894387 neuprint_JRC_Hemibrain_1point2point1 1565846637
1045 lobula plate-lobula columnar neuron LPLC4 FBbt_00111765 VFB_jrchk07x LPLC4 (FlyEM-HB:1626232238) 10 VFB_jrchk4cb PS103_R (FlyEM-HB:5812989815) adult posterior slope neuron 103 FBbt_20001858 neuprint_JRC_Hemibrain_1point2point1 1626232238 neuprint_JRC_Hemibrain_1point2point1 5812989815
1044 lobula plate-lobula columnar neuron LPLC4 FBbt_00111765 VFB_jrchk076 LPLC4_R (FlyEM-HB:1686932677) 10 VFB_jrchk47r PS015_R (FlyEM-HB:1508274398) adult posterior slope neuron 015 FBbt_20001770 neuprint_JRC_Hemibrain_1point2point1 1686932677 neuprint_JRC_Hemibrain_1point2point1 1508274398
1362 lobula columnar neuron LC4 FBbt_00003874 VFB_jrchjyac LC4 (FlyEM-HB:5813000577) 10 VFB_jrchk4wd PVLP136_R (FlyEM-HB:5813057178) adult posterior ventrolateral protocerebrum ne... FBbt_20002194 neuprint_JRC_Hemibrain_1point2point1 5813000577 neuprint_JRC_Hemibrain_1point2point1 5813057178

1787 rows × 13 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 AVLP076_R (FlyEM-HB:1135441187) AVLP076_R VFB_jrchjrob [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult anterior ventrolateral protocerebrum ne... [FBbt_20000185] [hb] [1135441187] [neuronbridge:hemibrain:1135441187, hb:1135441... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
1 AVLP080_R (FlyEM-HB:5813027276) AVLP080_R VFB_jrchjrof [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult anterior ventrolateral protocerebrum ne... [FBbt_20000189] [hb] [5813027276] [neuronbridge:hemibrain:5813027276, hb:5813027... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
2 PLP083_R (FlyEM-HB:1719643238) PLP083_R VFB_jrchk3wg [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior later... [FBbt_00058207, FBbt_20001583] [hb] [1719643238] [neuronbridge:hemibrain:1719643238, hb:1719643... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
3 PVLP031_R (FlyEM-HB:1630342124) PVLP031_R VFB_jrchk4pd [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior ventr... [FBbt_00058207, FBbt_20002089] [hb] [1630342124] [hb:1630342124, neuronbridge:hemibrain:1630342... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
4 PVLP023_R (FlyEM-HB:1598296804) PVLP023_R VFB_jrchk4oy [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior ventr... [FBbt_00058207, FBbt_20002081] [hb] [1598296804] [hb:1598296804, neuronbridge:hemibrain:1598296... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
82 LC4 (FlyEM-HB:1877217777) LC4 VFB_jrchjya1 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1877217777] [neuronbridge:hemibrain:1877217777, hb:1877217... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
83 LC4 (FlyEM-HB:5812998136) LC4 VFB_jrchjya0 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [5812998136] [neuronbridge:hemibrain:5812998136, hb:5812998... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
84 LC4 (FlyEM-HB:1877930505) LC4 VFB_jrchjya4 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1877930505] [neuronbridge:hemibrain:1877930505, hb:1877930... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
85 LC4(lVLPT8)_R (FlyEM-HB:1876898200) LC4(lVLPT8)_R VFB_jrchjya2 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1876898200] [hb:1876898200, neuronbridge:hemibrain:1876898... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
86 LC4 (FlyEM-HB:1876471221) LC4 VFB_jrchjya7 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1876471221] [neuronbridge:hemibrain:1876471221, hb:1876471... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [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 AVLP076_R (FlyEM-HB:1135441187) AVLP076_R VFB_jrchjrob [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult anterior ventrolateral protocerebrum ne... [FBbt_20000185] [hb] [1135441187] [neuronbridge:hemibrain:1135441187, hb:1135441... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
1 AVLP080_R (FlyEM-HB:5813027276) AVLP080_R VFB_jrchjrof [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult anterior ventrolateral protocerebrum ne... [FBbt_20000189] [hb] [5813027276] [neuronbridge:hemibrain:5813027276, hb:5813027... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
2 PLP083_R (FlyEM-HB:1719643238) PLP083_R VFB_jrchk3wg [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior later... [FBbt_00058207, FBbt_20001583] [hb] [1719643238] [neuronbridge:hemibrain:1719643238, hb:1719643... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
3 PVLP031_R (FlyEM-HB:1630342124) PVLP031_R VFB_jrchk4pd [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior ventr... [FBbt_00058207, FBbt_20002089] [hb] [1630342124] [hb:1630342124, neuronbridge:hemibrain:1630342... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
4 PVLP023_R (FlyEM-HB:1598296804) PVLP023_R VFB_jrchk4oy [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult posterior ventr... [FBbt_00058207, FBbt_20002081] [hb] [1598296804] [hb:1598296804, neuronbridge:hemibrain:1598296... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
82 LC4 (FlyEM-HB:1877217777) LC4 VFB_jrchjya1 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1877217777] [neuronbridge:hemibrain:1877217777, hb:1877217... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
83 LC4 (FlyEM-HB:5812998136) LC4 VFB_jrchjya0 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [5812998136] [neuronbridge:hemibrain:5812998136, hb:5812998... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
84 LC4 (FlyEM-HB:1877930505) LC4 VFB_jrchjya4 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1877930505] [neuronbridge:hemibrain:1877930505, hb:1877930... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
85 LC4(lVLPT8)_R (FlyEM-HB:1876898200) LC4(lVLPT8)_R VFB_jrchjya2 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1876898200] [hb:1876898200, neuronbridge:hemibrain:1876898... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
86 LC4 (FlyEM-HB:1876471221) LC4 VFB_jrchjya7 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [lobula columnar neuron LC4] [FBbt_00003874] [hb] [1876471221] [neuronbridge:hemibrain:1876471221, hb:1876471... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [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'", return_dataframe=True, limit=50)
len(DA1)
DA1
Limiting to 50 terms out of 74
[13]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
0 FlyWire:720575940612526819 LH.652 VFB_fw029326 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fw] [720575940612526819] [neuronbridge:flywire_fafb:720575940612526819,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
1 FlyWire:720575940612678637 AL.LH.232 VFB_fw029809 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fw] [720575940612678637] [fw:720575940612678637, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
2 FlyWire:720575940628303607 LH.841 VFB_fw003885 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fw] [720575940628303607] [neuronbridge:flywire_fafb:720575940628303607,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
3 Uniglomerular mALT DA1 lPN#L1 (FAFB:4207871) VFB_0010126e [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fafb] [4207871] [fafb:4207871] [JRC2018Unisex] [TaiszGalili2022, BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
4 Uniglomerular mALT DA1 lPN#L6 (FAFB:2381753) VFB_0010123b [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [fafb] [2381753] [fafb:2381753] [JRC2018Unisex] [TaiszGalili2022, BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
5 Uniglomerular mlALT DA1 vPN#R1 (FAFB:1811442) VFB_0010121x [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [fafb] [1811442] [fafb:1811442] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
6 Uniglomerular mlALT DA1 vPN#L1 (FAFB:2334841) VFB_0010122m [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [fafb] [2334841] [fafb:2334841] [JRC2018Unisex] [BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
7 Uniglomerular mALT DA1 lPN#L3 (FAFB:2345089) VFB_0010122p [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [fafb] [2345089] [fafb:2345089] [JRC2018Unisex] [TaiszGalili2022, BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
8 Uniglomerular mALT DA1 lPN#L2 (FAFB:2319457) VFB_0010122k [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fafb] [2319457] [fafb:2319457] [JRC2018Unisex] [BatesSchlegel2020, TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
9 Uniglomerular mALT DA1 lPN#R2 (FAFB:57311) VFB_00101200 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [57311] [fafb:57311] [JRC2018Unisex] [BatesSchlegel2020, Zheng2018, TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
10 Uniglomerular mALT DA1 lPN#R4 (FAFB:755022) VFB_00101205 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [755022] [fafb:755022] [JRC2018Unisex] [BatesSchlegel2020, TaiszGalili2022, Zheng2018] [https://creativecommons.org/licenses/by-sa/4....
11 Uniglomerular mALT DA1 lPN#R3 (FAFB:61221) VFB_00101204 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [61221] [fafb:61221] [JRC2018Unisex] [Zheng2018, TaiszGalili2022, Baltruschat2021, ... [https://creativecommons.org/licenses/by-sa/4....
12 Uniglomerular mALT DA1 lPN#R1 (FAFB:57323) VFB_00101201 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [57323] [fafb:57323] [JRC2018Unisex] [TaiszGalili2022, Zheng2018, BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
13 Uniglomerular mALT DA1 lPN#R8 (FAFB:57381) VFB_00101203 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [57381] [fafb:57381] [JRC2018Unisex] [BatesSchlegel2020, Zheng2018, TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
14 Uniglomerular mALT DA1 lPN#R7 (FAFB:57353) VFB_00101202 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [57353] [fafb:57353] [JRC2018Unisex] [BatesSchlegel2020, Zheng2018, TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
15 Multiglomerular mALT lvPN#R46 (FAFB:57179) VFB_001011zb [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fafb] [57179] [fafb:57179] [JRC2018Unisex] [TaiszGalili2022, BatesSchlegel2020] [https://creativecommons.org/licenses/by-sa/4....
16 DA1_lPN_R (FlyEM-HB:722817260) DA1_lPN_R VFB_jrchjtda [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [722817260] [hb:722817260, neuronbridge:hemibrain:722817260] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
17 DA1_vPN_R (FlyEM-HB:733316908) DA1_vPN_R VFB_jrchjtdh [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [hb] [733316908] [hb:733316908, neuronbridge:hemibrain:733316908] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
18 DA1_lPN_R (FlyEM-HB:754538881) DA1_lPN_R VFB_jrchjtdg [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [754538881] [hb:754538881, neuronbridge:hemibrain:754538881] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
19 DA1_lPN_R (FlyEM-HB:5813039315) DA1_lPN_R VFB_jrchjtdd [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [hb] [5813039315] [hb:5813039315, neuronbridge:hemibrain:5813039... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
20 DA1_lPN_R (FlyEM-HB:1765040289) DA1_lPN_R VFB_jrchjtdc [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [1765040289] [hb:1765040289, neuronbridge:hemibrain:1765040... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
21 DA1_lPN_R (FlyEM-HB:1734350908) DA1_lPN_R VFB_jrchjtdb [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [1734350908] [neuronbridge:hemibrain:1734350908, hb:1734350... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
22 DA1_lPN_R (FlyEM-HB:754534424) DA1_lPN_R VFB_jrchjtde [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [754534424] [hb:754534424, neuronbridge:hemibrain:754534424] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
23 DA1_lPN_R (FlyEM-HB:1734350788) DA1_lPN_R VFB_jrchjtdf [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [hb] [1734350788] [hb:1734350788, neuronbridge:hemibrain:1734350... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
24 M_lvPNm45_R (FlyEM-HB:792023887) M_lvPNm45_R VFB_jrchk0xm [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [hb] [792023887] [hb:792023887, neuronbridge:hemibrain:792023887] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
25 M_lvPNm45_R (FlyEM-HB:757591093) M_lvPNm45_R VFB_jrchk0xl [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [hb] [757591093] [neuronbridge:hemibrain:757591093, hb:757591093] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
26 M_lvPNm45_R (FlyEM-HB:757258507) M_lvPNm45_R VFB_jrchk0xk [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [hb] [757258507] [neuronbridge:hemibrain:757258507, hb:757258507] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
27 FlyWire:720575940621239679 AL.MB_CA.128 VFB_fw033192 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940621239679] [fw:720575940621239679, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
28 FlyWire:720575940621185050 AL.MB_CA.135 VFB_fw033526 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [fw] [720575940621185050] [fw:720575940621185050, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
29 Uniglomerular mALT DA1 lPN#R6 (FAFB:27295) VFB_00101199 [Entity, Individual, VFB, Neuron, Adult, Anato... NaN [adult antennal lobe projection neuron DA1 lPN] [FBbt_00067363] [fafb] [27295] [fafb:27295] [JRC2018Unisex] [BatesSchlegel2020, Zheng2018, TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
30 FlyWire:720575940604407468 AL.LH.66 VFB_fw004661 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940604407468] [fw:720575940604407468, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
31 FlyWire:720575940623543881 AL.LH.83 VFB_fw004891 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [fw] [720575940623543881] [neuronbridge:flywire_fafb:720575940623543881,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
32 Gad1-F-200010 VFB_00012622 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, an... [FBbt_00048096, FBbt_00067362, FBbt_00050025, ... [FlyCircuit] [Gad1-F-200010] [FlyCircuit:Gad1-F-200010] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
33 VGlut-F-600326 VFB_00012155 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, ad... [FBbt_00048096, FBbt_00050025, FBbt_00067350, ... [FlyCircuit] [VGlut-F-600326] [FlyCircuit:VGlut-F-600326] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
34 VGlut-F-200574 VFB_00006638 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, ad... [FBbt_00048096, FBbt_00050025, FBbt_00067350, ... [FlyCircuit] [VGlut-F-200574] [FlyCircuit:VGlut-F-200574] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
35 VGlut-F-000655 VFB_00006552 [Entity, Individual, VFB, Neuron, Adult, Anato... 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] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
36 FlyWire:720575940627928911 SLP.LH.35 VFB_fw030443 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fw] [720575940627928911] [fw:720575940627928911, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
37 Gad1-F-400088 VFB_00009611 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1 vPN... [FBbt_00067372, VFBext_0000004] [FlyCircuit] [Gad1-F-400088] [FlyCircuit:Gad1-F-400088] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
38 Cha-F-500006 VFB_00010085 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, me... [FBbt_00048096, FBbt_00067350, FBbt_00050025, ... [FlyCircuit] [Cha-F-500006] [FlyCircuit:Cha-F-500006] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
39 Multiglomerular mALT lvPN#L1 (FAFB:4520197) VFB_00102dvy [Entity, Individual, VFB, Neuron, Adult, Anato... Multiglomerular mALT lvPN#L1, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fafb] [4520197] [fafb:4520197] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
40 Multiglomerular mALT lvPN#L3 (FAFB:4520615) VFB_00102dvz [Entity, Individual, VFB, Neuron, Adult, Anato... Multiglomerular mALT lvPN#L3, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fafb] [4520615] [fafb:4520615] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
41 Multiglomerular mALT lvPN#L2 (FAFB:7710838) VFB_00102dw8 [Entity, Individual, VFB, Neuron, Adult, Anato... Multiglomerular mALT lvPN#L2, FBbt:00049785 [adult antennal lobe projection neuron DA1 lvPN] [FBbt_20003824] [fafb] [7710838] [fafb:7710838] [JRC2018Unisex] [TaiszGalili2022] [https://creativecommons.org/licenses/by-sa/4....
42 fru-M-200319 VFB_00000323 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, an... [FBbt_00048096, FBbt_00067362, FBbt_00067350, ... [FlyCircuit] [fru-M-200319] [FlyCircuit:fru-M-200319] [JRC2018Unisex, adult brain template JFRC2] [Chiang2010] []
43 Cha-F-300252 VFB_00005625 [Entity, Individual, VFB, Neuron, Adult, Anato... OutAge: Adult 5~15 days [adult antennal lobe projection neuron DA1, me... [FBbt_00048096, FBbt_00067350, FBbt_00050025, ... [FlyCircuit] [Cha-F-300252] [FlyCircuit:Cha-F-300252] [adult brain template JFRC2, JRC2018Unisex] [Chiang2010] []
44 FlyWire:720575940619385765 AL.MB_CA.130 VFB_fw032945 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940619385765] [neuronbridge:flywire_fafb:720575940619385765,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
45 FlyWire:720575940603231916 AL.MB_CA.127 VFB_fw035224 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940603231916] [fw:720575940603231916, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
46 FlyWire:720575940637208718 AL.MB_CA.108 VFB_fw035057 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940637208718] [neuronbridge:flywire_fafb:720575940637208718,... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
47 FlyWire:720575940646122804 AL.LH.97 VFB_fw034164 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 vPN] [FBbt_00067372] [fw] [720575940646122804] [fw:720575940646122804, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
48 FlyWire:720575940623303108 AL.LH.84 VFB_fw034161 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult fruitless aDT-e (female) neuron, adult ... [FBbt_00110423, FBbt_00067363] [fw] [720575940623303108] [fw:720575940623303108, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
49 FlyWire:720575940617229632 AL.MB_CA.133 VFB_fw013615 [Entity, Individual, VFB, Neuron, Adult, Anato... FlyWire classification: flow-intrinsic, super... [adult antennal lobe projection neuron DA1 lPN... [FBbt_00067363, FBbt_00110423] [fw] [720575940617229632] [fw:720575940617229632, neuronbridge:flywire_f... [JRC2018Unisex] [Dorkenwald2023] [https://creativecommons.org/licenses/by-nc/4....
[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 = [int(key.split(':')[1]) for key in da1_skids.keys()]
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_jrchjtdh', 'VFB_00009611', 'VFB_00000323', 'VFB_fw013615', 'VFB_fw030443', 'VFB_00005625', 'VFB_fw033192', 'VFB_jrchjtdd', 'VFB_00012155', 'VFB_00010085', 'VFB_jrchjtdb', 'VFB_fw033526', 'VFB_00006552', 'VFB_jrchjtdf', 'VFB_fw004661', 'VFB_jrchjtdg', 'VFB_00012622', 'VFB_jrchjtdc', 'VFB_jrchjtde', 'VFB_fw032945', 'VFB_fw034161', 'VFB_fw029809', 'VFB_fw035057', 'VFB_fw029326', 'VFB_00006638', 'VFB_jrchjtda', 'VFB_jrchk0xk', 'VFB_fw004891', 'VFB_fw034164', 'VFB_fw035224', 'VFB_fw003885', 'VFB_jrchk0xl', 'VFB_jrchk0xm'}
No match found for VFB_fw029326
No match found for VFB_fw029809
No match found for VFB_fw003885
No match found for VFB_jrchjtda
No match found for VFB_jrchjtdh
No match found for VFB_jrchjtdg
No match found for VFB_jrchjtdd
No match found for VFB_jrchjtdc
No match found for VFB_jrchjtdb
No match found for VFB_jrchjtde
No match found for VFB_jrchjtdf
No match found for VFB_jrchk0xm
No match found for VFB_jrchk0xl
No match found for VFB_jrchk0xk
No match found for VFB_fw033192
No match found for VFB_fw033526
No match found for VFB_fw004661
No match found for VFB_fw004891
No match found for VFB_00012622
No match found for VFB_00012155
No match found for VFB_00006638
No match found for VFB_00006552
No match found for VFB_fw030443
No match found for VFB_00009611
No match found for VFB_00010085
No match found for VFB_00000323
No match found for VFB_00005625
No match found for VFB_fw032945
No match found for VFB_fw035224
No match found for VFB_fw035057
No match found for VFB_fw034164
No match found for VFB_fw034161
No match found for VFB_fw013615
[4207871, 2381753, 1811442, 2334841, 2345089, 2319457, 57311, 755022, 61221, 57323, 57381, 57353, 57179, 27295, 4520197, 4520615, 7710838]

Generate a connectivity table for neurons downstream of DA1 neurons

[41]:
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  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
INFO  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
INFO  : Fetching connectivity table for 17 neurons (pymaid)
INFO  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
INFO  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
INFO  : Done. Found 0 pre-, 263 postsynaptic and 0 gap junction-connected neurons (pymaid)
[41]:
neuron_name skeleton_id num_nodes relation 4207871 2381753 1811442 2334841 2345089 2319457 ... 61221 57323 57381 57353 57179 27295 4520197 4520615 7710838 total
0 Uniglomerular mlALT DA1 vPN mlALTed Milk 18114... 1811442 11769 downstream 0 0 0 0 0 0 ... 26 20 4 3 0 15 0 0 0 121
1 LHAV2a3#1 1870231 RJVR AJES PS 1870230 14820 downstream 0 0 1 0 0 0 ... 7 7 28 23 0 10 0 0 0 100
2 LHAV4c1#1 488056 downstream DA1 GSXEJ 488055 12137 downstream 0 0 0 0 0 0 ... 15 11 0 3 13 16 0 0 0 90
3 LHAV4a4#1 1911125 FML PS RJVR 1911124 6969 downstream 0 0 0 0 0 0 ... 13 15 9 6 0 5 0 0 0 86
4 Uniglomerular mlALT DA1 vPN mlALTed Milk 23348... 2334841 6362 downstream 17 32 0 0 14 22 ... 0 0 0 0 0 0 0 0 0 85

5 rows × 22 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  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
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/rcourt/GIT/VFB_connect/venv_py310/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/rcourt/GIT/VFB_connect/venv_py310/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")
              )
INFO  : Using "plotly" backend for 3D plotting. (navis)

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.2.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)
 |
 |  birthtime
 |
 |  bodyId
 |
 |  cellBodyFiber
 |
 |  class_
 |
 |  entryNerve
 |
 |  exitNerve
 |
 |  group
 |
 |  hemilineage
 |
 |  inputRois
 |
 |  instance
 |
 |  longTract
 |
 |  modality
 |
 |  origin
 |
 |  outputRois
 |
 |  predictedNt
 |
 |  rois
 |
 |  serial
 |
 |  serialMotif
 |
 |  somaNeuromere
 |
 |  somaSide
 |
 |  status
 |
 |  statusLabel
 |
 |  subclass
 |
 |  synonyms
 |
 |  systematicType
 |
 |  target
 |
 |  type
 |
 |  ----------------------------------------------------------------------
 |  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()
369 PNs found.
[22]:
bodyId instance type pre post downstream upstream mito size status cropped statusLabel cellBodyFiber somaRadius somaLocation roiInfo notes inputRois outputRois
0 294792184 M_vPNml53_R M_vPNml53 92 348 730 348 97 424947333 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 2051 285 132 344079818 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 361 1586 361 118 389682828 Traced False Roughly traced AVM06 351.5 [13823, 33925, 34176] {'SNP(R)': {'pre': 156, 'post': 95, 'downstrea... VP1l+ lvPN2 (Marin et al. Curr Biol 2020) [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 83 279 698 279 73 244229430 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 1609 58 95 266715893 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', 'VM7d_adPN',
       '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', 'DC2_adPN',
       'M_vPNml63', 'M_vPNml72', 'DL1_adPN', 'M_lvPNm38', 'D_adPN',
       'M_vPNml76', 'M_vPNml54', 'DM3_vPN', 'M_vPNml86', 'VA6_adPN',
       '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',
       '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',
       'M_lvPNm46', 'VC2_lPN', 'VM1_lPN', 'VM3_adPN', 'M_lvPNm47',
       'M_lPNm12', 'DC3_adPN', 'VP2+_adPN', 'VP1m+VP2_lvPN2',
       'VP1m+VP2_lvPN1', 'VA7m_lPN', 'M_adPNm7', 'M_adPNm4', 'VM5v_adPN',
       'VA1d_vPN', 'VA3_adPN', 'VL1_ilPN', 'M_l2PNl23', 'M_lvPNm31',
       'VP1m+VP5_ilPN', 'VL2p_adPN', 'MZ_lvPN', 'VP2_adPN', 'VA2_adPN',
       'VP5+VP2_l2PN', 'VP5+VP3_l2PN', 'VP5+_l2PN', 'M_vPNml51',
       'M_smPN6t2', 'M_lvPNm37', 'M_vPNml82', 'M_adPNm3', 'DC4_adPN',
       'VP1m_l2PN', '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'", return_dataframe=True, limit=300)
# 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 Hemibrain dataset
ALPNs=exploded_ALPNs[exploded_ALPNs['data_source'] == 'hb']
ALPNs
Limiting to 300 terms out of 2462
[24]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
20 M_lvPNm29_R (FlyEM-HB:1672293837) M_lvPNm29_R VFB_jrchk0wx [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003810] hb [1672293837] [neuronbridge:hemibrain:1672293837, hb:1672293... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
21 M_lvPNm25_R (FlyEM-HB:1411784734) M_lvPNm25_R VFB_jrchk0wr [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003806] hb [1411784734] [neuronbridge:hemibrain:1411784734, hb:1411784... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
22 M_vPNml53_R (FlyEM-HB:1570685224) M_vPNml53_R VFB_jrchk0y4 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003830] hb [1570685224] [hb:1570685224, neuronbridge:hemibrain:1570685... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
23 M_lvPNm27_R (FlyEM-HB:1670973150) M_lvPNm27_R VFB_jrchk0wv [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003808] hb [1670973150] [neuronbridge:hemibrain:1670973150, hb:1670973... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
24 M_vPNml55_R (FlyEM-HB:886812643) M_vPNml55_R VFB_jrchk0y8 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003832] hb [886812643] [hb:886812643, neuronbridge:hemibrain:886812643] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
166 M_vPNml89_R (FlyEM-HB:481268653) M_vPNml89_R VFB_jrchk0zz [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult multiglomerular... [FBbt_00058207, FBbt_20003864] hb [481268653] [hb:481268653, neuronbridge:hemibrain:481268653] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
167 M_vPNml86_R (FlyEM-HB:5813045696) M_vPNml86_R VFB_jrchk0zu [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult multiglomerular antennal lobe projectio... [FBbt_20003861] hb [5813045696] [neuronbridge:hemibrain:5813045696, hb:5813045... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
168 M_vPNml87_R (FlyEM-HB:572663539) M_vPNml87_R VFB_jrchk0zw [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult multiglomerular... [FBbt_00058207, FBbt_20003862] hb [572663539] [hb:572663539, neuronbridge:hemibrain:572663539] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
169 M_vPNml86_R (FlyEM-HB:1571025824) M_vPNml86_R VFB_jrchk0zv [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult multiglomerular... [FBbt_00058207, FBbt_20003861] hb [1571025824] [neuronbridge:hemibrain:1571025824, hb:1571025... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
170 M_vPNml88_R (FlyEM-HB:634379734) M_vPNml88_R VFB_jrchk0zy [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult GABAergic neuron, adult multiglomerular... [FBbt_00058207, FBbt_20003863] hb [634379734] [neuronbridge:hemibrain:634379734, hb:634379734] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...

151 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 1316245799 604709727 228 M_spPN4t9 LHPV10b1 M_spPN4t9_R LHPV10b1_R {'VLNP(R)': {'pre': 33, 'post': 33}, 'PLP(R)':...
1 610274029 423748579 225 M_vPNml50 LHPV10d1 M_vPNml50_R LHPV10d1_R {'INP': {'pre': 33, 'post': 33}, 'SCL(R)': {'p...
2 5812982656 732034854 224 M_smPN6t2 CL362 M_smPN6t2_L CL362(SCB033)_R {'INP': {'pre': 109, 'post': 108}, 'SCL(R)': {...
3 610274046 423748579 209 M_vPNml50 LHPV10d1 M_vPNml50_R LHPV10d1_R {'SNP(R)': {'pre': 185, 'post': 186}, 'SIP(R)'...
4 763730414 602476655 157 M_smPNm1 LHPV9b1 M_smPNm1_L LHPV9b1_R {'INP': {'pre': 89, 'post': 91}, 'SCL(R)': {'p...
... ... ... ... ... ... ... ... ...
26906 5901194556 5812980006 1 M_lvPNm37 SLP368 M_lvPNm37_R SLP368_R {'SNP(R)': {'pre': 1, 'post': 1}, 'SLP(R)': {'...
26907 5901194556 5812980884 1 M_lvPNm37 SMP339 M_lvPNm37_R SMP339_R {'SNP(R)': {'pre': 1, 'post': 1}, 'SLP(R)': {'...
26908 5901194556 5813009378 1 M_lvPNm37 SLP459 M_lvPNm37_R SLP459(SCB020)_R {'SNP(R)': {'pre': 1, 'post': 1}, 'SLP(R)': {'...
26909 5901194556 5813071319 1 M_lvPNm37 DN1pB M_lvPNm37_R DN1pB_R {'SNP(R)': {'pre': 1, 'post': 1}, 'SLP(R)': {'...
26910 5901194556 5813071384 1 M_lvPNm37 vLN26 M_lvPNm37_R vLN26_R {'AL(R)': {'pre': 1, 'post': 1}, 'AL-VP4(R)': ...

26911 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 M_lPNm11D lLN2T_a 807
1 M_vPNml50 LHPV10d1 528
2 M_lPNm11D lLN1_b 497
3 M_lPNm11D lLN2P_c 447
4 M_lPNm11D lLN1_c 333
... ... ... ...
14493 M_lvPNm28 SMP011 1
14494 M_vPNml54 LHPV6f3_b 1
14495 M_lvPNm28 SMP022 1
14496 M_lvPNm28 SMP035 1
14497 M_vPNml89 SMP010 1

14498 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'", return_dataframe=True, limit=300)
#Select only rows from Hemibrain dataset
exploded_KCs = KCs.explode('data_source')
KCs=exploded_KCs[exploded_KCs['data_source'] == 'hb']
KCs
Limiting to 300 terms out of 10296
[27]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
55 KCab-c_R (FlyEM-HB:5812981654) KCab-c_R VFB_jrchjvfs [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, mushroom body do... [FBbt_00110929, FBbt_00048138, FBbt_00058206] hb [5812981654] [hb:5812981654, neuronbridge:hemibrain:5812981... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
56 KCab-c_R (FlyEM-HB:939742503) KCab-c_R VFB_jrchjvh5 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [939742503] [neuronbridge:hemibrain:939742503, hb:939742503] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
57 KCab-c_R (FlyEM-HB:363375475) KCab-c_R VFB_jrchjvfw [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [363375475] [neuronbridge:hemibrain:363375475, hb:363375475] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
58 KCab-c_R (FlyEM-HB:5812980448) KCab-c_R VFB_jrchjvh9 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [5812980448] [neuronbridge:hemibrain:5812980448, hb:5812980... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
59 KCab-c_R (FlyEM-HB:5812980594) KCab-c_R VFB_jrchjvfu [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, mushroom body do... [FBbt_00110929, FBbt_00048138, FBbt_00058206] hb [5812980594] [neuronbridge:hemibrain:5812980594, hb:5812980... [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
... ... ... ... ... ... ... ... ... ... ... ... ... ...
257 KCab-c_R (FlyEM-HB:630373425) KCab-c_R VFB_jrchjvcf [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [630373425] [hb:630373425, neuronbridge:hemibrain:630373425] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
258 KCab-c_R (FlyEM-HB:939738473) KCab-c_R VFB_jrchjve1 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, mushroom body do... [FBbt_00110929, FBbt_00048138, FBbt_00058206] hb [939738473] [neuronbridge:hemibrain:939738473, hb:939738473] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
259 KCab-c_R (FlyEM-HB:767502579) KCab-c_R VFB_jrchjvcc [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [767502579] [hb:767502579, neuronbridge:hemibrain:767502579] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
260 KCab-c_R (FlyEM-HB:848316930) KCab-c_R VFB_jrchjvft [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, mushroom body do... [FBbt_00110929, FBbt_00048138, FBbt_00058206] hb [848316930] [hb:848316930, neuronbridge:hemibrain:848316930] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
261 KCab-c_R (FlyEM-HB:5812983133) KCab-c_R VFB_jrchjvh6 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [alpha/beta core Kenyon cell, adult dopaminerg... [FBbt_00110929, FBbt_00058206, FBbt_00048138] hb [5812983133] [neuronbridge:hemibrain:5812983133, hb:5812983... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...

187 rows × 13 columns

[28]:
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()
[28]:
bodyId_pre bodyId_post roi weight
0 1887872301 394755742 CA(R) 5
1 1887872301 425445301 CA(R) 1
2 1887872301 673715784 CA(R) 10
3 1887872301 754879354 CA(R) 3
4 1887872301 829231385 CA(R) 12
[29]:
# Group by region of interest (ROI)
by_roi = roi_info2.groupby('roi').weight.sum()
by_roi.head()
[29]:
roi
CA(R)     97
SCL(R)     7
Name: weight, dtype: int64
[30]:
ax = by_roi.plot.bar()
ax.set_xlabel('')
ax.set_ylabel('PN to KC synapses')
[30]:
Text(0, 0.5, 'PN to KC synapses')
../_images/tutorials_connectomics_45_1.png
[31]:

adj = roi_info2[roi_info2.roi == 'CA(R)'].pivot(columns="bodyId_pre", index="bodyId_post", values="weight").fillna(0)
[32]:
sns.clustermap(adj, cmap='Greys')
[32]:
<seaborn.matrix.ClusterGrid at 0x35e7f6350>
../_images/tutorials_connectomics_47_1.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).

[33]:
#First find DNs in VFB
DNs = vfb.get_instances("'adult descending neuron'", limit=300)
#Select only rows from Hemibrain dataset
exploded_DNs = DNs.explode('data_source')
DNs=exploded_DNs[exploded_DNs['data_source'] == 'hb']
DNs
Limiting to 300 terms out of 2949
[33]:
label symbol id tags description parents_label parents_id data_source accession xrefs templates dataset license
117 SMP462_R (FlyEM-HB:388975834) SMP462_R VFB_jrchk711 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 462] [FBbt_20003324] hb [388975834] [neuronbridge:hemibrain:388975834, hb:388975834] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
118 SMP462(PDM12)_L (FlyEM-HB:5813011443) SMP462(PDM12)_L VFB_jrchk712 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 462] [FBbt_20003324] hb [5813011443] [hb:5813011443, neuronbridge:hemibrain:5813011... [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
119 SMP454_R (FlyEM-HB:326253554) SMP454_R VFB_jrchk70f [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 454] [FBbt_20003316] hb [326253554] [hb:326253554, neuronbridge:hemibrain:326253554] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
120 SMP454(PDM12)_L (FlyEM-HB:328010530) SMP454(PDM12)_L VFB_jrchk70e [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 454] [FBbt_20003316] hb [328010530] [neuronbridge:hemibrain:328010530, hb:328010530] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
121 SMP478_R (FlyEM-HB:297925719) SMP478_R VFB_jrchk728 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 478] [FBbt_20003340] hb [297925719] [hb:297925719, neuronbridge:hemibrain:297925719] [JRC_FlyEM_Hemibrain, JRC2018Unisex] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
122 SMP478(PDM15)_L (FlyEM-HB:487636204) SMP478(PDM15)_L VFB_jrchk729 [Entity, Individual, VFB, Neuron, Adult, Anato... tracing status-Roughly traced, cropped-False [adult superior medial protocerebrum neuron 478] [FBbt_20003340] hb [487636204] [neuronbridge:hemibrain:487636204, hb:487636204] [JRC2018Unisex, JRC_FlyEM_Hemibrain] [Xu2020NeuronsV1point2point1] [https://creativecommons.org/licenses/by/4.0/l...
[34]:
# 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
[34]:
bodyId instance type pre post downstream upstream mito size status cropped statusLabel cellBodyFiber somaRadius somaLocation roiInfo notes inputRois outputRois
0 297925719 SMP478_R SMP478 11 514 33 514 165 892596595 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 326253554 SMP454_R SMP454 2613 9868 21858 9868 1731 8277332128 Traced False Roughly traced PDM12 465.5 [22142, 20149, 5600] {'SNP(R)': {'pre': 1374, 'post': 3670, 'downst... None [ATL(R), AVLP(R), CAN(R), CRE(-ROB,-RUB)(R), C... [AOTU(R), AVLP(R), CRE(-ROB,-RUB)(R), CRE(-RUB...
2 328010530 SMP454(PDM12)_L SMP454 3323 7850 26321 7850 1604 7640464171 Traced False Roughly traced None 504.0 [27686, 22424, 5696] {'SNP(R)': {'pre': 1726, 'post': 597, 'downstr... None [AME(R), ATL(L), AVLP(R), CRE(-ROB,-RUB)(R), C... [AME(R), ATL(L), AVLP(R), CRE(-ROB,-RUB)(R), C...
3 388975834 SMP462_R SMP462 369 3569 1965 3569 538 2344439861 Traced False Roughly traced PDM12 436.0 [21444, 17917, 9008] {'SNP(R)': {'pre': 338, 'post': 3534, 'downstr... pMP9 candidates [CRE(-ROB,-RUB)(R), CRE(R), FLA(R), INP, PENP,... [CX, FB, FBl7, FLA(R), INP, PENP, SCL(R), SIP(...
4 487636204 SMP478(PDM15)_L SMP478 15 394 80 394 145 590130050 Traced False Roughly traced None NaN None {'SNP(R)': {'pre': 10, 'post': 170, 'downstrea... pMP1 candidates [SMP(L), SMP(R), SNP(L), SNP(R)] [SMP(L), SMP(R), SNP(L), SNP(R)]
5 5813011443 SMP462(PDM12)_L SMP462 262 1738 1452 1738 419 1571626970 Traced False Roughly traced None 361.0 [30176, 18324, 10256] {'SNP(L)': {'pre': 259, 'post': 1720, 'downstr... pMP9 candidates [SIP(L), SMP(L), SMP(R), SNP(L), SNP(R), mALT(L)] [SIP(L), SMP(L), SMP(R), SNP(L), SNP(R)]

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.

[35]:
# 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
[35]:
path bodyId type weight
0 0 1672293837 M_lvPNm29 0
1 0 362041442 SIP019 22
2 0 330640044 SMP181 13
3 0 388975834 SMP462 12
4 1 1672293837 M_lvPNm29 0
5 1 392368893 LHPD2d1 11
6 1 5813020676 SMP182 13
7 1 388975834 SMP462 10
8 2 1672293837 M_lvPNm29 0
9 2 330268940 LHCENT9 13
10 2 5813049380 SIP029 14
11 2 388975834 SMP462 17
12 3 1672293837 M_lvPNm29 0
13 3 328611004 LHPV5e1 22
14 3 5813049380 SIP029 69
15 3 388975834 SMP462 17

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):

[36]:
# 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.2.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_1point2point1:' + str(id) for id in bodyIDS]
nl_terms = vfb.terms(xrefs)
nl = [term.skeleton for term in nl_terms]
nl_terms.summary
Pulling 4 terms from VFB...
Warning: Substitution made. 'ALlv1 lineage neuron' was matched to 'adult ALlv1 lineage neuron'.
Defaulting to JRC2018Unisex template
Defaulting to JRC2018Unisex template
Defaulting to JRC2018Unisex template
Defaulting to JRC2018Unisex template
[36]:
ID Name Description URL Related Terms Parents License Cross References Datasets
0 VFB_jrchk55g SIP019_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk55g [Rel(relation=MinimalEdgeInfo(label=capable of... [SIP019] CC_BY [https://neuprint.janelia.org/results?dataset=... [JRC_FlyEM_Hemibrain neurons Version 1.2.1]
1 VFB_jrchk0wx M_lvPNm29_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk0wx [Rel(relation=MinimalEdgeInfo(label=capable of... [M_lvPNm29] CC_BY [https://neuronbridge.janelia.org/search?q=hem... [JRC_FlyEM_Hemibrain neurons Version 1.2.1]
2 VFB_jrchk711 SMP462_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk711 [Rel(relation=MinimalEdgeInfo(label=capable of... [SMP462] CC_BY [https://neuronbridge.janelia.org/search?q=hem... [JRC_FlyEM_Hemibrain neurons Version 1.2.1]
3 VFB_jrchk6hw SMP181_R tracing status-Roughly traced, cropped-False https://n2t.net/vfb:VFB_jrchk6hw [Rel(relation=MinimalEdgeInfo(label=capable of... [SMP181] CC_BY [https://neuprint.janelia.org/results?dataset=... [JRC_FlyEM_Hemibrain neurons Version 1.2.1]
[37]:
# 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'])]

Pulling 3 terms from VFB...
[38]:
# 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:

[39]:
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')
[40]:
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_59_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