Connectomics
[52]:
# Install all used libraries
!pip install -r ../../../requirements.txt --quiet
!pip install ../../../ --quiet
[53]:
# Import libs and initialise API objects
from vfb_connect.cross_server_tools import VfbConnect
import pandas as pd
vc = VfbConnect()
import pymaid
import navis
navis.set_pbars(jupyter=False)
pymaid.set_pbars(jupyter=False)
# Connect to 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}')
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.
[54]:
vc.get_terms_by_xref(['Trh-F-500041'], db='FlyCircuit')
[54]:
| label | symbol | id | tags | parents_label | parents_id | data_source | accession | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Trh-F-500041 | VFB_00014110 | Entity|Adult|Anatomy|Cell|Expression_pattern_f... | adult neuron|expression pattern fragment | FBbt_00047095|VFBext_0000004 | FlyCircuit | Trh-F-500041 | FlyCircuit:Trh-F-500041 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 |
[55]:
neurons_in_DA3 = vc.get_instances("'neuron' that 'overlaps' some 'antennal lobe glomerulus DA3'")
neurons_in_DA3
Running query: FBbt:00005106 that RO:0002131 some FBbt:00003934
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00005106+that+RO%3A0002131+some+FBbt%3A00003934&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 158
[55]:
| label | symbol | id | tags | data_source | accession | parents_label | parents_id | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | ORN_DA1_R (FlyEM-HB:1703682799) | ORN_DA1_R | VFB_jrchk15e | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1703682799 | adult olfactory receptor neuron Or67d | FBbt_00067031 | neuronbridge:1703682799|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1 | ORN_DL4_R (FlyEM-HB:1671271059) | ORN_DL4_R | VFB_jrchk1km | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1671271059 | adult olfactory receptor neuron Or49a/85f | FBbt_00067055 | neuronbridge:1671271059|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 2 | ORN_DA1_R (FlyEM-HB:1735054607) | ORN_DA1_R | VFB_jrchk13v | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1735054607 | adult olfactory receptor neuron Or67d | FBbt_00067031 | neuprint_JRC_Hemibrain_1point1:1735054607|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | v2LN35_R (FlyEM-HB:1733056086) | v2LN35_R | VFB_jrchk8ew | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 1733056086 | cholinergic local interneuron of the adult ant... | FBbt_00007403|FBbt_20003766 | neuronbridge:1733056086|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 4 | lLN2T_a(Tortuous)_R (FlyEM-HB:5813032595) | lLN2T_a(Tortuous)_R | VFB_jrchk8bd | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 5813032595 | adult antennal lobe local neuron lLN2T|adult s... | FBbt_00049816|FBbt_00049526 | neuronbridge:5813032595|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 153 | ORN_DM3_L (FlyEM-HB:1543124896) | ORN_DM3_L | VFB_jrchk1qn | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1543124896 | adult olfactory receptor neuron Or47a | FBbt_00067054 | neuprint_JRC_Hemibrain_1point1:1543124896|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 154 | lLN2F_b(Full)_R (FlyEM-HB:1640909284) | lLN2F_b(Full)_R | VFB_jrchk8am | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 1640909284 | adult antennal lobe local neuron lLN2F|adult l... | FBbt_00049812|FBbt_00007394 | neuronbridge:1640909284|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 155 | ORN_DA1_L (FlyEM-HB:1671970212) | ORN_DA1_L | VFB_jrchk163 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1671970212 | adult olfactory receptor neuron Or67d | FBbt_00067031 | neuronbridge:1671970212|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 156 | ORN_DA3_R (FlyEM-HB:1703683060) | ORN_DA3_R | VFB_jrchk183 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1703683060 | adult olfactory receptor neuron Or23a | FBbt_00067033 | neuronbridge:1703683060|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 157 | lLN11_R (FlyEM-HB:1670278227) | lLN11_R | VFB_jrchk89e | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 1670278227 | adult antennal lobe local neuron lLN11 | FBbt_20003745 | neuprint_JRC_Hemibrain_1point1:1670278227|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
158 rows × 12 columns
[56]:
# Find all GABA-regic inputs onto descending neurons
vc.get_connected_neurons_by_type(upstream_type='GABAergic neuron',
downstream_type='adult descending neuron',
weight=10).sort_values('weight', ascending=False, ignore_index=True)
[56]:
| upstream_neuron_id | upstream_neuron_name | weight | downstream_neuron_id | downstream_neuron_name | upstream_class | downstream_class | up_data_source | up_accession | down_source | down_accession | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | VFB_jrchk79q | SMP594(SCB017)_R (FlyEM-HB:976934253) | 492 | VFB_jrchk70f | SMP454_R (FlyEM-HB:326253554) | adult superior medial protocerebrum neuron 594 | adult superior medial protocerebrum neuron 454 | None | None | None | None |
| 1 | VFB_jrchk79q | SMP594(SCB017)_R (FlyEM-HB:976934253) | 393 | VFB_jrchjsri | CL138_R (FlyEM-HB:707190304) | adult superior medial protocerebrum neuron 594 | adult clamp neuron 138 | None | None | None | None |
| 2 | VFB_jrchjrof | AVLP080_R (FlyEM-HB:5813027276) | 373 | VFB_jrchk4wd | PVLP136_R (FlyEM-HB:5813057178) | adult anterior ventrolateral protocerebrum neu... | adult posterior ventrolateral protocerebrum ne... | None | None | None | None |
| 3 | VFB_jrchjrek | AOTU019(ADM10)_L (FlyEM-HB:1605518663) | 362 | VFB_jrchk47t | PS017_R (FlyEM-HB:5813069484) | adult anterior optic tubercle neuron 019 | adult posterior slope neuron 017 | None | None | None | None |
| 4 | VFB_jrchjrob | AVLP076_R (FlyEM-HB:1135441187) | 349 | VFB_jrchk4wd | PVLP136_R (FlyEM-HB:5813057178) | adult anterior ventrolateral protocerebrum neu... | adult posterior ventrolateral protocerebrum ne... | None | None | None | None |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 1354 | VFB_jrchk79p | SMP593(SCB014)_R (FlyEM-HB:549282467) | 10 | VFB_jrchk4a1 | PS066(AVM08)_L (FlyEM-HB:1284675398) | adult superior medial protocerebrum neuron 593 | adult posterior slope neuron 066 | None | None | None | None |
| 1355 | VFB_jrchjrgi | AOTU053_R (FlyEM-HB:5813097142) | 10 | VFB_jrchk4a1 | PS066(AVM08)_L (FlyEM-HB:1284675398) | adult anterior optic tubercle neuron 053 | adult posterior slope neuron 066 | None | None | None | None |
| 1356 | VFB_jrchjrej | AOTU019_R (FlyEM-HB:799868224) | 10 | VFB_jrchk0ve | MDN_R (FlyEM-HB:698016469) | adult anterior optic tubercle neuron 019 | adult moonwalker descending neuron | None | None | None | None |
| 1357 | VFB_jrchjuut | IB060(PVL21)_L (FlyEM-HB:760806798) | 10 | VFB_jrchk7f7 | VES029(AVM14)_L (FlyEM-HB:1099800130) | adult inferior bridge neuron 060 | adult vest neuron 029 | None | None | None | None |
| 1358 | VFB_jrchk4yr | SAD013_R (FlyEM-HB:5813024035) | 10 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) | adult saddle neuron 013 | descending neuron of the posterior brain DNp04 | None | None | None | None |
1359 rows × 11 columns
[57]:
# Get connections between pacemaker neurons
clock_neuron_connectome = vc.get_connected_neurons_by_type(upstream_type='pacemaker neuron',
downstream_type='pacemaker neuron',
weight=10).sort_values('weight', ascending=False)
clock_neuron_connectome
[57]:
| upstream_neuron_id | upstream_neuron_name | weight | downstream_neuron_id | downstream_neuron_name | upstream_class | downstream_class | up_data_source | up_accession | down_source | down_accession | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 12 | VFB_jrchjtex | DN1a_R (FlyEM-HB:264083994) | 79 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | DN1a neuron | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 15 | VFB_jrchjtey | DN1a_R (FlyEM-HB:5813022274) | 75 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | DN1a neuron | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 25 | VFB_jrchjtey | DN1a_R (FlyEM-HB:5813022274) | 63 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | DN1a neuron | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 28 | VFB_jrchjtex | DN1a_R (FlyEM-HB:264083994) | 55 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | DN1a neuron | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 30 | VFB_jrchk089 | LPN_R (FlyEM-HB:480029788) | 43 | VFB_jrchk08a | LPN_R (FlyEM-HB:450034902) | adult LP neuron|adult dopaminergic neuron | adult LP neuron | None | None | None | None |
| 16 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | 40 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | adult cholinergic neuron|adult s-LNv neuron | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 24 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 37 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | adult cholinergic neuron|LNd neuron | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 19 | VFB_jrchjtf0 | DN1pA_R (FlyEM-HB:324846570) | 37 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | ventro-contralateral-projecting DN1p neuron|ad... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 18 | VFB_jrchjtf2 | DN1pA_R (FlyEM-HB:387944118) | 34 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 26 | VFB_jrchjtf1 | DN1pA_R (FlyEM-HB:325529237) | 33 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 13 | VFB_jrchjtf1 | DN1pA_R (FlyEM-HB:325529237) | 30 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 31 | VFB_jrchk08a | LPN_R (FlyEM-HB:450034902) | 30 | VFB_jrchk089 | LPN_R (FlyEM-HB:480029788) | adult LP neuron | adult LP neuron|adult dopaminergic neuron | None | None | None | None |
| 11 | VFB_jrchjtf3 | DN1pA_R (FlyEM-HB:387166379) | 30 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | ventro-contralateral-projecting DN1p neuron|ad... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 20 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 29 | VFB_jrchjzxw | LNd_R (FlyEM-HB:5813056917) | adult cholinergic neuron|LNd neuron | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 8 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | 25 | VFB_jrchjzxx | LNd_R (FlyEM-HB:5813021192) | adult cholinergic neuron|adult s-LNv neuron | LNd neuron | None | None | None | None |
| 29 | VFB_jrchjtf3 | DN1pA_R (FlyEM-HB:387166379) | 25 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | ventro-contralateral-projecting DN1p neuron|ad... | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 27 | VFB_jrchjtez | DN1pA_R (FlyEM-HB:5813010153) | 25 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 22 | VFB_jrchjtf0 | DN1pA_R (FlyEM-HB:324846570) | 25 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | ventro-contralateral-projecting DN1p neuron|ad... | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 23 | VFB_jrchjtf2 | DN1pA_R (FlyEM-HB:387944118) | 22 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|adult s-LNv neuron | None | None | None | None |
| 9 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 21 | VFB_jrchjzxx | LNd_R (FlyEM-HB:5813021192) | adult cholinergic neuron|LNd neuron | LNd neuron | None | None | None | None |
| 21 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | 17 | VFB_jrchjzxw | LNd_R (FlyEM-HB:5813056917) | adult cholinergic neuron|adult s-LNv neuron | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 14 | VFB_jrchjtez | DN1pA_R (FlyEM-HB:5813010153) | 15 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | adult glutamatergic neuron|ventro-contralatera... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 6 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | 14 | VFB_jrchjtf3 | DN1pA_R (FlyEM-HB:387166379) | adult cholinergic neuron|adult s-LNv neuron | ventro-contralateral-projecting DN1p neuron|ad... | None | None | None | None |
| 4 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 14 | VFB_jrchjtf1 | DN1pA_R (FlyEM-HB:325529237) | adult cholinergic neuron|LNd neuron | adult glutamatergic neuron|ventro-contralatera... | None | None | None | None |
| 7 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 13 | VFB_jrchjtf3 | DN1pA_R (FlyEM-HB:387166379) | adult cholinergic neuron|LNd neuron | ventro-contralateral-projecting DN1p neuron|ad... | None | None | None | None |
| 10 | VFB_jrchjtf0 | DN1pA_R (FlyEM-HB:324846570) | 13 | VFB_jrchjzxx | LNd_R (FlyEM-HB:5813021192) | ventro-contralateral-projecting DN1p neuron|ad... | LNd neuron | None | None | None | None |
| 3 | VFB_jrchk8e0 | 5th s-LNv (FlyEM-HB:511051477) | 12 | VFB_jrchjtf1 | DN1pA_R (FlyEM-HB:325529237) | adult cholinergic neuron|adult s-LNv neuron | adult glutamatergic neuron|ventro-contralatera... | None | None | None | None |
| 17 | VFB_jrchjtf5 | DN1pB_R (FlyEM-HB:5813071319) | 11 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | anterior-projecting DN1p neuron|adult glutamat... | adult cholinergic neuron|LNd neuron | None | None | None | None |
| 0 | VFB_jrchjtey | DN1a_R (FlyEM-HB:5813022274) | 11 | VFB_jrchjtex | DN1a_R (FlyEM-HB:264083994) | DN1a neuron | DN1a neuron | None | None | None | None |
| 1 | VFB_jrchjtex | DN1a_R (FlyEM-HB:264083994) | 10 | VFB_jrchjtey | DN1a_R (FlyEM-HB:5813022274) | DN1a neuron | DN1a neuron | None | None | None | None |
| 5 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 10 | VFB_jrchjtez | DN1pA_R (FlyEM-HB:5813010153) | adult cholinergic neuron|LNd neuron | adult glutamatergic neuron|ventro-contralatera... | None | None | None | None |
| 2 | VFB_jrchjzxy | LNd_R (FlyEM-HB:5813069648) | 10 | VFB_jrchjtf2 | DN1pA_R (FlyEM-HB:387944118) | adult cholinergic neuron|LNd neuron | adult glutamatergic neuron|ventro-contralatera... | None | None | None | None |
[58]:
# Get connections between visual projectsion neurons and descending neurons
visPN2DC = vc.get_connected_neurons_by_type(upstream_type='visual projection neuron',
downstream_type='adult descending neuron',
weight=10).sort_values('weight', ascending=False)
visPN2DC
[58]:
| upstream_neuron_id | upstream_neuron_name | weight | downstream_neuron_id | downstream_neuron_name | upstream_class | downstream_class | up_data_source | up_accession | down_source | down_accession | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1701 | VFB_jrchk09j | LT51(aSP29a)_R (FlyEM-HB:1282348408) | 319 | VFB_jrchjtfr | DNb01_R (FlyEM-HB:1566597156) | adult glutamatergic neuron|lobula tangential n... | descending neuron of the anterior ventral brai... | None | None | None | None |
| 53 | VFB_jrchk7g6 | VES044_R (FlyEM-HB:5812979017) | 262 | VFB_jrchk7eb | VES009_R (FlyEM-HB:1140923511) | adult vest neuron 044 | adult vest neuron 009 | None | None | None | None |
| 1332 | VFB_jrchk09h | LT51_R (FlyEM-HB:5813069020) | 238 | VFB_jrchk7e7 | VES006_R (FlyEM-HB:642728308) | lobula tangential neuron LT51|adult glutamater... | adult vest neuron 006 | None | None | None | None |
| 1668 | VFB_jrchk0bu | LT86_R (FlyEM-HB:1285849916) | 228 | VFB_jrchk7g4 | VES042_R (FlyEM-HB:1875284107) | lobula tangential neuron|adult cholinergic neuron | adult vest neuron 042 | None | None | None | None |
| 11 | VFB_jrchk09c | LT51_R (FlyEM-HB:1444351896) | 221 | VFB_jrchjtfg | DNa03_R (FlyEM-HB:1139909038) | adult glutamatergic neuron|lobula tangential n... | descending neuron of the anterior dorsal brain... | None | None | None | None |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 1026 | VFB_jrchjzoi | LLPC2a (FlyEM-HB:5813039328) | 10 | VFB_jrchjtfo | DNa10_R (FlyEM-HB:707116522) | lobula-lobula plate columnar neuron LLPC | descending neuron of the posterior brain DNp10 | None | None | None | None |
| 1020 | VFB_jrchjwwh | LC10 (FlyEM-HB:5813016041) | 10 | VFB_jrchjtfo | DNa10_R (FlyEM-HB:707116522) | adult cholinergic neuron|lobula columnar neuro... | descending neuron of the posterior brain DNp10 | None | None | None | None |
| 1019 | VFB_jrchjzul | LLPC3 (FlyEM-HB:1777956777) | 10 | VFB_jrchjtfo | DNa10_R (FlyEM-HB:707116522) | lobula-lobula plate columnar neuron LLPC | descending neuron of the posterior brain DNp10 | None | None | None | None |
| 1014 | VFB_jrchjy7z | LC35_R (FlyEM-HB:1502364155) | 10 | VFB_jrchjtge | DNp10_R (FlyEM-HB:5813026936) | lobula columnar neuron|adult cholinergic neuron | descending neuron of the posterior brain DNp10 | None | None | None | None |
| 1706 | VFB_jrchjuts | IB043_R (FlyEM-HB:883514695) | 10 | VFB_jrchjtfr | DNb01_R (FlyEM-HB:1566597156) | adult inferior bridge neuron 043 | descending neuron of the anterior ventral brai... | None | None | None | None |
1707 rows × 11 columns
[59]:
visPN2DC['upstream_class'].value_counts(normalize=True).plot(kind = 'bar') # Excercise - sum up weights for each type. Note - some types here subsume others
[59]:
<Axes: xlabel='upstream_class'>
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.
[60]:
# Starting point - let's take one of the individual descending neurons from
# the previous exploratory queries and look for other inputs
upstream_of_DNp04 = vc.get_neurons_upstream_of('DNp04_R (FlyEM-HB:1405231475)', weight = 20)
upstream_of_DNp04
[60]:
| query_neuron_id | query_neuron_name | weight | target_neuron_id | target_neuron_name | |
|---|---|---|---|---|---|
| 0 | VFB_jrchjy98 | LC4 (FlyEM-HB:1749258134) | 56 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 1 | VFB_jrchk4qn | PVLP046_R (FlyEM-HB:1600666632) | 48 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 2 | VFB_jrchjy9t | LC4 (FlyEM-HB:2215161310) | 86 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 3 | VFB_jrchjya4 | LC4 (FlyEM-HB:1877930505) | 76 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 4 | VFB_jrchk4u3 | PVLP100_R (FlyEM-HB:1375845363) | 44 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| ... | ... | ... | ... | ... | ... |
| 82 | VFB_jrchjya3 | LC4 (FlyEM-HB:1907519001) | 75 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 83 | VFB_jrchjy9i | LC4 (FlyEM-HB:5813069053) | 48 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 84 | VFB_jrchjyaa | LC4 (FlyEM-HB:1906159299) | 82 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 85 | VFB_jrchjy95 | LC4 (FlyEM-HB:1471601440) | 41 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
| 86 | VFB_jrchjy9d | LC4 (FlyEM-HB:1627117134) | 46 | VFB_jrchjtg7 | DNp04_R (FlyEM-HB:1405231475) |
87 rows × 5 columns
[61]:
vc.get_TermInfo(upstream_of_DNp04['query_neuron_id'])
[61]:
| label | symbol | id | tags | parents_label | parents_id | data_source | accession | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | LC4 (FlyEM-HB:1625080038) | LC4 | VFB_jrchjy9e | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1625080038 | neuprint_JRC_Hemibrain_1point1:1625080038|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1 | LC4 (FlyEM-HB:1782668028) | LC4 | VFB_jrchjy9o | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1782668028 | neuronbridge:1782668028|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 2 | LC4 (FlyEM-HB:1874035952) | LC4 | VFB_jrchjy9z | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1874035952 | neuprint_JRC_Hemibrain_1point1:1874035952|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | LC4 (FlyEM-HB:1810956698) | LC4 | VFB_jrchjy9j | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1810956698 | neuprint_JRC_Hemibrain_1point1:1810956698|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 4 | LC4 (FlyEM-HB:1158187240) | LC4 | VFB_jrchjy8t | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1158187240 | neuronbridge:1158187240|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 82 | PVLP142_R (FlyEM-HB:1876565477) | PVLP142_R | VFB_jrchk4wk | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | adult cholinergic neuron|adult posterior ventr... | FBbt_00058205|FBbt_20002200 | neuprint_JRC_Hemibrain_1point1 | 1876565477 | neuronbridge:1876565477|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 83 | PVLP151(SCB004)_L (FlyEM-HB:1628973439) | PVLP151(SCB004)_L | VFB_jrchk4x2 | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002209 | neuprint_JRC_Hemibrain_1point1 | 1628973439 | neuronbridge:1628973439|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 84 | PVLP100_R (FlyEM-HB:1375845363) | PVLP100_R | VFB_jrchk4u3 | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002158 | neuprint_JRC_Hemibrain_1point1 | 1375845363 | neuronbridge:1375845363|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 85 | PVLP094_R (FlyEM-HB:1503733177) | PVLP094_R | VFB_jrchk4tm | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002152 | neuprint_JRC_Hemibrain_1point1 | 1503733177 | neuprint_JRC_Hemibrain_1point1:1503733177|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 86 | LPLC2_R (FlyEM-HB:5813034151) | LPLC2_R | VFB_jrchk063 | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | lobula plate-lobula columnar neuron LPLC2 | FBbt_00111763 | neuprint_JRC_Hemibrain_1point1 | 5813034151 | neuronbridge:5813034151|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
87 rows × 12 columns
[62]:
vc.get_TermInfo(upstream_of_DNp04['query_neuron_id'])
[62]:
| label | symbol | id | tags | parents_label | parents_id | data_source | accession | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | LPLC2_R (FlyEM-HB:5813034151) | LPLC2_R | VFB_jrchk063 | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | lobula plate-lobula columnar neuron LPLC2 | FBbt_00111763 | neuprint_JRC_Hemibrain_1point1 | 5813034151 | neuronbridge:5813034151|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1 | LC4 (FlyEM-HB:1625080038) | LC4 | VFB_jrchjy9e | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1625080038 | neuprint_JRC_Hemibrain_1point1:1625080038|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 2 | LC4 (FlyEM-HB:1782668028) | LC4 | VFB_jrchjy9o | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1782668028 | neuronbridge:1782668028|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | LC4 (FlyEM-HB:1874035952) | LC4 | VFB_jrchjy9z | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1874035952 | neuprint_JRC_Hemibrain_1point1:1874035952|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 4 | LC4 (FlyEM-HB:1810956698) | LC4 | VFB_jrchjy9j | Entity|Adult|Anatomy|Cell|Cholinergic|Glutamat... | lobula columnar neuron LC4 | FBbt_00003874 | neuprint_JRC_Hemibrain_1point1 | 1810956698 | neuprint_JRC_Hemibrain_1point1:1810956698|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 82 | SAD017_R (FlyEM-HB:1630678915) | SAD017_R | VFB_jrchk4z0 | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | adult saddle neuron 017 | FBbt_20002226 | neuprint_JRC_Hemibrain_1point1 | 1630678915 | neuronbridge:1630678915|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 83 | PVLP142_R (FlyEM-HB:1876565477) | PVLP142_R | VFB_jrchk4wk | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | adult cholinergic neuron|adult posterior ventr... | FBbt_00058205|FBbt_20002200 | neuprint_JRC_Hemibrain_1point1 | 1876565477 | neuronbridge:1876565477|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 84 | PVLP151(SCB004)_L (FlyEM-HB:1628973439) | PVLP151(SCB004)_L | VFB_jrchk4x2 | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002209 | neuprint_JRC_Hemibrain_1point1 | 1628973439 | neuronbridge:1628973439|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 85 | PVLP100_R (FlyEM-HB:1375845363) | PVLP100_R | VFB_jrchk4u3 | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002158 | neuprint_JRC_Hemibrain_1point1 | 1375845363 | neuronbridge:1375845363|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 86 | PVLP094_R (FlyEM-HB:1503733177) | PVLP094_R | VFB_jrchk4tm | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | adult posterior ventrolateral protocerebrum ne... | FBbt_20002152 | neuprint_JRC_Hemibrain_1point1 | 1503733177 | neuprint_JRC_Hemibrain_1point1:1503733177|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
87 rows × 12 columns
Let’s try a similar query from one of the LC4 neurons to see what other descending neuron types are downstream of it.
[63]:
vc.get_neurons_downstream_of('LC4 (FlyEM-HB:1249932198)', classification="'adult descending neuron'", weight = 10)
Running query: FBbt:00047511
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00047511&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 297
[63]:
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.
[64]:
# Using VFB to get neurons by type
DA1 = vc.get_instances("'adult antennal lobe projection neuron DA1'")
len(DA1)
DA1
Running query: FBbt:00048096
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00048096&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 52
[64]:
| label | symbol | id | tags | data_source | accession | parents_label | parents_id | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Multiglomerular mALT lvPN#L3 (FAFB:4520615) | VFB_00102dvz | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 4520615 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:4520615 | JRC2018Unisex | TaiszGalili2022 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 1 | Uniglomerular mALT DA1 lPN#L1 (FAFB:4207871) | VFB_0010126e | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 4207871 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | catmaid_fafb:4207871 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 2 | DA1_lPN_R (FlyEM-HB:5813039315) | DA1_lPN_R | VFB_jrchjtdd | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 5813039315 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | neuronbridge:5813039315|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | VGlut-F-200574 | VFB_00006638 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-200574 | medial antennal lobe tract projection neuron|e... | FBbt_00067350|VFBext_0000004|FBbt_00048096|FBb... | FlyCircuit:VGlut-F-200574 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 4 | Multiglomerular mALT lvPN#R45 (FAFB:57035) | VFB_001011z3 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57035 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:57035 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 5 | fru-F-400149 | VFB_00006344 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | fru-F-400149 | medial antennal lobe tract projection neuron|e... | FBbt_00067350|VFBext_0000004|FBbt_00048096|FBb... | FlyCircuit:fru-F-400149 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 6 | Uniglomerular mALT DA1 lPN#R4 (FAFB:755022) | VFB_00101205 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 755022 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:755022 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 7 | Gad1-F-200064 | VFB_00011249 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | Gad1-F-200064 | antennal lobe projection neuron of ALl1 lineag... | FBbt_00067362|FBbt_00048096|FBbt_00050025|FBbt... | FlyCircuit:Gad1-F-200064 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 8 | Gad1-F-200010 | VFB_00012622 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | Gad1-F-200010 | adult antennal lobe projection neuron DA1|adul... | FBbt_00048096|FBbt_00050025|FBbt_00067362|FBbt... | FlyCircuit:Gad1-F-200010 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 9 | Multiglomerular mALT lvPN#R46 (FAFB:57179) | VFB_001011zb | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57179 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:57179 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 10 | npf-M-300006 | VFB_00001755 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | npf-M-300006 | medial antennal lobe tract projection neuron|a... | FBbt_00067350|FBbt_00067362|FBbt_00050025|FBbt... | FlyCircuit:npf-M-300006 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 11 | VGlut-F-700040 | VFB_00013061 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-700040 | expression pattern fragment|adult antennal lob... | VFBext_0000004|FBbt_00048096|FBbt_00067362|FBb... | FlyCircuit:VGlut-F-700040 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 12 | Multiglomerular mALT lvPN#R44 (FAFB:57158) | VFB_001011z9 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57158 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:57158 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 13 | VGlut-F-000280 | VFB_00010758 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-000280 | adult antennal lobe projection neuron DA1|medi... | FBbt_00048096|FBbt_00067350|FBbt_00067362|FBbt... | FlyCircuit:VGlut-F-000280 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 14 | DA1_lPN_R (FlyEM-HB:1734350908) | DA1_lPN_R | VFB_jrchjtdb | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1734350908 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | neuprint_JRC_Hemibrain_1point1:1734350908|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 15 | Uniglomerular mALT DA1 lPN#L6 (FAFB:2381753) | VFB_0010123b | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2381753 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | catmaid_fafb:2381753 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 16 | Uniglomerular mALT DA1 lPN#L3 (FAFB:2345089) | VFB_0010122p | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2345089 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | catmaid_fafb:2345089 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 17 | Uniglomerular mALT DA1 lPN#R7 (FAFB:57353) | VFB_00101202 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57353 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:57353 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 18 | DA1_lPN_R (FlyEM-HB:754534424) | DA1_lPN_R | VFB_jrchjtde | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 754534424 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | neuronbridge:754534424|neuprint_JRC_Hemibrain_... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 19 | Multiglomerular mALT lvPN#L2 (FAFB:7710838) | VFB_00102dw8 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 7710838 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:7710838 | JRC2018Unisex | TaiszGalili2022 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 20 | DA1_vPN_R (FlyEM-HB:733316908) | DA1_vPN_R | VFB_jrchjtdh | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 733316908 | adult antennal lobe projection neuron DA1 vPN | FBbt_00067372 | neuronbridge:733316908|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 21 | Gad1-F-400088 | VFB_00009611 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | Gad1-F-400088 | expression pattern fragment|adult antennal lob... | VFBext_0000004|FBbt_00067372 | FlyCircuit:Gad1-F-400088 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 22 | Uniglomerular mlALT DA1 vPN#L1 (FAFB:2334841) | VFB_0010122m | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2334841 | adult antennal lobe projection neuron DA1 vPN | FBbt_00067372 | catmaid_fafb:2334841 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 23 | M_lvPNm45_R (FlyEM-HB:792023887) | M_lvPNm45_R | VFB_jrchk0xm | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 792023887 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | neuronbridge:792023887|neuprint_JRC_Hemibrain_... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 24 | Uniglomerular mALT DA1 lPN#R1 (FAFB:57323) | VFB_00101201 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57323 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:57323 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 25 | VGlut-F-800329 | VFB_00005957 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-800329 | antennal lobe projection neuron of ALl1 lineag... | FBbt_00067362|FBbt_00067350|VFBext_0000004|FBb... | FlyCircuit:VGlut-F-800329 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 26 | DA1_lPN_R (FlyEM-HB:1765040289) | DA1_lPN_R | VFB_jrchjtdc | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1765040289 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | neuronbridge:1765040289|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 27 | Uniglomerular mALT DA1 lPN#L2 (FAFB:2319457) | VFB_0010122k | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2319457 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | catmaid_fafb:2319457 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 28 | Uniglomerular mALT DA1 lPN#L7 (FAFB:3239781) | VFB_0010124l | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 3239781 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | catmaid_fafb:3239781 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 29 | Uniglomerular mALT DA1 lPN#L5 (FAFB:2380564) | VFB_0010122z | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2380564 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | catmaid_fafb:2380564 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 30 | DA1_lPN_R (FlyEM-HB:722817260) | DA1_lPN_R | VFB_jrchjtda | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 722817260 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | neuprint_JRC_Hemibrain_1point1:722817260|neuro... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 31 | Cha-F-300252 | VFB_00005625 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | Cha-F-300252 | expression pattern fragment|adult ALl1 lineage... | VFBext_0000004|FBbt_00050025|FBbt_00067350|FBb... | FlyCircuit:Cha-F-300252 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 32 | Uniglomerular mALT DA1 lPN#R3 (FAFB:61221) | VFB_00101204 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 61221 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:61221 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 33 | M_lvPNm45_R (FlyEM-HB:757591093) | M_lvPNm45_R | VFB_jrchk0xl | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 757591093 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | neuprint_JRC_Hemibrain_1point1:757591093|neuro... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 34 | DA1_lPN_R (FlyEM-HB:1734350788) | DA1_lPN_R | VFB_jrchjtdf | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1734350788 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | neuprint_JRC_Hemibrain_1point1:1734350788|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 35 | Uniglomerular mALT DA1 lPN#R2 (FAFB:57311) | VFB_00101200 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57311 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:57311 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 36 | DA1_lPN_R (FlyEM-HB:754538881) | DA1_lPN_R | VFB_jrchjtdg | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 754538881 | adult fruitless aDT-e (female) neuron|adult an... | FBbt_00110423|FBbt_00067363 | neuronbridge:754538881|neuprint_JRC_Hemibrain_... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 37 | M_lvPNm45_R (FlyEM-HB:757258507) | M_lvPNm45_R | VFB_jrchk0xk | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 757258507 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | neuprint_JRC_Hemibrain_1point1:757258507|neuro... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 38 | Multiglomerular mALT lvPN#L1 (FAFB:4520197) | VFB_00102dvy | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 4520197 | adult antennal lobe projection neuron DA1 lvPN | FBbt_20003824 | catmaid_fafb:4520197 | JRC2018Unisex | TaiszGalili2022 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 39 | VGlut-F-600450 | VFB_00010984 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-600450 | medial antennal lobe tract projection neuron|a... | FBbt_00067350|FBbt_00048096|FBbt_00067362|VFBe... | FlyCircuit:VGlut-F-600450 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 40 | VGlut-F-800317 | VFB_00005913 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-800317 | antennal lobe projection neuron of ALl1 lineag... | FBbt_00067362|VFBext_0000004|FBbt_00050025|FBb... | FlyCircuit:VGlut-F-800317 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 41 | Uniglomerular mlALT DA1 vPN#R1 (FAFB:1811442) | VFB_0010121x | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 1811442 | adult antennal lobe projection neuron DA1 vPN | FBbt_00067372 | catmaid_fafb:1811442 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 42 | Cha-F-500006 | VFB_00010085 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | Cha-F-500006 | adult ALl1 lineage neuron|expression pattern f... | FBbt_00050025|VFBext_0000004|FBbt_00048096|FBb... | FlyCircuit:Cha-F-500006 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 43 | VGlut-F-600326 | VFB_00012155 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-600326 | expression pattern fragment|medial antennal lo... | VFBext_0000004|FBbt_00067350|FBbt_00050025|FBb... | FlyCircuit:VGlut-F-600326 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 44 | Uniglomerular mALT DA1 lPN#R5 (FAFB:2863104) | VFB_0010124e | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2863104 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | catmaid_fafb:2863104 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 45 | VGlut-F-000655 | VFB_00006552 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-000655 | adult antennal lobe projection neuron DA1|adul... | FBbt_00048096|FBbt_00050025|FBbt_00067362|FBbt... | FlyCircuit:VGlut-F-000655 | adult brain template JFRC2|JRC2018Unisex | Chiang2010 | ||
| 46 | Uniglomerular mALT DA1 lPN#L4 (FAFB:2379517) | VFB_0010122y | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 2379517 | adult antennal lobe projection neuron DA1 lPN|... | FBbt_00067363|FBbt_00110423 | catmaid_fafb:2379517 | JRC2018Unisex | BatesSchlegel2020 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 47 | VGlut-F-700188 | VFB_00010912 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | VGlut-F-700188 | antennal lobe projection neuron of ALl1 lineag... | FBbt_00067362|FBbt_00050025|FBbt_00048096|VFBe... | FlyCircuit:VGlut-F-700188 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 48 | fru-M-200319 | VFB_00000323 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | FlyCircuit | fru-M-200319 | antennal lobe projection neuron of ALl1 lineag... | FBbt_00067362|FBbt_00067350|VFBext_0000004|FBb... | FlyCircuit:fru-M-200319 | JRC2018Unisex|adult brain template JFRC2 | Chiang2010 | ||
| 49 | Uniglomerular mALT DA1 lPN#R6 (FAFB:27295) | VFB_00101199 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 27295 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:27295 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... | |
| 50 | Uniglomerular mALT DA1 lPN#R8 (FAFB:57381) | VFB_00101203 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | catmaid_fafb | 57381 | adult antennal lobe projection neuron DA1 lPN | FBbt_00067363 | catmaid_fafb:57381 | JRC2018Unisex | Zheng2018 | https://creativecommons.org/licenses/by-sa/4.0... |
[65]:
# Map neurons to CATMAID Skeleton IDs (skids)
da1_skids = vc.vfb_id_2_xrefs(DA1['id'], db='catmaid_fafb', reverse_return=True)
da1_skids_int = list(map(int, da1_skids))
da1_skids_int
/usr/local/anaconda3/lib/python3.10/site-packages/vfb_connect/neo/query_wrapper.py:411: UserWarning:
The following IDs do not match DB &/or id_type constraints: {'VFB_00010984', 'VFB_0010126e', 'VFB_0010122z', 'VFB_00005957', 'VFB_00101200', 'VFB_jrchjtdg', 'VFB_00101199', 'VFB_00013061', 'VFB_001011z9', 'VFB_00102dvz', 'VFB_jrchjtdd', 'VFB_00012155', 'VFB_00005625', 'VFB_00006344', 'VFB_jrchjtda', 'VFB_00001755', 'VFB_jrchjtdf', 'VFB_0010122y', 'VFB_00102dvy', 'VFB_00101205', 'VFB_00101204', 'VFB_jrchk0xm', 'VFB_00006638', 'VFB_00010085', 'VFB_00000323', 'VFB_0010123b', 'VFB_00101203', 'VFB_00012622', 'VFB_0010124e', 'VFB_jrchjtdh', 'VFB_00009611', 'VFB_jrchk0xl', 'VFB_00005913', 'VFB_0010122m', 'VFB_jrchjtdb', 'VFB_jrchk0xk', 'VFB_001011zb', 'VFB_0010122k', 'VFB_00010758', 'VFB_00102dw8', 'VFB_jrchjtdc', 'VFB_0010121x', 'VFB_00010912', 'VFB_00101201', 'VFB_00101202', 'VFB_0010122p', 'VFB_jrchjtde', 'VFB_00006552', 'VFB_001011z3', 'VFB_00011249', 'VFB_0010124l'}
[65]:
[2381753,
7710838,
4520197,
57179,
2379517,
3239781,
57158,
57035,
2345089,
57311,
27295,
2380564,
2319457,
4520615,
57323,
2334841,
755022,
1811442,
61221,
57353,
4207871,
57381,
2863104]
Generate a connectivity table for neurons downstream of DA1 neurons
[66]:
da1 = pymaid.get_neurons(da1_skids_int)
da1_ds = pymaid.get_partners(da1_skids_int,
threshold=3, # anything with >= 3 synapses
directions=['outgoing'] # downstream partners only
)
# Result is a pandas DataFrame
da1_ds.head()
INFO : Fetching connectivity table for 23 neurons (pymaid)
INFO : Done. Found 0 pre-, 301 postsynaptic and 0 gap junction-connected neurons (pymaid)
[66]:
| neuron_name | skeleton_id | num_nodes | relation | 2381753 | 7710838 | 4520197 | 57179 | 2379517 | 3239781 | ... | 57323 | 2334841 | 755022 | 1811442 | 61221 | 57353 | 4207871 | 57381 | 2863104 | total | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Uniglomerular mlALT DA1 vPN mlALTed Milk 18114... | 1811442 | 11769 | downstream | 0 | 0 | 0 | 0 | 0 | 0 | ... | 20 | 0 | 32 | 0 | 26 | 3 | 0 | 4 | 30 | 152 |
| 1 | Uniglomerular mlALT DA1 vPN mlALTed Milk 23348... | 2334841 | 6362 | downstream | 32 | 0 | 0 | 0 | 28 | 26 | ... | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 0 | 0 | 139 |
| 2 | LHAV4c1#1 488056 downstream DA1 GSXEJ | 488055 | 12137 | downstream | 0 | 0 | 0 | 13 | 0 | 0 | ... | 11 | 0 | 15 | 0 | 15 | 3 | 0 | 0 | 15 | 111 |
| 3 | LHAV4a4#1 1911125 FML PS RJVR | 1911124 | 6969 | downstream | 0 | 0 | 0 | 0 | 0 | 0 | ... | 15 | 0 | 19 | 0 | 13 | 6 | 0 | 9 | 23 | 109 |
| 4 | LHAV2a3#1 1870231 RJVR AJES PS | 1870230 | 14820 | downstream | 0 | 0 | 0 | 0 | 0 | 0 | ... | 7 | 0 | 19 | 1 | 7 | 23 | 0 | 28 | 5 | 105 |
5 rows × 28 columns
[67]:
# Get an adjacency matrix between all Bates, Schlegel et al. neurons
bates = pymaid.find_neurons(annotations='Paper: Bates and Schlegel et al 2020')
adj = pymaid.adjacency_matrix(bates)
adj.head()
INFO : Found 584 neurons matching the search parameters (pymaid)
[67]:
| 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
[68]:
import seaborn as sns
ax = sns.clustermap(adj, vmax=10, cmap='Greys')
# ax = sns.heatmap(adj, vmax=10, cmap='Greys')
/usr/local/anaconda3/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:
Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
/usr/local/anaconda3/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:
Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
[69]:
# Axo-axonic connections between two different types of DA1 PNs
cn = pymaid.get_connectors_between(2863104, 1811442)
cn.head()
[69]:
| 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] |
[70]:
import numpy as np
points = np.vstack(cn.connector_loc)
navis.plot3d([da1.idx[[1811442, 57353]], # plot the two neurons
points], # plot the points of synaptic contacts as scatter
scatter_kws=dict(name="synaptic contacts")
)
Data type cannot be displayed: application/vnd.plotly.v1+json
neuprint connectivity queries
To programmatically interface with neuprint, we will use neuprint-python (link). It requires an API token which you can get via the website and is bound to the Google account that you use to log into neuprint. For this workshop we provide such a token as environment variable but you will need to start using your own token after the workshop is over.
These examples use the hemibrain v1.1 dataset.
neuprint-python
First we have to initialize the connection.
[71]:
!pip install neuprint-python --quiet
import neuprint as neu
client = neu.Client('https://neuprint.janelia.org',
dataset='hemibrain:v1.1',
token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InZmYndvcmtzaG9wLm5ldXJvZmx5MjAyMEBnbWFpbC5jb20iLCJsZXZlbCI6Im5vYXV0aCIsImltYWdlLXVybCI6Imh0dHBzOi8vbGg2Lmdvb2dsZXVzZXJjb250ZW50LmNvbS8tWXFDN21NRXd3TlEvQUFBQUFBQUFBQUkvQUFBQUFBQUFBQUEvQU1adXVjbU5zaXhXZDRhM0VyTTQ0ODBMa2IzNDdvUlpfUS9zOTYtYy9waG90by5qcGc_c3o9NTA_c3o9NTAiLCJleHAiOjE3OTQwOTE4ODd9.ceg4mrj2o-aOhK0NHNGmBacg8R34PBPoLBwhCo4uOCQ')
Most functions in neuprint-python accept neu.NeuronCriteria which is effectively a filter for body IDs, types, cellbody fibers (~lineages), etc:
[72]:
help(neu.NeuronCriteria)
Help on class NeuronCriteria in module neuprint.queries.neuroncriteria:
class NeuronCriteria(builtins.object)
| NeuronCriteria(matchvar='n', *, bodyId=None, type=None, instance=None, regex='guess', status=None, statusLabel=None, rois=None, inputRois=None, outputRois=None, roi_req='all', min_roi_inputs=1, min_roi_outputs=1, group=None, serial=None, cropped=None, birthtime=None, cellBodyFiber=None, class_=None, entryNerve=None, exitNerve=None, hemilineage=None, longTract=None, modality=None, origin=None, predictedNt=None, serialMotif=None, somaNeuromere=None, somaSide=None, subclass=None, synonyms=None, systematicType=None, target=None, label=None, min_pre=0, min_post=0, somaLocation=None, tosomaLocation=None, rootLocation=None, soma=None, client=None)
|
| Neuron selection criteria.
|
| Specifies which fields to filter by when searching for a Neuron (or Segment).
| This class does not send queries itself, but you use it to specify search
| criteria for various query functions.
|
| Note:
| For simple queries involving only particular bodyId(s) or type(s)/instance(s),
| you can usually just pass the ``bodyId`` or ``type`` to the query function,
| without constructing a full ``NeuronCriteria``.
|
| .. code-block:: python
|
| from neuprint import fetch_neurons, NeuronCriteria as NC
|
| # Equivalent
| neuron_df, conn_df = fetch_neurons(NC(bodyId=329566174))
| neuron_df, conn_df = fetch_neurons(329566174)
|
| # Equivalent
| # (Criteria is satisfied if either type or instance matches.)
| neuron_df, conn_df = fetch_neurons(NC(type="OA-VPM3", instance="OA-VPM3"))
| neuron_df, conn_df = fetch_neurons("OA-VPM3")
|
| Methods defined here:
|
| __eq__(self, value)
| Implement comparison between criteria.
| Note: 'matchvar' is not considered during the comparison.
|
| __init__(self, matchvar='n', *, bodyId=None, type=None, instance=None, regex='guess', status=None, statusLabel=None, rois=None, inputRois=None, outputRois=None, roi_req='all', min_roi_inputs=1, min_roi_outputs=1, group=None, serial=None, cropped=None, birthtime=None, cellBodyFiber=None, class_=None, entryNerve=None, exitNerve=None, hemilineage=None, longTract=None, modality=None, origin=None, predictedNt=None, serialMotif=None, somaNeuromere=None, somaSide=None, subclass=None, synonyms=None, systematicType=None, target=None, label=None, min_pre=0, min_post=0, somaLocation=None, tosomaLocation=None, rootLocation=None, soma=None, client=None)
| All criteria must be passed as keyword arguments.
|
| .. note::
| Only ``bodyId``, ``type``, ``instance``, and ROI-related criteria are
| applicable to all datasets. The applicability of all other criteria depends
| on the dataset being accessed (e.g. hemibrain, manc, etc.).
|
| .. note::
|
| **Options for specifying ROI criteria**
|
| The ``rois`` argument merely matches neurons that intersect the given ROIs at all
| (without distinguishing between inputs and outputs).
|
| The ``inputRois`` and ``outputRois`` arguments allow you to put requirements
| on whether or not neurons have inputs or outputs in the listed ROIs.
| It produces a more expensive query, but it's more selective.
| It also enables you to require a minimum number of connections in the given
| ``inputRois`` or ``outputRois`` using the ``min_roi_inputs`` and ``min_roi_outputs``
| criteria.
|
| In either case, use use ``roi_req`` to specify whether a neuron must match just
| one (``any``) of the listed ROIs, or ``all`` of them.
|
| .. note::
|
| **Matching against missing values (NULL)**
|
| To search for neurons which are missing given property entirely,
| you can use a list containing ``None``, or the special value ``neuprint.IsNull``.
| For example, to find neurons with no `type`, use ``type=[None]`` or ``type=IsNull``.
|
| **Matching against any value (NOT NULL)**
|
| To search for any non-null value, you can use ``neuprint.NotNull``. For
| example, to find neurons that have a type (no matter what the
| type is), use ``type=NotNull``.
|
| Args:
| matchvar (str):
| An arbitrary cypher variable name to use when this
| ``NeuronCriteria`` is used to construct cypher queries.
| Must begin with a lowercase letter.
|
| bodyId (int or list of ints):
| List of bodyId values.
|
| type (str or list of str):
| Cell type. Matches depend on the the ``regex`` argument.
| If both ``type`` and ``instance`` criteria are supplied, any neuron that
| matches EITHER criteria will match the overall criteria.
|
| instance (str or list of str):
| Cell instance (specific cell name). Matches depend on the the ``regex`` argument.
| If both ``type`` and ``instance`` criteria are supplied, any neuron that
| matches EITHER criteria will match the overall criteria.
|
| regex (bool):
| If ``True``, the ``instance`` and ``type`` arguments will be interpreted as
| regular expressions, rather than exact match strings.
| If ``False``, only exact matches will be found.
| By default, the matching method will be automatically chosen by inspecting the
| ``type`` and ``instance`` strings. If they contain regex-like characters,
| then we assume you intend regex matching. (You can see which method was chosen by
| checking the ``regex`` field after the ``NeuronCriteria`` is constructed.)
|
| status (str or list of str):
| Indicates the status of the neuron's reconstruction quality.
| Typically, named/annotated neurons have ``Traced`` status,
| the best quality.
| statusLabel (str or list of str):
| ``statusLabel`` is typically more fine-grained than ``status``,
| and mostly of interest during the construction of the connectome,
| not for end-users. The possible values of ``statusLabel`` do not
| correspond one-to-one to those of ``status``.
|
| rois (str or list of str):
| ROIs that merely intersect the neuron, without specifying whether
| they're intersected by input or output synapses.
| If not provided, will be auto-set from ``inputRois`` and ``outputRois``.
|
| inputRois (str or list of str):
| Only Neurons which have inputs in EVERY one of the given ROIs will be matched.
| ``regex`` does not apply to this parameter.
|
| outputRois (str or list of str):
| Only Neurons which have outputs in EVERY one of the given ROIs will be matched.
| ``regex`` does not apply to this parameter.
|
| min_roi_inputs (int):
| How many input (post) synapses a neuron must have in each ROI to satisfy the
| ``inputRois`` criteria. Can only be used if you provided ``inputRois``.
|
| min_roi_outputs (int):
| How many output (pre) synapses a neuron must have in each ROI to satisfy the
| ``outputRois`` criteria. Can only be used if you provided ``outputRois``.
|
| roi_req (Either ``'any'`` or ``'all'``):
| Whether a neuron must intersect all of the listed input/output ROIs, or any of the listed input/output ROIs.
| When using 'any', each neuron must still match at least one input AND at least one output ROI.
|
| group (int or list of int)
| In some datasets, the ``group`` ID is used to associate neurons morphological type,
| including left-right homologues. Neurons with the same group ID have matching morphology.
|
| serial (int or list of int)
| Similar to ``group``, but used for associating neurons across segmental neuropils in the nerve cord.
| Neurons with the same ``serial`` ID are analogous to one another, but in different leg segments.
|
| cropped (bool):
| If given, restrict results to neurons that are cropped or not.
|
| birthtime (str or list of str):
| cellBodyFiber (str or list of str):
| class\_ (str or list of str):
| Matches for the neuron ``class`` field.
| entryNerve (str or list of str):
| exitNerve (str or list of str):
| hemilineage (str or list of str):
| longTract (str or list of str):
| modality (str or list of str):
| origin (str or list of str):
| predictedNt (str or list of str):
| serialMotif (str or list of str):
| somaNeuromere (str or list of str):
| somaSide (str or list of str):
| Valid choices are 'RHS', 'LHS', 'Midline'
| subclass (str or list of str):
| synonyms (str or list of str):
| systematicType (str or list of str):
| target (str or list of str):
|
| label (Either ``'Neuron'`` or ``'Segment'``):
| Which node label to match with.
| (In neuprint, all ``Neuron`` nodes are also ``Segment`` nodes.)
| By default, ``'Neuron'`` is used, unless you provided a non-empty ``bodyId`` list.
| In that case, ``'Segment'`` is the default. (It's assumed you're really interested
| in the bodies you explicitly listed, whether or not they have the ``'Neuron'`` label.)
|
| min_pre (int):
| Exclude neurons that don't have at least this many t-bars (outputs) overall,
| regardless of how many t-bars exist in any particular ROI.
|
| min_post (int):
| Exclude neurons that don't have at least this many PSDs (inputs) overall,
| regardless of how many PSDs exist in any particular ROI.
|
| somaLocation:
| The ``somaLocation`` property of ``:Neuron`` objects contains
| the ``[X,Y,Z]`` coordinate (in voxels) of the cell body.
| ``NeuronCriteria`` does not allow you to match a specific coordinate,
| but you may set this argument to ``NotNull` (or ```IsNull``) to
| search for cells with (or without) a recorded cell body.
|
| tosomaLocation:
| Neurons which could not be successfully attached to their cell body do not have
| a recorded ``somaLocation``. Instead, they have an annotaiton on the cell body
| fiber, on the severed end extending out toward the cell body.
| Like ``somaLocation``, you can't match a specific coordinate using ``NeuronCriteria``,
| but you can use ``NotNull``/``IsNull``.
|
| rootLocation:
| Some (but not all) Neurons which have no soma in the tissue sample are tagged with
| a ``rootLocation``, indicating where they enter/exit the sample.
| Like ``somaLocation``, you can't match a specific coordinate using ``NeuronCriteria``,
| but you can use ``NotNull``/``IsNull``.
|
| soma (Either ``True``, ``False``, or ``None``)
| DEPRECATED. Use ``somaLocation=NotNull`` or ``somaLocation=IsNull``.
|
| client (:py:class:`neuprint.client.Client`):
| Used to validate ROI names.
| If not provided, the global default ``Client`` will be used.
|
| __repr__(self)
| Return repr(self).
|
| all_conditions(self, *vars, prefix=0, comments=True)
|
| basic_conditions(self, prefix=0, comments=True)
| Construct a WHERE clause based on the basic conditions
| in this criteria (i.e. everything except for the "directed ROI" conditions.)
|
| basic_exprs(self)
| Return the list of expressions that correspond
| to the members in this NeuronCriteria object.
| They're intended be combined (via 'AND') in
| the WHERE clause of a cypher query.
|
| directed_rois_condition(self, *vars, prefix=0, comments=True)
| Construct the ```WITH...WHERE``` statements that apply the "directed ROI"
| conditions specified by this criteria's ``inputRois`` and ``outputRois``
| members.
|
| These conditions are expensive to evaluate, so it's usually a good
| idea to position them LAST in your cypher query, once the result set
| has already been narrowed down by eariler filters.
|
| global_vars(self)
|
| global_with(self, *vars, prefix=0)
|
| rois_expr(self)
|
| typeinst_expr(self)
| Unlike all other fields, type and instance OR'd together.
| Either match satisfies the criteria.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| combined_conditions(neuron_conditions, vars=[], prefix=0, comments=True) from builtins.type
| Combine the conditions from multiple NeuronCriteria into a single string,
| putting the "cheap" conditions first and the "expensive" conditions last.
| (That is, basic conditions first and the directed ROI conditions last.)
|
| combined_global_with(neuron_conditions, vars=[], prefix=0) from builtins.type
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MAX_LITERAL_LENGTH = 3
|
| __hash__ = None
|
| __slotnames__ = []
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):
[73]:
# 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()
337 PNs found.
[73]:
| bodyId | instance | type | pre | post | downstream | upstream | size | status | cropped | statusLabel | cellBodyFiber | somaRadius | somaLocation | roiInfo | notes | inputRois | outputRois | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 294792184 | M_vPNml53_R | M_vPNml53 | 92 | 344 | 730 | 344 | 420662445 | Traced | False | Roughly traced | AVM04 | 336.5 | [18923, 34319, 35424] | {'SNP(R)': {'pre': 70, 'post': 155, 'downstrea... | None | [AL(R), AL-D(R), AL-DA2(R), AL-DA4m(R), AL-DC1... | [AL(R), AL-DC1(R), LH(R), PLP(R), SIP(R), SLP(... |
| 1 | 329599710 | M_lvPNm32_R | M_lvPNm32 | 247 | 285 | 2052 | 285 | 343478957 | Traced | False | Roughly traced | AVM06 | NaN | None | {'SNP(R)': {'pre': 180, 'post': 93, 'downstrea... | None | [AL(R), AL-DC4(R), AL-DL2v(R), AL-DM1(R), AL-D... | [AL(R), AL-DL2v(R), AL-DM1(R), AL-DM4(R), AL-D... |
| 2 | 417199910 | M_lvPNm36_R | M_lvPNm36 | 162 | 347 | 1590 | 347 | 387058559 | Traced | False | Roughly traced | AVM06 | 351.5 | [13823, 33925, 34176] | {'SNP(R)': {'pre': 156, 'post': 95, 'downstrea... | None | [AL(R), AL-DL5(R), AL-DM4(R), AL-DP1m(R), AL-V... | [AL(R), AL-DL5(R), AL-DM4(R), AL-VP1d(R), AL-V... |
| 3 | 480927537 | M_vPNml70_R | M_vPNml70 | 82 | 276 | 692 | 276 | 240153322 | Traced | False | Roughly traced | AVM04 | NaN | None | {'SNP(R)': {'pre': 15, 'post': 18, 'downstream... | None | [AL(R), AL-DA2(R), AL-DA4l(R), AL-DA4m(R), AL-... | [LH(R), SLP(R), SNP(R)] |
| 4 | 481268653 | M_vPNml89_R | M_vPNml89 | 146 | 58 | 1614 | 58 | 265085609 | Traced | False | Roughly traced | AVM04 | NaN | None | {'SNP(R)': {'pre': 10, 'post': 2, 'downstream'... | None | [AL(R), AL-VC3l(R), AL-VC4(R), AL-VP1m(R), LH(... | [LH(R), SLP(R), SNP(R)] |
[74]:
# Check that the regex did not have any accidental by-catch
pns['type'].unique()
[74]:
array(['M_vPNml53', 'M_lvPNm32', 'M_lvPNm36', 'M_vPNml70', 'M_vPNml89',
'VP1l+_lvPN', 'M_vPNml69', 'DM1_lPN', 'DM4_vPN', 'M_vPNml79',
'VP4+_vPN', 'DA4l_adPN', 'M_vPNml87', 'DM4_adPN', 'M_vPNml83',
'VA5_lPN', 'DA4m_adPN', 'M_lvPNm24', 'M_vPNml85', 'VP1l+VP3_ilPN',
'M_vPNml77', 'M_vPNml84', 'VC1_lPN', 'M_lvPNm39', 'M_vPNml50',
'DM2_lPN', 'VC5_lvPN', 'M_vPNml88', 'M_vPNml58', 'VP4_vPN',
'DP1m_vPN', 'DP1m_adPN', 'DM5_lPN', 'VC5_adPN', 'M_vPNml80',
'M_lvPNm25', 'VC3m_lvPN', 'VP3+_vPN', 'VP1m+_lvPN', 'DA3_adPN',
'V_l2PN', 'M_vPNml56', 'VC3l_adPN', 'VM7v_adPN', 'DL5_adPN',
'VM4_adPN', 'VM2_adPN', 'M_lvPNm40', 'DC4_vPN', 'V_ilPN',
'M_vPNml74', 'Z_lvPNm1', 'DA1_lPN', 'DP1l_adPN', 'VM4_lvPN',
'M_vPNml71', 'DP1l_vPN', 'M_lvPNm41', 'M_spPN5t10', 'DA1_vPN',
'VC4_adPN', 'DM3_adPN', 'M_lvPNm45', 'VL1_vPN', 'M_lvPNm44',
'M_vPNml78', 'M_vPNml67', 'M_adPNm5', 'M_smPNm1', 'DM6_adPN',
'DL2d_adPN', 'M_adPNm6', 'M_adPNm8', 'M_lvPNm43', 'Z_vPNml1',
'M_vPNml59', 'DA2_lPN', 'M_lPNm11A', 'M_vPNml52', 'DL2d_vPN',
'VL2p_vPN', 'VA1d_adPN', 'M_lPNm11B', 'M_lvPNm48', 'M_lPNm11C',
'M_lvPNm42', 'VA1v_vPN', 'M_vPNml68', 'M_vPNml55', 'M_vPNml62',
'VL2a_vPN', 'M_vPNml60', 'M_vPNml65', 'VM5d_adPN', 'M_l2PNm16',
'M_vPNml61', 'M_vPNml57', 'M_vPNml64', 'M_lv2PN9t49',
'VP2+VC5_l2PN', 'M_spPN4t9', 'M_vPNml66', 'M_vPNml75', 'M_vPNml63',
'M_vPNml72', 'M_lvPNm38', 'D_adPN', 'M_vPNml76', 'M_vPNml54',
'DM3_vPN', 'M_vPNml86', 'DL3_lPN', 'VA4_lPN', 'VP1d_il2PN',
'DC1_adPN', 'M_l2PN3t18', 'M_lvPNm35', 'DL4_adPN', 'M_lvPNm28',
'M_lvPNm27', 'M_ilPNm90', 'M_l2PNl20', 'M_lvPNm29', 'VA7l_adPN',
'M_lPNm13', 'M_l2PNl21', 'DL1_adPN', 'M_imPNl92', 'M_vPNml73',
'M_ilPN8t91', 'M_l2PNm14', 'VP1d+VP4_l2PN1', 'M_lvPNm26',
'DL2v_adPN', 'VP3+VP1l_ivPN', 'M_lvPNm33', 'VA1v_adPN',
'VP3+_l2PN', 'M_l2PN10t19', 'VP4+VL1_l2PN', 'M_l2PNl22',
'M_l2PNm15', 'M_lPNm11D', 'MZ_lv2PN', 'DC2_adPN', 'M_lvPNm46',
'VC2_lPN', 'VM1_lPN', 'VM3_adPN', 'VM7d_adPN', 'M_lvPNm47',
'M_lPNm12', 'DC3_adPN', 'VP2+_adPN', 'VP1m+VP2_lvPN2',
'VP1m+VP2_lvPN1', 'VA6_adPN', 'VA7m_lPN', 'M_adPNm7', 'M_adPNm4',
'VA1d_vPN', 'VA3_adPN', 'VL1_ilPN', 'M_l2PNl23', 'M_lvPNm31',
'VP1m+VP5_ilPN', 'VL2p_adPN', 'MZ_lvPN', 'VP2_adPN', 'VA2_adPN',
'VM5v_adPN', 'VP5+VP2_l2PN', 'VP5+VP3_l2PN', 'VP5+_l2PN',
'M_vPNml51', 'M_smPN6t2', 'M_lvPNm37', 'M_vPNml82', 'M_adPNm3',
'VP1m_l2PN', 'DC4_adPN', 'VP5+Z_adPN', 'VL2a_adPN', 'VP2_l2PN',
'M_lvPNm34', 'VP2+Z_lvPN', 'M_lvPNm30', 'M_l2PNm17', 'M_vPNml81',
'VP1d+VP4_l2PN2'], dtype=object)
We can find the same neuron types using VFB instead. This allows curated neuron classes to be used and doesn’t depend on knowing naming conventions and using potentially error prone regex pattern matching.
[75]:
#This will get all ALPNs from ALL datasets on VFB
ALPNs = vc.get_instances("'adult antennal lobe projection neuron'")
#Select only rows from Hemibrain1.1 dataset
ALPNs=ALPNs[ALPNs['data_source'].str.match('neuprint_JRC_Hemibrain_1point1')]
ALPNs
Running query: FBbt:00067123
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00067123&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 1667
[75]:
| label | symbol | id | tags | data_source | accession | parents_label | parents_id | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | M_lvPNm40_R (FlyEM-HB:1732313117) | M_lvPNm40_R | VFB_jrchk0xb | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 1732313117 | adult multiglomerular antennal lobe projection... | FBbt_20003819 | neuronbridge:1732313117|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 6 | MZ_lv2PN_R (FlyEM-HB:1825440160) | MZ_lv2PN_R | VFB_jrchk0vg | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1825440160 | lateral antennal lobe tract projection neuron ... | FBbt_00052113|FBbt_00058207 | neuprint_JRC_Hemibrain_1point1:1825440160|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 10 | VL2a_adPN_R (FlyEM-HB:5813069089) | VL2a_adPN_R | VFB_jrchk7hy | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 5813069089 | adult antennal lobe projection neuron VL2a adPN | FBbt_00100380 | neuronbridge:5813069089|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 26 | VP1d+VP4_l2PN2(lALT)_R (FlyEM-HB:5901222731) | VP1d+VP4_l2PN2(lALT)_R | VFB_jrchk7io | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 5901222731 | adult cholinergic neuron|adult antennal lobe p... | FBbt_00058205|FBbt_00049728 | neuprint_JRC_Hemibrain_1point1:5901222731|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 27 | DC4_vPN_R (FlyEM-HB:1447201088) | DC4_vPN_R | VFB_jrchjtdy | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1447201088 | adult antennal lobe projection neuron DC4 vPN | FBbt_00049771 | neuprint_JRC_Hemibrain_1point1:1447201088|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 1651 | VP5+Z_adPN(uniAL+SEZ)_R (FlyEM-HB:5813063239) | VP5+Z_adPN(uniAL+SEZ)_R | VFB_jrchk7jm | Entity|Adult|Anatomy|Cell|Cholinergic|Hygrosen... | neuprint_JRC_Hemibrain_1point1 | 5813063239 | adult cholinergic neuron|adult uniglomerular p... | FBbt_00058205|FBbt_00100374 | neuprint_JRC_Hemibrain_1point1:5813063239|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1654 | VP1l+VP3_ilPN (FlyEM-HB:603785283) | VP1l+VP3_ilPN | VFB_jrchk7ir | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 603785283 | adult cholinergic neuron|adult bilateral anten... | FBbt_00058205|FBbt_00111339 | neuronbridge:603785283|neuprint_JRC_Hemibrain_... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1655 | V_ilPN (FlyEM-HB:698508565) | V_ilPN | VFB_jrchk7k4 | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 698508565 | adult uniglomerular antennal lobe projection n... | FBbt_00003995 | neuprint_JRC_Hemibrain_1point1:698508565|neuro... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1659 | VM5d_adPN_R (FlyEM-HB:1914140664) | VM5d_adPN_R | VFB_jrchk7ic | Entity|Adult|Anatomy|Cell|Chemosensory_system|... | neuprint_JRC_Hemibrain_1point1 | 1914140664 | adult antennal lobe projection neuron VM5d adPN | FBbt_00100385 | neuprint_JRC_Hemibrain_1point1:1914140664|neur... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1664 | VP2_l2PN(lALT)_R (FlyEM-HB:5813069447) | VP2_l2PN(lALT)_R | VFB_jrchk7ja | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 5813069447 | adult cholinergic neuron|adult antennal lobe p... | FBbt_00058205|FBbt_00049730 | neuronbridge:5813069447|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
339 rows × 12 columns
Fetching synaptic partners
Looks good! Next: What’s downstream of those PNs?
[76]:
ds = neu.fetch_simple_connections(upstream_criteria=list(map(int, ALPNs['accession'])))
#using hemibrain regex
#ds = neu.fetch_simple_connections(upstream_criteria=neu.NeuronCriteria(bodyId=pns.bodyId.values))
ds
[76]:
| bodyId_pre | bodyId_post | weight | type_pre | type_post | instance_pre | instance_post | conn_roiInfo | |
|---|---|---|---|---|---|---|---|---|
| 0 | 635062078 | 1671292719 | 390 | DP1m_adPN | lLN2T_c | DP1m_adPN_R | lLN2T_c(Tortuous)_R | {'AL(R)': {'pre': 390, 'post': 390}, 'AL-DP1m(... |
| 1 | 635062078 | 1704347707 | 326 | DP1m_adPN | lLN2T_c | DP1m_adPN_R | lLN2T_c(Tortuous)_R | {'AL(R)': {'pre': 324, 'post': 324}, 'AL-DP1m(... |
| 2 | 542634818 | 1704347707 | 322 | DM1_lPN | lLN2T_c | DM1_lPN_R | lLN2T_c(Tortuous)_R | {'AL(R)': {'pre': 322, 'post': 322}, 'AL-DM1(R... |
| 3 | 635062078 | 1640922516 | 320 | DP1m_adPN | lLN2T_e | DP1m_adPN_R | lLN2T_e(Tortuous)_R | {'AL(R)': {'pre': 317, 'post': 316}, 'AL-DP1m(... |
| 4 | 724816115 | 1670916819 | 318 | DP1l_adPN | lLN2P_a | DP1l_adPN_R | lLN2P_a(Patchy)_R | {'AL(R)': {'pre': 318, 'post': 318}, 'AL-DP1l(... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 101862 | 5901222910 | 5813086037 | 1 | DM2_lPN | None | DM2_lPN_R | None | {'LH(R)': {'pre': 1, 'post': 1}} |
| 101863 | 5901222910 | 5813095915 | 1 | DM2_lPN | KCg-m | DM2_lPN_R | KCg-m_R | {'MB(R)': {'pre': 1, 'post': 1}, 'CA(R)': {'pr... |
| 101864 | 5901222910 | 5813129316 | 1 | DM2_lPN | LHAV6a1_b | DM2_lPN_R | LHAV6a1_b_R | {'LH(R)': {'pre': 1, 'post': 1}} |
| 101865 | 5901222910 | 5901193783 | 1 | DM2_lPN | LHAV4g4_a | DM2_lPN_R | LHAV4g4_a_R | {'LH(R)': {'pre': 1, 'post': 1}} |
| 101866 | 5901222910 | 5901203780 | 1 | DM2_lPN | LHAV4g11 | DM2_lPN_R | LHAV4g11_R | {'LH(R)': {'pre': 1, 'post': 1}} |
101867 rows × 8 columns
Each row is now a connections from a single up- to a single downstream neuron. The “weight” is the number of synapses between the pre- and the postsynaptic neuron. Let’s simplify by grouping by type:
[77]:
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
[77]:
| type_pre | type_post | weight | |
|---|---|---|---|
| 0 | DC3_adPN | KCg-m | 3670 |
| 1 | VM5d_adPN | KCg-m | 3219 |
| 2 | DC1_adPN | KCg-m | 3215 |
| 3 | VL2a_adPN | KCg-m | 3096 |
| 4 | DA1_lPN | KCg-m | 3078 |
| ... | ... | ... | ... |
| 40631 | M_vPNml50 | WEDPN4 | 1 |
| 40632 | M_vPNml50 | WEDPN12 | 1 |
| 40633 | M_vPNml50 | V_ilPN | 1 |
| 40634 | M_vPNml50 | VP4+VL1_l2PN | 1 |
| 40635 | Z_vPNml1 | mALD2 | 1 |
40636 rows × 3 columns
The strongest connections are between PNs and Kenyon Cells (KCs). That’s not much of a surprise since there are thousands of KCs. For the sake of the argument let’s say we want to know where these connections occur:
[78]:
#First find KCs in VFB
KCs = vc.get_instances("'adult Kenyon cell'")
#Select only rows from Hemibrain1.1 dataset
KCs=KCs[KCs['data_source'].str.match('neuprint_JRC_Hemibrain_1point1')]
KCs
Running query: FBbt:00049825
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00049825&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 5118
[78]:
| label | symbol | id | tags | data_source | accession | parents_label | parents_id | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | KCab-m_R (FlyEM-HB:363384138) | KCab-m_R | VFB_jrchjvjo | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 363384138 | adult dopaminergic neuron|mushroom body dopami... | FBbt_00058206|FBbt_00048138|FBbt_00100248 | neuprint_JRC_Hemibrain_1point1:363384138|neuro... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 1 | KCab-m_R (FlyEM-HB:363725201) | KCab-m_R | VFB_jrchjvl1 | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 363725201 | adult dopaminergic neuron|alpha/beta Kenyon ce... | FBbt_00058206|FBbt_00100248|FBbt_00048138 | neuronbridge:363725201|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | KCa\'b\'-ap2_R (FlyEM-HB:5813020052) | KCa\'b\'-ap2_R | VFB_jrchjv3x | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 5813020052 | alpha'/beta' anterior-posterior type 2 Kenyon ... | FBbt_00049837|FBbt_00048138|FBbt_00058206 | neuronbridge:5813020052|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 6 | KCa\'b\'-m_R (FlyEM-HB:5812982397) | KCa\'b\'-m_R | VFB_jrchjva1 | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 5812982397 | adult dopaminergic neuron|mushroom body dopami... | FBbt_00058206|FBbt_00048138|FBbt_00100253 | neuronbridge:5812982397|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 9 | KCg-m_R (FlyEM-HB:5812982168) | KCg-m_R | VFB_jrchjw51 | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 5812982168 | gamma main Kenyon cell|adult dopaminergic neur... | FBbt_00111061|FBbt_00058206|FBbt_00048138 | neuprint_JRC_Hemibrain_1point1:5812982168|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 5106 | KCg-m_R (FlyEM-HB:1141687352) | KCg-m_R | VFB_jrchjwch | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 1141687352 | gamma main Kenyon cell|mushroom body dopaminer... | FBbt_00111061|FBbt_00048138|FBbt_00058206 | neuronbridge:1141687352|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 5108 | KCg-m_R (FlyEM-HB:1101353948) | KCg-m_R | VFB_jrchjwe3 | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 1101353948 | mushroom body dopaminergic neuron|adult dopami... | FBbt_00048138|FBbt_00058206|FBbt_00111061 | neuronbridge:1101353948|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 5109 | KCg-m_R (FlyEM-HB:693837780) | KCg-m_R | VFB_jrchjwcq | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 693837780 | mushroom body dopaminergic neuron|gamma main K... | FBbt_00048138|FBbt_00111061|FBbt_00058206 | neuronbridge:693837780|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 5111 | KCg-m_R (FlyEM-HB:540389646) | KCg-m_R | VFB_jrchjwcg | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 540389646 | mushroom body dopaminergic neuron|adult dopami... | FBbt_00048138|FBbt_00058206|FBbt_00111061 | neuronbridge:540389646|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 5114 | KCg-m_R (FlyEM-HB:693841887) | KCg-m_R | VFB_jrchjwci | Entity|Adult|Anatomy|Cell|Cholinergic|Dopamine... | neuprint_JRC_Hemibrain_1point1 | 693841887 | adult dopaminergic neuron|mushroom body dopami... | FBbt_00058206|FBbt_00048138|FBbt_00111061 | neuronbridge:693841887|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
1927 rows × 12 columns
[79]:
adj, roi_info2 = neu.fetch_adjacencies(sources=list(map(int, ALPNs['accession'][:300])), targets=list(map(int, KCs['accession'][:300])))
roi_info2.head()
[79]:
| bodyId_pre | bodyId_post | roi | weight | |
|---|---|---|---|---|
| 0 | 542634818 | 301314208 | CA(R) | 6 |
| 1 | 542634818 | 332344908 | CA(R) | 9 |
| 2 | 542634818 | 332353106 | CA(R) | 13 |
| 3 | 542634818 | 363030024 | CA(R) | 22 |
| 4 | 542634818 | 363030024 | NotPrimary | 1 |
[80]:
# Group by region of interest (ROI)
by_roi = roi_info2.groupby('roi').weight.sum()
by_roi.head()
[80]:
roi
CA(R) 21744
NotPrimary 228
SCL(R) 22
SLP(R) 235
Name: weight, dtype: int64
[81]:
ax = by_roi.plot.bar()
ax.set_xlabel('')
ax.set_ylabel('PN to KC synapses')
[81]:
Text(0, 0.5, 'PN to KC synapses')
[82]:
adj = roi_info2[roi_info2.roi == 'CA(R)'].pivot(columns="bodyId_pre",
index="bodyId_post",
values="weight").fillna(0)
[83]:
sns.clustermap(adj, cmap='Greys')
/usr/local/anaconda3/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:
Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
/usr/local/anaconda3/lib/python3.10/site-packages/seaborn/matrix.py:560: UserWarning:
Clustering large matrix with scipy. Installing `fastcluster` may give better performance.
[83]:
<seaborn.matrix.ClusterGrid at 0x7fdce1a44790>
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).
[84]:
#First find DNs in VFB
DNs = vc.get_instances("'adult descending neuron'")
#Select only rows from Hemibrain1.1 dataset
DNs=DNs[DNs['data_source'].str.match('neuprint_JRC_Hemibrain_1point1')]
DNs
Running query: FBbt:00047511
Query URL: http://owl.virtualflybrain.org/kbs/vfb/instances?object=FBbt%3A00047511&prefixes=%7B%22FBbt%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FFBbt_%22%2C+%22RO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FRO_%22%2C+%22BFO%22%3A+%22http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FBFO_%22%7D&direct=False
Query results: 297
[84]:
| label | symbol | id | tags | data_source | accession | parents_label | parents_id | xrefs | templates | dataset | license | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | SMP289(PDM05)_L (FlyEM-HB:330074340) | SMP289(PDM05)_L | VFB_jrchk6ov | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | neuprint_JRC_Hemibrain_1point1 | 330074340 | adult superior medial protocerebrum neuron 289 | FBbt_20003151 | neuronbridge:330074340|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 2 | PS225_R (FlyEM-HB:5812991287) | PS225_R | VFB_jrchk4is | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 5812991287 | adult posterior slope neuron 225 | FBbt_20001980 | neuronbridge:5812991287|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 3 | DNb03_R (FlyEM-HB:5813022608) | DNb03_R | VFB_jrchjtfu | Entity|Adult|Anatomy|Cell|Glutamatergic|Indivi... | neuprint_JRC_Hemibrain_1point1 | 5813022608 | descending neuron of the anterior ventral brai... | FBbt_00047584|FBbt_00058208 | neuprint_JRC_Hemibrain_1point1:5813022608|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 4 | DNp17_R (FlyEM-HB:1815895547) | DNp17_R | VFB_jrchjth7 | Entity|Adult|Anatomy|Cell|Glutamatergic|Indivi... | neuprint_JRC_Hemibrain_1point1 | 1815895547 | descending neuron of the posterior brain DNp17... | FBbt_00047650|FBbt_00058208 | neuprint_JRC_Hemibrain_1point1:1815895547|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 6 | DNp27_L (FlyEM-HB:5813020347) | DNp27_L | VFB_jrchjthn | Entity|Adult|Anatomy|Cell|Dopaminergic|Individ... | neuprint_JRC_Hemibrain_1point1 | 5813020347 | adult dopaminergic neuron|descending neuron of... | FBbt_00058206|FBbt_00047660 | neuprint_JRC_Hemibrain_1point1:5813020347|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 292 | DNp49(pIP18)_R (FlyEM-HB:1039335355) | DNp49(pIP18)_R | VFB_jrchjthv | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 1039335355 | descending neuron of the posterior brain | FBbt_00047517 | neuronbridge:1039335355|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 293 | CL202(PDM12)_L (FlyEM-HB:5813013952) | CL202(PDM12)_L | VFB_jrchjsuv | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 5813013952 | adult clamp neuron 202 | FBbt_20000907 | neuronbridge:5813013952|neuprint_JRC_Hemibrain... | JRC2018Unisex|JRC_FlyEM_Hemibrain | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 294 | PS225_R (FlyEM-HB:1466688033) | PS225_R | VFB_jrchk4iq | Entity|Adult|Anatomy|Cell|Individual|Nervous_s... | neuprint_JRC_Hemibrain_1point1 | 1466688033 | adult posterior slope neuron 225 | FBbt_20001980 | neuprint_JRC_Hemibrain_1point1:1466688033|neur... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 295 | oviDNb_R (FlyEM-HB:519949044) | oviDNb_R | VFB_jrchk8do | Entity|Adult|Anatomy|Cell|Cholinergic|Individu... | neuprint_JRC_Hemibrain_1point1 | 519949044 | oviposition descending neuron oviDNb | FBbt_00049921 | neuronbridge:519949044|neuprint_JRC_Hemibrain_... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
| 296 | DNp24_R (FlyEM-HB:5813047199) | DNp24_R | VFB_jrchjthh | Entity|Adult|Anatomy|Cell|GABAergic|Individual... | neuprint_JRC_Hemibrain_1point1 | 5813047199 | descending neuron of the posterior brain DNp24 | FBbt_00047657 | neuronbridge:5813047199|neuprint_JRC_Hemibrain... | JRC_FlyEM_Hemibrain|JRC2018Unisex | Xu2020NeuronsV1point1 | https://creativecommons.org/licenses/by/4.0/le... |
249 rows × 12 columns
[85]:
# First fetch the DNs
dns, _ = neu.fetch_neurons(list(map(int, DNs['accession'])))
#with regex
#dns, _ = neu.fetch_neurons(neu.NeuronCriteria(type='(.*DN[^1]{0,}.*|Giant Fiber)', regex=True))
dns
[85]:
| bodyId | instance | type | pre | post | downstream | upstream | size | status | cropped | statusLabel | cellBodyFiber | somaRadius | somaLocation | roiInfo | notes | inputRois | outputRois | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 297925719 | SMP478_R | SMP478 | 11 | 514 | 33 | 514 | 887352389 | Traced | False | Roughly traced | PDM15 | 301.0 | [18670, 15472, 12256] | {'SNP(R)': {'pre': 8, 'post': 411, 'downstream... | pMP1 candidates | [INP, SCL(R), SIP(R), SLP(R), SMP(L), SMP(R), ... | [SIP(R), SMP(R), SNP(R)] |
| 1 | 298961895 | SMP478_R | SMP478 | 8 | 569 | 38 | 569 | 862856817 | Traced | False | Roughly traced | PDM15 | 301.0 | [17329, 15560, 10624] | {'SNP(R)': {'pre': 5, 'post': 317, 'downstream... | pMP1 candidates | [INP, SCL(R), SMP(L), SMP(R), SNP(L), SNP(R)] | [SMP(L), SMP(R), SNP(L), SNP(R)] |
| 2 | 299298593 | SMP478(PDM15)_L | SMP478 | 5 | 289 | 16 | 289 | 613001071 | Traced | False | Roughly traced | None | NaN | None | {'SNP(R)': {'pre': 1, 'post': 80, 'downstream'... | pMP1 candidates | [SMP(L), SMP(R), SNP(L), SNP(R)] | [SMP(L), SMP(R), SNP(L), SNP(R)] |
| 3 | 326253554 | SMP454_R | SMP454 | 2613 | 9756 | 21869 | 9756 | 8166517062 | Traced | False | Roughly traced | PDM12 | 465.5 | [22142, 20149, 5600] | {'SNP(R)': {'pre': 1374, 'post': 3627, 'downst... | None | [ATL(R), AVLP(R), CAN(R), CRE(-ROB,-RUB)(R), C... | [AOTU(R), AVLP(R), CRE(-ROB,-RUB)(R), CRE(-RUB... |
| 4 | 327255181 | SMP290_R | SMP290 | 147 | 455 | 1028 | 455 | 816661754 | Traced | False | Roughly traced | PDM05 | 396.0 | [23064, 11810, 14912] | {'SNP(R)': {'pre': 63, 'post': 390, 'downstrea... | pMP5 candidates | [FLA(R), PENP, SMP(L), SMP(R), SNP(L), SNP(R),... | [FLA(R), PENP, SMP(R), SNP(R), mALT(R)] |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 244 | 5813078352 | PS133_R | PS133 | 9 | 1041 | 30 | 1041 | 1572727885 | Traced | False | Roughly traced | PDM17 | 351.0 | [26154, 14795, 14256] | {'INP': {'post': 252, 'upstream': 252}, 'SCL(R... | None | [CAN(R), EPA(L), EPA(R), GNG, GOR(L), GOR(R), ... | [CAN(R), GOR(R), IPS(R), PENP, SPS(L), SPS(R),... |
| 245 | 5813082237 | PS212_R | PS212 | 77 | 5047 | 299 | 5047 | 2290180209 | Traced | False | Roughly traced | PVM02 | 456.5 | [20933, 11422, 19304] | {'INP': {'pre': 14, 'post': 613, 'downstream':... | None | [EPA(R), GNG, GOR(R), IB, ICL(R), INP, IPS(R),... | [GNG, IB, ICL(R), INP, IPS(R), PLP(R), SPS(R),... |
| 246 | 5813095193 | DNp16_R | DNp16 | 70 | 683 | 429 | 683 | 292910198 | Traced | False | Roughly traced | PVM02 | 276.0 | [25941, 10730, 20000] | {'INP': {'post': 34, 'upstream': 34}, 'IB': {'... | None | [CAN(R), GNG, IB, INP, IPS(R), PENP, SPS(R), V... | [CAN(R), GNG, IPS(R), PENP, SPS(R), VMNP] |
| 247 | 5813096489 | VES081_R | VES081 | 14 | 1321 | 71 | 1321 | 928031787 | Traced | False | Roughly traced | PVM15 | 451.0 | [15106, 10109, 20144] | {'VMNP': {'pre': 5, 'post': 1190, 'downstream'... | None | [AL(R), GNG, IPS(R), LAL(-GA)(R), LAL(R), LX(R... | [GNG, VES(R), VMNP] |
| 248 | 5813108230 | DNp16/17_R | DNp16/17 | 5 | 177 | 16 | 177 | 304268206 | Traced | False | Roughly traced | PVM02 | 321.5 | [23677, 10111, 18544] | {'INP': {'post': 2, 'upstream': 2}, 'IB': {'po... | None | [GNG, IB, INP, IPS(R), SPS(R), VMNP] | [IPS(R), SPS(R), VMNP] |
249 rows × 18 columns
Neuprint lets you query paths from a single source to a single target. For multi-source or -target queries, your best bet is to download the entire graph and run the queries locally using networkx or igraph.
[86]:
# Find all paths from A PN to A DNs
paths = neu.fetch_shortest_paths(upstream_bodyId=list(map(int, ALPNs['accession']))[0],
downstream_bodyId=list(map(int, DNs['accession']))[0],
min_weight=10)
paths
[86]:
| path | bodyId | type | weight | |
|---|---|---|---|---|
| 0 | 0 | 1732313117 | M_lvPNm40 | 0 |
| 1 | 0 | 5813019955 | SLP057 | 31 |
| 2 | 0 | 361445621 | SMP108 | 41 |
| 3 | 0 | 486932201 | SMP083 | 17 |
| 4 | 0 | 330074340 | SMP289 | 12 |
| 5 | 1 | 1732313117 | M_lvPNm40 | 0 |
| 6 | 1 | 5813019955 | SLP057 | 31 |
| 7 | 1 | 361445621 | SMP108 | 41 |
| 8 | 1 | 358290805 | SMP083 | 12 |
| 9 | 1 | 330074340 | SMP289 | 12 |
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):
[87]:
# Import the wrapped neuprint-python
# -> this exposes ALL base functions plus a couple navis-specific extras
import navis
import navis.interfaces.neuprint as neu
#client = neu.Client('https://neuprint.janelia.org', dataset='hemibrain:v1.1')
# Fetch neurons in the first path
nl = neu.fetch_skeletons(paths.loc[(paths.path == 0), 'bodyId'])
nl
[87]:
| type | name | id | n_nodes | n_connectors | n_branches | n_leafs | cable_length | soma | units | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | navis.TreeNeuron | M_lvPNm40_R | 1732313117 | 4460 | None | 206 | 215 | 200988.1250 | NaN | 8 nanometer |
| 1 | navis.TreeNeuron | SLP057_R | 5813019955 | 25733 | None | 2398 | 2438 | 961531.7500 | 25687.0 | 8 nanometer |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 3 | navis.TreeNeuron | SMP083(ADM04)_L | 486932201 | 16870 | None | 1297 | 1328 | 663036.7500 | 9967.0 | 8 nanometer |
| 4 | navis.TreeNeuron | SMP289(PDM05)_L | 330074340 | 7180 | None | 535 | 550 | 245285.0625 | 7177.0 | 8 nanometer |
[88]:
# 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)')
[89]:
# Plot
navis.plot3d([nl, lh, al, ca], width=1100)
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:
[90]:
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')
[91]:
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()
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