Skip to content

L-in-da/fly_connectome_data_tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fly Connectome Data Tutorial

Tutorial materials for working with Drosophila connectome datasets at the San Juan Winter School on Connectomics and Brain Simulation (SJCABS). We will work with all the major, dense connectome datasets for the fruit fly.

Instructors: Sven Dorkenwald & Alexander Bates

This tutorial provides foundational skills for loading, analysing, and visualising connectome data that will be used throughout the workshop. You'll learn to work with neuronal morphologies, synaptic connectivity, and network analysis across multiple fly brain and nerve cord datasets. Key contributors to the tools used in, and to prepare, this workshop include Philipp Schlegel and Greg Jefferis.


This tutorial

This tutorial offers:

  1. curated data for connectomic analyses.

  2. concise Python and R code for simple but effective analyses of connectome data.

  3. guides you through some general principles of exploratory connectomics analysis that should be useful.


Quick Links


Fly connectome datasets

Connectome Datasets

We focus primarily on two FlyWire datasets—BANC and FAFB—while also providing access to MANC, Hemibrain, and Male CNS. All datasets have been harmonized to use the unified metadata schema we used in the BANC project, enabling cross-dataset comparisons. Possible metadata entries given here: data/meta_data_entries. You can see renderings of neuronal meshes from the BANC, FAFB, MANC and HemiBrain datasets in neuroglancer here.

BANC connectome

BANC (Brain and Nerve Cord)

Primary dataset for this tutorial

The first synapse-resolution connectome that spanning the brain and ventral nerve cord. Contains ~114,000 neurons with ~108 million synaptic connections. A female fly. Missing the first optic relay, the lamina, and the retina.

Male CNS connectome

Male CNS (Central Nervous System)

Complete male CNS connectome with 166,691 neurons spanning the brain and ventral nerve cord. Includes fruitless and doublesex expression data for studying sex-specific circuits. A male fly. Missing retina.

FAFB connectome

FAFB (Full Adult Fly Brain)

Complete adult female fly brain connectome via the FlyWire project. Contains ~139,000 neurons spanning all brain regions, including detailed annotations of 8,453 cell types. A female fly. Missing ventral nerve cord and retina.

MANC connectome

MANC (Male Adult Nerve Cord)

First complete nerve cord connectome with ~23,000 neurons. A male fly. Missing brain.

Hemibrain connectome

Hemibrain

Dense reconstruction of approximately half the central brain (~25,000 neurons). Includes mushroom body learning circuits and central complex navigation circuits. A female fly. Missing ventral nerve cord and approximately half of the brain and optic lobes.


Guides

These guides were created by the FlyWire project:


Analysis Tools

navis - neuron analysis and visualization

Python

Installation guide: Setting up Python for connectomics

  • navis - Neuron analysis and visualisation (works with all datasets)
  • skeletor - Mesh skeletonisation
  • fafbseg-py - FlyWire/FAFB-specific tools
  • navis-flybrains - Coordinate transforms and template brains
  • ConnectomeInfluenceCalculator - Quantify influence between sensory and effector neurons
  • cocoa - Compare inter/intra-dataset connectivity -CAVEclient - Live connectome dataset annotation and tracking (for flies: FAFB, BANC, FANC) -neuprint-python - Data access to Janelian connectome projects, e.g. HemiBrain, MANC and maleCNS.

natverse - NeuroAnatomy Toolbox for R

R

Installation guide: Installing the natverse

Core packages:

  • natverse - NeuroAnatomy Toolbox ecosystem (works with all datasets)
  • neuprintr - neuPrint client for querying connectome databases
  • nat.flybrains - Coordinate transforms and template brains

Dataset-specific packages:

  • bancr - BANC-specific client
  • fafbseg - FlyWire/FAFB-specific tools
  • hemibrainr - Hemibrain-specific tools
  • malevnc - Male VNC (MANC) specific tools
  • malecns - Male CNS specific tools

Analysis tools:


Data Organisation

All processed data is hosted on Google Cloud Storage: Access Data

You can browse and download files directly from the browser, or use command-line tools:

# List available datasets
gsutil ls gs://sjcabs_2025_data/

# Download a specific file
gsutil cp gs://sjcabs_2025_data/path/to/file .

# Download an entire folder
gsutil -m cp -r gs://sjcabs_2025_data/folder_name .

Example Structure (BANC)

banc/
├── banc_746_meta.feather              # Neuron annotations
├── banc_746_edgelist_simple.feather   # Neuron-to-neuron connectivity
├── banc_746_synapses.feather          # Individual synapse data
├── banc_746_skeletons_in_banc_space.zip  # 3D morphologies (SWC format)
├── abdominal_neuromere/               # Subset: abdominal control circuits
├── antennal_lobe/                     # Subset: olfactory circuits
├── central_complex/                   # Subset: navigation circuits
├── front_leg/                         # Subset: front leg control
├── mushroom_body/                     # Subset: associative memory circuits
├── optic/                             # Subset: visual processing circuits
└── suboesophageal_zone/              # Subset: feeding and tactile circuits

File Types

  • *_meta.feather - Metadata for each neuron: cell type, brain region, neurotransmitter, developmental lineage (schema details)
  • *_edgelist_simple.feather - Connectivity matrix showing which neurons connect to which, with connection strengths
  • *_synapses.feather - Coordinates and properties of individual synapses
  • *_skeletons_*.zip - 3D skeleton reconstructions in SWC format

See individual dataset documentation files in data/dataset_documentation/ for detailed column descriptions.

Neural System Subsets

We provide curated subsets focusing on specific circuits:

  • Antennal Lobe: Primary olfactory processing centre receiving input from olfactory receptor neurons and projecting to higher brain regions via projection neurons. Critical for odour discrimination and learning.

  • Central Complex: Navigation circuits for spatial orientation, motor control, and goal-directed behaviour. Contains ring neurons encoding heading direction and columnar neurons for path integration.

  • Mushroom Body: Associative learning and memory circuits. Kenyon cells integrate sensory information and form associations with dopaminergic reinforcement signals.

  • Optic Lobe: Visual processing through lamina (motion detection), medulla (colour and contrast), and lobula (object recognition). Includes both retinotopic local circuits and wide-field integration neurons.

  • Suboesophageal Zone: Lower brain region controlling feeding, grooming, and processing gustatory/tactile information from mouthparts and antennae.

  • Front Leg / Abdominal Neuromere: Motor control circuits coordinating limb movements and postural adjustments through local sensory feedback and descending command signals.


Detailed Data Inventory

BANC (Brain and Nerve Cord)

Browse Files | gs://sjcabs_2025_data/banc/

FAFB (Full Adult Fly Brain)

Browse Files | gs://sjcabs_2025_data/fafb/

  • fafb_783_meta.feather (~0.01 GB) - Metadata
  • fafb_783_simple_edgelist.feather (~5 GB) - Connectivity
  • fafb_783_split_edgelist.feather (~10 GB) - Compartment connectivity
  • fafb_783_synapses.feather (~12 GB) - Synapses
  • fafb_783_banc_space_swc.zip - Skeletons (BANC space)
  • fafb_fafb_space_swc.zip - Skeletons (native FAFB space)
  • Curated subsets: antennal_lobe/, central_complex/, mushroom_body/, optic/, suboesophageal_zone/

MANC (Male Adult Nerve Cord)

Browse Files | gs://sjcabs_2025_data/manc/

  • manc_121_meta.feather (~0.005 GB) - Metadata
  • manc_121_simple_edgelist.feather (~1.5 GB) - Connectivity
  • manc_121_split_edgelist.feather (~3 GB) - Compartment connectivity
  • manc_121_synapses.feather (~4 GB) - Synapses
  • manc_banc_space_swc.zip - Skeletons (BANC space)

Hemibrain

Browse Files | gs://sjcabs_2025_data/hemibrain/

  • hemibrain_121_meta.feather (~0.005 GB) - Metadata
  • hemibrain_121_simple_edgelist.feather (~2 GB) - Connectivity
  • hemibrain_121_split_edgelist.feather (~4 GB) - Compartment connectivity
  • hemibrain_121_synapses.feather (~5 GB) - Synapses
  • hemibrain_banc_space_swc.zip - Skeletons (BANC space)
  • hemibrain_hemibrain_raw_space_swc.zip - Skeletons (native space)
  • neuropils/, obj/ - Mesh data

Download Examples

# Small file - metadata (recommended to start)
gsutil cp gs://sjcabs_2025_data/banc/banc_746_meta.feather .

# Curated subset - much smaller than full dataset
gsutil -m cp -r gs://sjcabs_2025_data/banc/antennal_lobe/ .

# Large file - check size first
gsutil ls -lh gs://sjcabs_2025_data/banc/banc_746_synapses.feather

Tutorial Path

This tutorial follows a progressive learning path designed to take about 2 hours for the core content, with optional extensions for deeper exploration.

Tutorial 01: Data Access (30 minutes)

R version | Python version

Core Tutorial:

  • Understanding file formats (Feather vs Parquet)
  • Loading metadata and exploring hierarchical classifications
  • Working with Google Cloud Storage and local files
  • Filtering and characterizing neurons by connectivity patterns
  • Example: Mushroom body calyx neurons

Extensions:

  • Your Turn: Apply analysis to different datasets (maleCNS, FAFB)
  • Compare biological vs technical differences between datasets

Tutorial 02: Neuron Morphology (30 minutes)

R version | Python version

Core Tutorial:

  • Loading and visualizing 3D neuron skeletons (.swc files)
  • Reading neuropil meshes for spatial context
  • Co-plotting neurons across datasets
  • NBLAST morphological similarity analysis
  • Hierarchical clustering of neuron morphologies

Extensions:

  • Your Turn: Analyze different neuron populations
  • Extension 1: Template brain transformations (MANC → JRCVNC2018F → BANC)
  • Extension 2: Axon-dendrite splits using flow centrality
    • Compartment labels from graph-theoretic algorithm (Schneider-Mizell et al. 2016)
    • Synapse classification by compartment
    • Available for FAFB, MANC, maleCNS (not yet BANC)

Tutorial 03: Connectivity Analyses (40 minutes)

R version | Python version

Core Tutorial:

  • Loading and querying edgelists (connectivity matrices)
  • Neurotransmitter prediction and signed connectivity
  • Basic network statistics (degree distributions, weight correlations)
  • Connectivity matrices and heatmaps
  • Sensory outputs and effector inputs analysis

Extensions:

  • Your Turn: Analyze different brain regions
  • Connectivity-based clustering (cosine similarity, UMAP)
  • Cluster composition and network visualization
  • Morphological analysis of connectivity clusters

Tutorial 04: Indirect Connectivity and Influence (20 minutes)

R version | Python version

Core Tutorial:

  • Understanding influence scores and random walks through connectomes
  • Calculating sensory → dopaminergic neuron influence
  • Influence heatmaps and UMAP visualization
  • Interpreting multi-hop connectivity patterns

Extensions:

  • Your Turn: Different source/target neuron populations
  • Extension 1: Olfactory channel influence on pC1 neurons (BANC vs maleCNS)
  • Extension 2: Abdominal neuromere sensory-effector influence patterns

Getting Started

If running in the cloud: INSERT

If running locally:

  1. Download data from the Google Cloud Storage bucket for the dataset(s) you want to work with
  2. Install analysis tools:
    • Python: pip install navis fafbseg
    • R:
      install.packages("natmanager")
      natmanager::install(pkgs = "core")
      
      # Install Python dependencies for fafbseg
      library(fafbseg)
      simple_python()
  3. Open the first tutorial in tutorials/python/ or tutorials/R/

Citation

The Google Bucket contains a curation of connectome data by Alexander Bates. The purpose of the curation was to make it easy to work with all major connectome datasets together, e.g. standardising column names and meta data entires. You are welcome to use this data curation in your own work! Just let Alex know!

More generally, if you use these datasets in your work, please cite the original publications:

BANC: Bates, A.S., Phelps, J.S., Kim, M., Yang, H.H., Matsliah, A., Ajabi, Z., Perlman, E., et al. (2025). Distributed control circuits across a brain-and-cord connectome. bioRxiv, 2025.07.31.667571. https://doi.org/10.1101/2025.07.31.667571

FAFB: Schlegel, P., Yin, Y., Bates, A.S., Dorkenwald, S., Eichler, K., Brooks, P., Han, D.S., et al. (2024). Whole-brain annotation and multi-connectome cell typing of Drosophila. Nature, 634(8032), 139-152. https://doi.org/10.1038/s41586-024-07686-5

FAFB: Dorkenwald, S., Matsliah, A., Sterling, A.R., Schlegel, P., ... Bates, A.S., ... et al. (2024). Neuronal wiring diagram of an adult brain. Nature, 634(8032), 124-138. https://doi.org/10.1038/s41586-024-07686-5

MANC: Takemura, S., et al. (2024). A Connectome of the Male Drosophila Ventral Nerve Cord. eLife. https://doi.org/10.7554/eLife.97769

Hemibrain: Scheffer, L.K., Xu, C., Januszewski, M., Lu, Z., Takemura, S.Y., Bates, A.S., et al. (2020). A connectome and analysis of the adult Drosophila central brain. eLife, 9, e57443. https://doi.org/10.7554/eLife.57443

Male CNS: Berg, S., Beckett, I.R., Costa, M., Schlegel, P., Januszewski, M., Marin, E.C., Bates, A.S., et al. (2025). Sexual dimorphism in the complete connectome of the Drosophila male central nervous system. bioRxiv, 2025.10.09.680999. https://doi.org/10.1101/2025.10.09.680999

Neurotransmitter Predictions: Eckstein, N., Bates, A.S., Champion, A., Du, M., Yin, Y., Schlegel, P., Lu, A.K.Y., et al. (2024). Neurotransmitter classification from electron microscopy images at synaptic sites in Drosophila melanogaster. Cell, 187(10), 2574-2594.e23. https://doi.org/10.1016/j.cell.2024.03.016


License & Contact

Data: Licensed under CC-BY by the respective dataset creators Code: MIT License Questions: Open an issue on this repository or contact the instructors during the workshop


Workshop: SJCABS Winter School Year: 2025

FlyWire visualization

About

Tutotial on how to access the major fly connectome datasets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 87.5%
  • Jupyter Notebook 12.5%