Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 000039/AllenInstitute/Contrast_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@
"outputs": [],
"source": [
"dandiset_id = '000039'\n",
"dandiset_version = \"0.230223.1216\"\n",
"filepath = \"sub-699590236/sub-699590236_ses-724712005_behavior+ophys.nwb\"\n",
"with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(filepath)\n",
" asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(filepath)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)"
]
},
Expand Down
5 changes: 3 additions & 2 deletions 000039/AllenInstitute/Create_manifest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@
},
"outputs": [],
"source": [
"dandiset_id = '000039'"
"dandiset_id = '000039'",
"dandiset_version = \"0.230223.1216\""
]
},
{
Expand All @@ -212,7 +213,7 @@
},
"outputs": [],
"source": [
"ds = client.get_dandiset(dandiset_id)"
"ds = client.get_dandiset(dandiset_id, dandiset_version)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion 000055/BruntonLab/peterson21/Fig_coarse_labels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"outputs": [],
"source": [
"with DandiAPIClient() as client:\n",
" asset = clieconnt.get_dandiset(\"000055\", \"draft\").get_asset_by_path(\n",
" asset = clieconnt.get_dandiset(\"000055\", \"0.220127.0436\").get_asset_by_path(\n",
" \"sub-01/sub-01_ses-4_behavior+ecephys.nwb\"\n",
" )\n",
" s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
Expand Down
6 changes: 3 additions & 3 deletions 000055/BruntonLab/peterson21/compute_cont_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Determine all file paths
with DandiAPIClient() as client:
paths = []
for file in client.get_dandiset("000055", "draft").get_assets_under_path(""):
for file in client.get_dandiset("000055", "0.220127.0436").get_assets_under_path(""):
paths.append(file.path)
paths = natsort.natsorted(paths)

Expand All @@ -31,7 +31,7 @@
for s in range(n_parts):
fid = [val for val in paths if "sub-" + str(s + 1).zfill(2) in val][0]
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid)
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid)
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)

with NWBHDF5IO(s3_path, mode="r", load_namespaces=True, driver="ros3") as io:
Expand Down Expand Up @@ -77,7 +77,7 @@
pows_sbj = None
for j, fid in enumerate(fids):
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid)
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid)
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)

with NWBHDF5IO(s3_path, mode="r", load_namespaces=True, driver="ros3") as io:
Expand Down
2 changes: 1 addition & 1 deletion 000055/BruntonLab/peterson21/dashboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"outputs": [],
"source": [
"with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(\"000055\", \"draft\").get_asset_by_path(\n",
" asset = client.get_dandiset(\"000055\", \"0.220127.0436\").get_asset_by_path(\n",
" \"sub-01/sub-01_ses-4_behavior+ecephys.nwb\"\n",
" )\n",
" s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
Expand Down
16 changes: 8 additions & 8 deletions 000055/BruntonLab/peterson21/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def clabel_table_create(
Labels to include in the table are specified by common_acts."""
with DandiAPIClient() as client:
paths = []
for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""):
for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""):
paths.append(file.path)
paths = natsort.natsorted(paths)

Expand All @@ -149,7 +149,7 @@ def clabel_table_create(
fids = [val for val in paths if "sub-" + str(part_ind + 1).zfill(2) in val]
for fid in fids:
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid)
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid)
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)
with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io:
nwb = io.read()
Expand Down Expand Up @@ -208,7 +208,7 @@ def load_data_characteristics(nparts=12):
and number of recording days for each participant."""
with DandiAPIClient() as client:
paths = []
for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""):
for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""):
paths.append(file.path)
paths = natsort.natsorted(paths)

Expand All @@ -220,7 +220,7 @@ def load_data_characteristics(nparts=12):
rec_days.append(len(fids))
for fid in fids[:1]:
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid)
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid)
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)
with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io:
nwb = io.read()
Expand Down Expand Up @@ -280,7 +280,7 @@ def plot_ecog_descript(
electrodes side by side."""
with DandiAPIClient() as client:
paths = []
for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""):
for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""):
paths.append(file.path)
paths = natsort.natsorted(paths)

Expand All @@ -303,7 +303,7 @@ def plot_ecog_descript(
# Load NWB data file
fids = [val for val in paths if "sub-" + str(part_ind + 1).zfill(2) in val]
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fids[0])
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fids[0])
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)
with NWBHDF5IO(s3_path, mode="r", driver="ros3") as io:
nwb = io.read()
Expand Down Expand Up @@ -872,7 +872,7 @@ def _get_wrist_trajs(
"""Load in wrist trajectories around move onset events."""
with DandiAPIClient() as client:
paths = []
for file in client.get_dandiset("000055", "draft").get_assets_with_path_prefix(""):
for file in client.get_dandiset("000055", "0.220127.0436").get_assets_with_path_prefix(""):
paths.append(file.path)
paths = natsort.natsorted(paths)

Expand All @@ -881,7 +881,7 @@ def _get_wrist_trajs(
fids = [val for val in paths if "sub-" + str(pat + 1).zfill(2) in val]
for i, fid in enumerate(fids):
with DandiAPIClient() as client:
asset = client.get_dandiset("000055", "draft").get_asset_by_path(fid)
asset = client.get_dandiset("000055", "0.220127.0436").get_asset_by_path(fid)
s3_path = asset.get_content_url(follow_redirects=1, strip_query=True)
with NWBHDF5IO(
s3_path, mode="r", driver="ros3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
{
"cell_type": "code",
"source": [
"! dandi download https://dandiarchive.org/dandiset/000129/draft"
"! dandi download https://dandiarchive.org/dandiset/000129/0.241017.1444"
],
"metadata": {
"colab": {
Expand Down
3 changes: 2 additions & 1 deletion 000363/MAP/demo/browse_map_ephys_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,7 @@
"outputs": [],
"source": [
"dandiset_id = \"000363\" \n",
"dandiset_version = \"0.231012.2129\"\n",
"filepath = \"sub-440956/sub-440956_ses-20190207T120657_behavior+ecephys+ogen.nwb\""
]
},
Expand All @@ -1976,7 +1977,7 @@
],
"source": [
"with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(dandiset_id, \"draft\").get_asset_by_path(filepath)\n",
" asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(filepath)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
"fs=fsspec.filesystem(\"http\")\n",
"file = h5py.File(fs.open(s3_url, \"rb\"))\n",
Expand Down
2 changes: 1 addition & 1 deletion 000402/MICrONS/coregistration/microns_nwb_coreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
def get_microns_nwb_file(session_no:int, scan_no:int):
file_path = f"sub-17797/sub-17797_ses-{session_no}-scan-{scan_no}_behavior+image+ophys.nwb"
with DandiAPIClient() as client:
asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)
asset = client.get_dandiset(DANDISET_ID, "0.230307.2132").get_asset_by_path(file_path)
s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)

# First, create a virtual filesystem based on the http protocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@
"scan_unit_row = scan_units[(scan_units['session']==session_no)&(scan_units['scan_idx']==scan_no)&(scan_units['unit_id']==unit_id)]\n",
"\n",
"dandiset_id = \"000402\"\n",
"dandiset_version = \"0.230307.2132\"\n",
"\n",
"display((session_no, scan_no, unit_id))"
]
Expand Down Expand Up @@ -709,7 +710,7 @@
"def get_NWBFile(session_no, scan_no):\n",
" file_path = f\"sub-17797/sub-17797_ses-{session_no}-scan-{scan_no}_behavior+image+ophys.nwb\"\n",
" with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
"\n",
" # First, create a virtual filesystem based on the http protocol\n",
Expand Down
9 changes: 5 additions & 4 deletions 000402/MICrONS/demo/000402_microns_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"source": [
"# MICrONS NWB tutorial\n",
"\n",
"This tutorial demonstrates how to access the [MICrONS functional data](https://dandiarchive.org/dandiset/000402/draft) using `dandi`.\n",
"This tutorial demonstrates how to access the [MICrONS functional data](https://dandiarchive.org/dandiset/000402/0.230307.2132) using `dandi`.\n",
"\n",
"The functional data from the [MICrONS project](https://www.microns-explorer.org/cortical-mm3) contains calcium imaging recorded from multiple cortical visual areas and behavioral measurements while a mouse viewed natural movies and parametric stimuli.\n",
"\n",
Expand Down Expand Up @@ -205,11 +205,12 @@
"from dandi.dandiapi import DandiAPIClient\n",
"\n",
"dandiset_id = \"000402\"\n",
"dandiset_version = \"0.230307.2132\"\n",
"file_path = \"sub-17797/sub-17797_ses-9-scan-4_behavior+image+ophys.nwb\" # file size ~67GB\n",
"\n",
"# Get the location of the file on DANDI\n",
"with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)"
]
},
Expand Down Expand Up @@ -2535,7 +2536,7 @@
"\n",
"# The file path on DANDI\n",
"with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(dandiset_id, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(dandiset_id, dandiset_version).get_asset_by_path(file_path)\n",
" dandiset_url = asset.api_url\n",
"\n",
"# Download the file\n",
Expand All @@ -2555,7 +2556,7 @@
"source": [
"# Downloading all NWB files for this dandiset\n",
"\n",
"# dandiset_url = \"https://dandiarchive.org/dandiset/000402/draft\"\n",
"# dandiset_url = \"https://dandiarchive.org/dandiset/000402/0.230307.2132\"\n",
"# dandi_download(urls=dandiset_url, output_dir=dandiset_folder_path, get_metadata=True, get_assets=True)"
]
}
Expand Down
3 changes: 2 additions & 1 deletion 000409/IBL/bwm_usage_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@
"\n",
"# Connect to DANDI and get the dandiset\n",
"dandiset_id = \"000409\"\n",
"dandiset_version = \"0.260309.1324\"\n",
"client = DandiAPIClient()\n",
"dandiset = client.get_dandiset(dandiset_id, \"draft\")\n",
"dandiset = client.get_dandiset(dandiset_id, dandiset_version)\n",
"\n",
"# =============================================================================\n",
"# Session EIDs for NEW format files (desc-raw / desc-processed)\n",
Expand Down
7 changes: 4 additions & 3 deletions 000458/AllenInstitute/reanalysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"def stream_nwbfile(DANDISET_ID, file_path):\n",
"def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION):\n",
" '''Stream NWB file from DANDI archive.\n",
" \n",
" Parameters\n",
Expand All @@ -200,7 +200,7 @@
" The io object must be closed after use.\n",
" '''\n",
" with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
" # remfile is tuned for HDF5 access patterns (many small scattered reads);\n",
" # a generic HTTP file object over-fetches and makes opening large files\n",
Expand Down Expand Up @@ -1075,8 +1075,9 @@
],
"source": [
"DANDISET_ID = \"000458\"\n",
"DANDISET_VERSION = \"0.230317.0039\"\n",
"file_path = \"sub-586468/sub-586468_ses-20210819_behavior+ecephys.nwb\"\n",
"nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)\n",
"nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)\n",
"# print() summarizes the file from metadata alone; the rich display() repr\n",
"# pulls preview slices of every dataset over the network (minutes on a 22 GB file)\n",
"print(nwbfile)"
Expand Down
5 changes: 3 additions & 2 deletions 000458/FlatironInstitute/000_lindi_vs_fsspec_streaming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
" The io object must be closed after use.\n",
" '''\n",
" with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n",
" asset_url = asset.get_content_url(follow_redirects=0, strip_query=True)\n",
" file = lindi.LindiH5pyFile.from_hdf5_file(asset_url)\n",
" io = NWBHDF5IO(file=file, load_namespaces=True)\n",
Expand Down Expand Up @@ -247,7 +247,7 @@
" The io object must be closed after use.\n",
" '''\n",
" with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n",
" asset_url = asset.get_content_url(follow_redirects=0, strip_query=True)\n",
" fs = filesystem(\"http\")\n",
" file_system = fs.open(asset_url, \"rb\")\n",
Expand All @@ -258,6 +258,7 @@
"\n",
"\n",
"DANDISET_ID = \"000458\"\n",
"DANDISET_VERSION = \"0.230317.0039\"\n",
"file_path = \"sub-586468/sub-586468_ses-20210819_behavior+ecephys.nwb\"\n",
"\n",
"timer = time.time()\n",
Expand Down
3 changes: 2 additions & 1 deletion 000458/FlatironInstitute/001_summarize_contents.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@
"\n",
"\n",
"DANDISET_ID = \"000458\"\n",
"DANDISET_VERSION = \"0.230317.0039\"\n",
"\n",
"parsed_url = da.parse_dandi_url(f\"https://dandiarchive.org/dandiset/{DANDISET_ID}\")\n",
"\n",
Expand All @@ -991,7 +992,7 @@
" \"download_url\": asset_obj.download_url,\n",
" \"dandiset_id\": DANDISET_ID,\n",
" }\n",
" nwbfile, io = stream_nwbfile(DANDISET_ID, asset[\"path\"])\n",
" nwbfile, io = stream_nwbfile(DANDISET_ID, asset[\"path\"], DANDISET_VERSION)\n",
" md = ''\n",
" ns_url = f'https://neurosift.app/?p=/nwb&url={asset[\"download_url\"]}&dandisetId={DANDISET_ID}'\n",
" md += f'**Asset {asset_index + 1}: [{asset[\"path\"]}]({ns_url})**\\n\\n'\n",
Expand Down
6 changes: 4 additions & 2 deletions 000458/FlatironInstitute/helpers/stream_nwbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import lindi


def stream_nwbfile(DANDISET_ID, file_path):
def stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION="draft"):
'''Stream NWB file from DANDI archive.

Parameters
Expand All @@ -14,6 +14,8 @@ def stream_nwbfile(DANDISET_ID, file_path):
Dandiset ID
file_path : str
Path to NWB file in DANDI archive
DANDISET_VERSION : str
Dandiset version, e.g. a published version such as "0.230317.0039"

Returns
-------
Expand All @@ -27,7 +29,7 @@ def stream_nwbfile(DANDISET_ID, file_path):
The io object must be closed after use.
'''
with DandiAPIClient() as client:
asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)
asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)
asset_url = asset.get_content_url(follow_redirects=0, strip_query=True)
file = lindi.LindiH5pyFile.from_hdf5_file(asset_url)
io = NWBHDF5IO(file=file, load_namespaces=True)
Expand Down
3 changes: 2 additions & 1 deletion 000559/dattalab/markowitz_gillis_nature_2023/read_avi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
" Number of chunks to read from the file. If None, read the whole file.\n",
" '''\n",
" with DandiAPIClient() as client:\n",
" asset = client.get_dandiset(DANDISET_ID, 'draft').get_asset_by_path(file_path)\n",
" asset = client.get_dandiset(DANDISET_ID, DANDISET_VERSION).get_asset_by_path(file_path)\n",
" s3_url = asset.get_content_url(follow_redirects=1, strip_query=True)\n",
" fs = filesystem(\"http\")\n",
" file_system = fs.open(s3_url, \"rb\")\n",
Expand Down Expand Up @@ -306,6 +306,7 @@
"outputs": [],
"source": [
"DANDISET_ID = '000559'\n",
"DANDISET_VERSION = \"0.260528.0858\"\n",
"avi_file_path = 'sub-10/sub-10_ses-reinforcement-0e0aca4f-6a99-46eb-9eb8-439f36e66c40_behavior+image+ogen/f9af8a18-7cab-471c-802f-6937edeaec68_external_file_0.avi'\n",
"num_chunks = 10 # Use None to read the whole file\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@
"source": [
"from stream_nwbfile import stream_nwbfile\n",
"DANDISET_ID = '000559'\n",
"DANDISET_VERSION = \"0.260528.0858\"\n",
"file_path = ('sub-dlight-chrimson-1/sub-dlight-chrimson-1_'\n",
" 'ses-reinforcement-photometry-2891f649-4fbd-4119-a807-b8ef507edfab_behavior+image+ogen+ophys.nwb'\n",
")\n",
"nwbfile, io = stream_nwbfile(DANDISET_ID, file_path)"
"nwbfile, io = stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"from stream_nwbfile import stream_nwbfile\n",
"\n",
"DANDISET_ID = '000559'\n",
"DANDISET_VERSION = \"0.260528.0858\"\n",
"hek_path = 'sub-HEK293'\n",
"file_paths = [\n",
" hek_path + '/sub-HEK293_ses-exp3_ophys.nwb',\n",
Expand All @@ -231,7 +232,7 @@
"]\n",
"\n",
"\n",
"nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path) for file_path in tqdm(file_paths)])"
"nwbfiles, ios = zip(*[stream_nwbfile(DANDISET_ID, file_path, DANDISET_VERSION) for file_path in tqdm(file_paths)])"
]
},
{
Expand Down
Loading
Loading