Allen Institute Openscope - Dendritic Coupling project

Allen Institute Openscope - Dendritic Coupling project. Neurophysiology / NWB data on the DANDI Archive (2356 assets, 38.4 TB). License: spdx:CC-BY-4.0.

Category
Neuroscience
Provider
Pina, Jason E.
License
spdx:CC-BY-4.0
DOI
10.48324/dandi.000336/0.260325.1802
Hosted on
Amazon S3, bucket dandiarchive/dandisets/000336, us-east-2
Access
Free and public. No account with the data provider is needed.
Source
https://dandiarchive.org/dandiset/000336
Data structure and loading code

Fields

assets.jsonld[]path, contentSize, encodingFormat (appli
dandiset.jsonldname, description, license, doi, citatio
nwb_version [ophys]2.3.0
general/subject [ophys]age=P84.0D; description=external: 662470
acquisition/ [ophys]EyeTracking (EllipseEyeTracking), v_in (
processing/ophys [ophys]images:Images, ophys_motion_correction_x
processing/running [ophys]dx:TimeSeries, speed:TimeSeries, speed_u
processing/stimulus [ophys]timestamps:TimeSeries
processing/stimulus_ophys [ophys]timestamps:TimeSeries
intervals/ [ophys]fixed_gabors_presentations (3,000 rows:
general/optophysiology [ophys]imaging_plane, imaging_plane_1
nwb_version [image+ophys]2.3.0
general/subject [image+ophys]age=P92.0D; description=external: 698808
acquisition/ [image+ophys]EyeTracking (EllipseEyeTracking), v_in (
processing/ophys [image+ophys]corrected_fluorescence:Fluorescence, dff
processing/running [image+ophys]dx:TimeSeries, speed:TimeSeries, speed_u
processing/stimulus [image+ophys]timestamps:TimeSeries
processing/stimulus_ophys [image+ophys]timestamps:TimeSeries
intervals/ [image+ophys]fixed_gabors_presentations (3,000 rows:
stimulus/templates [image+ophys]flower_fwd, touch_of_evil_fwd, worms_fwd

and 4 more

Load the data

import json, os, glob, collections
M = os.environ.get("SCIGANTIC_MOUNT_PATH", "/mnt/archive")
# The mount holds ONLY the dandiset metadata; the NWB files are content-addressed blobs elsewhere in the
# public dandiarchive bucket. assets.jsonld maps each logical path to its blob URL.
versions = sorted(d for d in os.listdir(M) if os.path.isdir(f"{M}/{d}"))
ver = "0.260325.1802" if "0.260325.1802" in versions else versions[-1]
assets = json.load(open(f"{M}/{ver}/assets.jsonld"))
assets = assets.get("@graph", assets) if isinstance(assets, dict) else assets
print(f"version {ver}: {len(assets)} assets, {sum(a.get('contentSize', 0) for a in assets)/1e9:.1f} GB")
def blob_key(a):
    return next((u.split(".s3.amazonaws.com/", 1)[1] for u in a.get("contentUrl", []) if ".s3.amazonaws.com/" in u), None)
import re
def kind(path):   # BIDS-style suffix = last "_" token without a "-"; none => bare "session" file
    if not path.endswith(".nwb"): return os.path.splitext(path)[1] or "other"
    toks = os.path.basename(path).rsplit(".", 1)[0].split("_")
    suffix = toks[-1] if len(toks) > 1 and "-" not in toks[-1] else "session"
    return ("probe-" if any(t.startswith("probe-") for t in toks) else "") + suffix
kinds = collections.Counter(kind(a["path"]) for a in assets)
print("file kinds:", dict(kinds))

# Open the smallest NWB of one kind lazily over anonymous S3 (h5py + s3fs; nothing is downloaded whole).
nwbs = sorted((a for a in assets if kind(a["path"]) == "ophys"), key=lambda a: a.get("contentSize", 0))
a = nwbs[0] if nwbs else sorted(assets, key=lambda a: a.get("contentSize", 0))[0]
key = blob_key(a); print("opening", a["path"], f"({a['contentSize']/1e6:.0f} MB) ->", key)
import h5py, s3fs
fs = s3fs.S3FileSystem(anon=True)
f = h5py.File(fs.open(f"dandiarchive/{key}", "rb", block_size=4 * 1024 * 1024), "r")
txt = lambda v: v.decode() if isinstance(v, bytes) else v
print("nwb", f.attrs.get("nwb_version"), "|", txt(f["session_description"][()]))
print("subject:", {k: txt(f["general/subject"][k][()]) for k in f["general/subject"]} if "general/subject" in f else "-")
print("acquisition:", list(f["acquisition"].keys())[:12])
print("processing:", {m: list(f["processing"][m].keys())[:8] for m in f["processing"]} if "processing" in f else {})
print("intervals:", list(f["intervals"].keys()) if "intervals" in f else [], "| units:", f["units/id"].shape[0] if "units" in f else 0)

# The same file through pynwb (preinstalled), still lazy:
from pynwb import NWBHDF5IO
io = NWBHDF5IO(file=f, mode="r", load_namespaces=True)
nwb = io.read(); print(nwb.identifier, "|", nwb.session_start_time)
print(nwb.intervals["fixed_gabors_presentations"].to_dataframe().head())

Written for a Scigantic notebook, where /mnt/archive is the mounted dataset.

Analyze this dataset without downloading it

On Scigantic, Allen Institute Openscope - Dendritic Coupling project opens in a hosted JupyterLab notebook with the data already mounted, so you can read files where they are stored instead of copying them first. Each notebook includes an AI assistant that can see the mounted files and write and run analysis code. Open the dataset page to launch a notebook, or browse the full catalog.

Related Neuroscience datasets