Module 12: Big Data in Connectomics

Design scalable data storage, querying, and analysis workflows for petascale connectomics datasets.

Stylized vector art: a chunked isometric data volume with one chunk pulled out.

Lesson Flow

Learn

Goals and Concepts

Start with the capability target and concept set for this module.

Practice

Studio Activity

Apply the ideas in a guided activity tied to realistic outputs.

Check

Assessment Rubric

Use the rubric to verify competency and identify improvement targets.

Capability target

Produce a scalable, reproducible query-and-analysis plan for a large connectomics dataset, including storage assumptions, indexing strategy, and provenance capture. Concretely: size a dataset from its imaging parameters before anyone quotes you a price, choose a chunk and shard layout from your actual access pattern rather than from the format everyone else uses, predict which query will dominate your bill, and pin every published number to a segmentation version a stranger can re-query a year from now.

Why this module matters

Connectomics is now data-system-limited as much as algorithm-limited. One cubic millimeter of cortex imaged at 4 x 4 x 40 nm is (1,000,000/4) x (1,000,000/4) x (1,000,000/40) = 250,000 x 250,000 x 25,000 voxels, or about 1.56 x 10^15 voxels — roughly 1.5 PB of 8-bit image data before a single derived product exists. MICrONS and H01 are each approximately 1 mm³ and are reported in the 1.4-2 PB range. At that scale the decisions that determine whether a project finishes are made in the first week: chunk size, sharding, where the bytes physically live, and whether analysis tables are pinned to a version. None of those decisions appear in a figure, and all of them are expensive to reverse.

The failure mode is rarely a crash. It is a query that takes eleven hours instead of four minutes, so you test two hypotheses a week instead of forty a day. It is an invoice dominated by per-request charges rather than by stored bytes. Most often it is a number in a figure that cannot be reproduced, because the segmentation it was computed against no longer exists under that name.

Concept set

1) Storage layout is chosen by access pattern, not by format popularity

2) Object count is a cost driver independent of byte count

3) Derived data, not raw image, is most of what you will manage

Product Footprint Persistence
Raw image tiles 1x (~1.5 PB) Irreplaceable; keep forever
Aligned, chunked pyramid +30-50% over raw Regenerable, but expensively
Affinity/boundary maps ~1x raw Usually transient; delete after agglomeration
Segmentation labels 0.1-0.5x raw Regenerable from supervoxels plus edit log
Meshes (multi-LOD) 1-10 TB Regenerated as segmentation changes
Skeletons 10-100 GB Cheap; regenerate freely
Synapse table (~5 x 10^8 rows) 50-200 GB The analyst’s primary object

4) Root IDs are not stable, and unpinned analysis is the field’s most common silent bug

5) Query cost is a research variable

6) Provenance is a field in the output, not a habit

Worked example: sizing and costing a project before you design it

A collaborator asks whether your group can host and analyze a new 1 mm³ mouse cortex volume imaged at 4 x 4 x 40 nm. They want an answer this week. Here is the reasoning, in the order it should happen.

Step 1 — Convert imaging parameters to voxels. 1 mm = 10^6 nm on each axis. Dividing by the voxel dimensions gives 250,000 x 250,000 x 25,000 = 1.5625 x 10^15 voxels. At 8 bits per voxel that is 1.5625 x 10^15 bytes, about 1.5 PB, or roughly 1.4 PiB. This matches the 1.4-2 PB range reported for MICrONS and H01, which is the check that tells you the arithmetic is right.

Step 2 — Add the derived products. From the table above: the pyramid adds 0.5-0.75 PB; segmentation labels land at 0.15-0.75 PB; affinity maps are about 1x raw but transient, so they set your peak capacity rather than your steady state. Meshes, skeletons, and the synapse table together stay under 20 TB — negligible in bytes, and the only products most analysts will ever open. Steady state roughly 2.5-3 PB, peak nearer 4 PB. Quote both numbers, because a plan sized to the steady state fails during reconstruction.

Step 3 — Count objects, not only bytes. At 128³ chunks the full-resolution level alone is about 7.5 x 10^8 objects, so one pipeline pass that reads and writes each chunk is 1.5 x 10^9 billable requests. That number, not the byte count, is what turns an affordable plan unaffordable — and it is the argument for sharding.

Step 4 — Ask where the compute is. If the bytes sit in cloud storage and the analysis runs on a university cluster, every pass crosses an egress boundary, and egress for one full-volume pass can cost more than a year of storing the same bytes. This question changes the architecture more than any format choice. If compute cannot move to the data, the rule becomes “download derived products, never voxels”.

Step 5 — Name the dominant query before writing it. For a weekly motif report that is joining every synapse to a current neuron identity. Per neuron against the live ChunkedGraph, this is hundreds of thousands of round trips; done once against a pinned materialization it produces an extract you can query locally in seconds all week.

What the estimate does not tell you. Not the project cost: proofreading labor, not compute or storage, is usually the dominant line item, and this module does not size it. The estimate also assumes 8-bit imagery and no lossy compression; compressing at 2-4x moves the raw figure but leaves the object count and the egress question unchanged.

Storage and query decision tables

Use these as starting positions and justify any departure.

Where the data lives Best when What it costs you
Cloud store, cloud compute Bursty, parallel, multi-site access Ongoing bill; per-request charges if unsharded; lock-in of formats and tooling
On-prem store, on-prem compute Steady single-site load, existing cluster Capital cost and capacity planning; you own every failure mode; hard to share externally
Cloud store, on-prem compute, local cache Analysts need derived products only Egress on every cache miss; you own cache invalidation when segmentation updates
Local mirror of derived products only Analysis-only groups, no pipeline role You can regenerate nothing; you inherit upstream’s decisions, including its errors
Query strategy Best when What it gives up
Live API lookups per object Small, interactive, current-state questions Per-call latency; unreproducible unless you log the timestamp; fails above ~10^5 objects
Pinned materialization version Anything that will be published Numbers are as of that version and differ from live state; you must say so in the methods
One-time extract to DuckDB/Parquet Repeated slicing of one subset all week The extract goes stale silently; needs a version-stamped filename and a refresh policy
Distributed scan over the full table One-off whole-dataset statistics Cost scales with bytes scanned; one exploratory typo can burn a month of budget

Hidden curriculum scaffold

Core workflow: scalable query planning

  1. Write the analysis question as a sentence naming the table, the filter, and the unit of the answer — for example, “count synapses between layer 2/3 pyramidal cells and basket cells, per neuron pair, at cleft score above threshold.”
  2. Estimate the working set: how many rows, how many objects, how many bytes must move, and whether that fits in memory on the machine you have.
  3. Choose storage and index strategy from the access pattern — chunk shape for volumetric reads, sharding if object counts exceed roughly 10^6, a pre-joined extract if the same join recurs.
  4. Pin the segmentation: record the materialization version or timestamp, and refuse to proceed if it is unknown.
  5. Prototype on a 0.1% sample, profile, and extrapolate the full runtime before running it once at full scale.
  6. Add provenance fields to the output artifact itself, not to the surrounding notebook.
  7. Validate reproducibility by having a second person re-run the query package from the recorded version and compare row counts and summary statistics.

Pre-class preparation

60-minute tutorial run-of-show

  1. 00:00-08:00 | Architecture framing and failure examples Open with two failure shapes: the eleven-hour query and the unreproducible figure. Both are design decisions made before any analysis, not accidents.
  2. 08:00-20:00 | Access-pattern to index mapping exercise Learners size a 1 mm³ volume by hand, then compute chunk counts at 64³, 128³, and 256³ and the byte cost of one 512 x 512 plane view at each. Instructor challenge: “Which is right, and what did you assume about how people read this volume?”
  3. 20:00-34:00 | Query profiling and bottleneck diagnosis Run a supplied query on a 0.1% sample, record wall time, extrapolate, then run the pre-joined version and write down the ratio.
  4. 34:00-46:00 | Provenance logging implementation Each learner adds a provenance block — dataset, version, query hash, thresholds, commit, date — to one of their own outputs and shows it to a neighbor.
  5. 46:00-56:00 | Team review of reproducibility gaps Pairs swap query packages and attempt to state, from the artifact alone, which segmentation version produced it. Any package that fails this test is marked and repaired.
  6. 56:00-60:00 | Competency check and next-step assignment Each learner names the single query that will dominate their own project’s cost, and the mitigation they will try first.

Studio activity: petascale query design lab

Scenario: Your team delivers a weekly motif-analysis report from a store holding a ~5 x 10^8-row synapse table, a 120,000-row segment table, and cell-type annotations for about 8,400 neurons. The volume is ~1 mm³, the bytes live in cloud object storage, and your analysis cluster is on-premises. The report is regenerated every Monday and will be cited in a manuscript. Last week’s run took nine hours and produced numbers that do not match the report from three weeks ago; nobody knows why.

Tasks

  1. Propose a storage and index layout for the expected query patterns: chunk shape, sharding decision, and which products you mirror locally, with a byte estimate for each.
  2. Outline the two queries that will dominate cost, estimate runtime from a sampled measurement, and name the operation you expect to be the bottleneck.
  3. Define the minimum provenance fields for the weekly output and state what happens operationally when one is missing.
  4. Diagnose the three-week discrepancy: list candidate causes in the order you would check them and the evidence that distinguishes them.
  5. Produce one optimization proposal with an expected speedup and its cost, and one reproducibility safeguard someone else could execute without you.

Expected outputs

Assessment rubric

Scale context: real-world numbers

To ground the abstract concepts, here are the data scales learners will encounter:

Dataset Raw volume Neurons Synapses Storage
MICrONS (minnie65) 1 mm³ mouse V1 ~80,000 ~500M ~2 PB
H01 ~1 mm³ human temporal cortex ~57,000 cells ~150M ~1.4 PB
FlyWire Whole adult Drosophila brain ~139,255 ~54.5M ~100 TB
MouseConnects (planned) ~10 mm³ mouse hippocampus TBD TBD >10 PB

Teaching point: “When your synapse table has 500 million rows, a poorly written query doesn’t just run slowly — it may not finish at all. Architecture decisions determine whether your science is feasible.”

Key tools and formats

Tool/Format Purpose When to use
Zarr/N5 Chunked array storage Volumetric data, cloud-friendly
Neuroglancer precomputed Multiscale image pyramids Web browsing of EM/segmentation
CAVEclient Python API for CAVE tables Synapse queries, annotation access
CloudVolume Python API for volumetric data Image/segmentation chunk access
pandas/Dask Tabular data manipulation Synapse tables, annotation analysis
BigQuery/DuckDB SQL on large tables Complex joins on synapse/annotation tables

Common errors and how to recover

What this module does not cover

Content library references

Teaching resources

References

Quick practice prompt

Document one query you use with:

  1. data source/version,
  2. expected runtime class,
  3. one provenance field you currently miss.

Teaching Materials

Activity Worksheet

Learner worksheet aligned to the studio activity and rubric.

Open worksheet

Slide Source

Marp source file for editing and rendering.

course/decks/marp/modules/module12.marp.md

Related Content