Earlier findings checked on dandiset 000489 version 0.230518.1811¶
This notebook belongs to the reconciliation of attempt kim-2022-02 with attempt kim-2022-01
(docs/protocol.md, "Repeat attempts"). Of the eight findings of kim-2022-01, six are reported
again by kim-2022-02. The two it did not report, findings 4 and 7, are checked here directly on
DANDI:000489 version 0.230518.1811,
the version both attempts used. Each section opens with the earlier statement. The data are
streamed with the entry's helper module, kim2022.py.
import re
from concurrent.futures import ProcessPoolExecutor
import numpy as np
import pandas as pd
import kim2022 as k
pd.set_option("display.width", 200)
assets = k.list_assets("000489")
print("version:", k.VERSIONS["000489"], "| files:", len(assets))
version: 0.230518.1811 | files: 18
Earlier finding 4 (format_error)¶
Each stitched two-channel image is stored as an ImageSeries with data of shape (22323, 22323, 2) and a starting_time rate of 2 Hz. As an ImageSeries the first axis is time, so the file reads as 22323 frames of 22323 x 2 pixels; an Images container with two GrayscaleImage objects, or a series of shape (1, 22323, 22323) per channel, would describe it. The unit is n.a. and the three 25% files share the acquisition name Fig2_25.
The type, shape, rate and unit of each file's acquisition object, and the series name of each file, read from the file metadata only.
def series_meta(asset):
with k.open_nwb("000489", asset["asset_id"]) as f:
acq = f["acquisition"]
rows = []
for name in acq:
s = acq[name]
rows.append({
"subject_id": f["general/subject/subject_id"][()].decode(),
"session_start": f["session_start_time"][()].decode()[:10],
"acquisition": name,
"type": s.attrs.get("neurodata_type"),
"shape": s["data"].shape,
"rate_Hz": float(s["starting_time"].attrs["rate"]) if "starting_time" in s else None,
"unit": s["data"].attrs.get("unit"),
"session_id": f["general/session_id"][()].decode(),
})
return rows
meta = pd.DataFrame([r for a in assets for r in series_meta(a)])
meta.insert(0, "path", [a["path"].split("/")[0] for a in assets])
print(meta.to_string(index=False))
path subject_id session_start acquisition type shape rate_Hz unit session_id
sub-Fig1F Fig1F 2021-09-01 Channel1 and Channel2 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_staining
sub-Fig2-0-03 Fig2_0_03 2021-07-29 Fig2_0_03 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_0 percent
sub-Fig2-0-06 Fig2_0_06 2021-07-29 Fig2_0_06 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_0 percent
sub-Fig2-0-07 Fig2_0_07 2021-07-29 Fig2_0_07 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_0 percent
sub-Fig2-100-03 Fig2_100_03 2021-08-24 Fig2_100_03 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_100 percent
sub-Fig2-100-07 Fig2_100_07 2021-08-24 Fig2_100_07 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_100 percent
sub-Fig2-100-08 Fig2_100_08 2021-08-24 Fig2_100_08 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_100 percent
sub-Fig2-25-04 Fig2_25_04 2021-07-26 Fig2_25 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_25 percent
sub-Fig2-25-10 Fig2_25_10 2021-07-29 Fig2_25 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_25 percent
sub-Fig2-25-14 Fig2_25_14 2021-07-29 Fig2_25 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_25 percent
sub-Fig2-50-06 Fig2_50_06 2021-07-26 Fig2_50_06 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_50 percent
sub-Fig2-50-10 Fig2_50_10 2021-07-26 Fig2_50_10 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_50 percent
sub-Fig2-50-12 Fig2_50_12 2021-07-26 Fig2_50_12 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_50 percent
sub-Fig2-50-13 Fig2_50_13 2021-07-29 Fig2_50_13 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_50 percent
sub-Fig2-50-18 Fig2_50_18 2021-07-29 Fig2_50_18 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_50 percent
sub-Fig2-75-02 Fig2_75_02 2021-08-24 Fig2_75_02 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_75 percent
sub-Fig2-75-05 Fig2_75_05 2021-08-24 Fig2_75_05 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_75 percent
sub-Fig2-75-10 Fig2_75_10 2021-08-24 Fig2_75_10 ImageSeries (22323, 22323, 2) 2.0 n.a. BPAE_bipolar_75 percent
fig2 = meta[meta.subject_id.str.startswith("Fig2")]
print("acquisition objects per file:", meta.groupby("path").size().unique().tolist())
print("types:", meta.type.value_counts().to_dict())
print("shapes:", meta["shape"].astype(str).value_counts().to_dict())
print("first axis (time for an ImageSeries) length:", sorted(set(s[0] for s in meta["shape"])),
"| last axis length:", sorted(set(s[-1] for s in meta["shape"])))
print("starting_time rate (Hz):", meta.rate_Hz.value_counts().to_dict(), "| unit:", meta.unit.value_counts().to_dict())
dup = fig2.groupby("acquisition").subject_id.apply(list)
print("acquisition names shared by more than one Fig. 2 file:", dup[dup.apply(len) > 1].to_dict())
acquisition objects per file: [1]
types: {'ImageSeries': 18}
shapes: {'(22323, 22323, 2)': 18}
first axis (time for an ImageSeries) length: [22323] | last axis length: [2]
starting_time rate (Hz): {2.0: 18} | unit: {'n.a.': 18}
acquisition names shared by more than one Fig. 2 file: {'Fig2_25': ['Fig2_25_04', 'Fig2_25_10', 'Fig2_25_14']}
The cell above shows whether the layout, rate and unit of the earlier finding are still there.
The conclusion for this finding is in the reconciliation block of attempts/kim-2022-02.yaml.
Earlier finding 7 (selection_undocumented)¶
Dish numbers in the subject ids run up to 18 (sub-Fig2-50-18), so more dishes were exposed than deposited, and nothing says which dishes form Fig. 2. All unipolar dishes are from 2021-07-29 and all 75% and 100% dishes from 2021-08-24, a day with no unipolar dish. In these files the 100% dishes show more uptake than the unipolar ones (largest mean 761.0 against 571.1 a.u.), which does not match Fig. 2C, where every second phase inhibits uptake.
Dish numbers and session dates from the file metadata, the dandiset description, and the YP of the unipolar and 100% dishes along bb', measured with the helper's ROI (200 um squares from the midpoint between the electrodes to 3 mm on both sides, the two ROI at each distance averaged per dish). sub-Fig2-0-03 is left out of the uptake comparison, as its YP channel is the image of sub-Fig2-25-04 (kim-2022-02, finding 3).
fig2 = fig2.assign(amp=[int(re.match(r"Fig2_(\d+)_(\d+)", s).group(1)) for s in fig2.subject_id],
dish_no=[int(re.match(r"Fig2_(\d+)_(\d+)", s).group(2)) for s in fig2.subject_id])
print(fig2[["subject_id", "amp", "dish_no", "session_start"]].sort_values(["amp", "dish_no"]).to_string(index=False))
print("Fig. 2 files:", len(fig2), "| highest dish number:", fig2.dish_no.max(),
"| dishes per amplitude:", fig2.groupby("amp").size().to_dict())
print("session dates per amplitude:", fig2.groupby("amp").session_start.apply(lambda s: sorted(set(s))).to_dict())
print("amplitudes per session date:", fig2.groupby("session_start").amp.apply(lambda s: sorted(set(s))).to_dict())
desc = k.version_info("000489")["metadata"]["description"]
print("dandiset description:", desc)
print("description mentions selection, exclusion or dish numbers:",
{w: (w in desc.lower()) for w in ["select", "exclu", "dish", "replicate", "all experiments"]})
subject_id amp dish_no session_start
Fig2_0_03 0 3 2021-07-29
Fig2_0_06 0 6 2021-07-29
Fig2_0_07 0 7 2021-07-29
Fig2_25_04 25 4 2021-07-26
Fig2_25_10 25 10 2021-07-29
Fig2_25_14 25 14 2021-07-29
Fig2_50_06 50 6 2021-07-26
Fig2_50_10 50 10 2021-07-26
Fig2_50_12 50 12 2021-07-26
Fig2_50_13 50 13 2021-07-29
Fig2_50_18 50 18 2021-07-29
Fig2_75_02 75 2 2021-08-24
Fig2_75_05 75 5 2021-08-24
Fig2_75_10 75 10 2021-08-24
Fig2_100_03 100 3 2021-08-24
Fig2_100_07 100 7 2021-08-24
Fig2_100_08 100 8 2021-08-24
Fig. 2 files: 17 | highest dish number: 18 | dishes per amplitude: {0: 3, 25: 3, 50: 5, 75: 3, 100: 3}
session dates per amplitude: {0: ['2021-07-29'], 25: ['2021-07-26', '2021-07-29'], 50: ['2021-07-26', '2021-07-29'], 75: ['2021-08-24'], 100: ['2021-08-24']}
amplitudes per session date: {'2021-07-26': [25, 50], '2021-07-29': [0, 25, 50], '2021-08-24': [75, 100]}
dandiset description: Cells were electroporated by a train of 5 unipolar 600 ns pulses (0 percent) or bipolar 600 + 600 ns pulses (25, 50, 75, 100 percent) at 1 Hz. 25, 50, 75, and 100% represent the second pulse's amplitude in relation to the first pulse's amplitude. 0% represents a unipolar pulse, where no second pulse was applied. The electrodes were two parallel stainless-steel cylinders, 1.5 mm in diameter and 3 mm apart. Supported by NIH 1R21EY034258
description mentions selection, exclusion or dish numbers: {'select': False, 'exclu': False, 'dish': False, 'replicate': False, 'all experiments': False}
use = [a for a in assets if re.search(r"sub-Fig2-(0|100)-", a["path"]) and "sub-Fig2-0-03" not in a["path"]]
with ProcessPoolExecutor(3) as ex:
dishes = list(ex.map(k.process_dish, use))
rows = []
for d in dishes:
amp = int(re.match(r"Fig2_(\d+)_", d["subject_id"]).group(1))
for r in d["rois"]:
rows.append({"dish": d["subject_id"], "amp": amp, "abs_off": round(abs(r["offset_mm"]), 1),
"field": r["field_kv_cm"], "YP": r["YP"]})
t = pd.DataFrame(rows).groupby(["amp", "dish", "abs_off"]).agg(YP=("YP", "mean"), field=("field", "mean")).reset_index()
m = t.groupby(["amp", "abs_off"]).agg(mean=("YP", "mean"), sem=("YP", "sem"), field=("field", "mean")).reset_index()
tab = m.pivot(index="abs_off", columns="amp", values="mean")
tab["100% as % of unipolar"] = 100 * tab[100] / tab[0]
tab["field (model, kV/cm)"] = m[m.amp == 0].set_index("abs_off").field
print("dishes:", t.groupby("amp").dish.unique().apply(list).to_dict())
print("mean YP (a.u.) per distance from the centre (mm):")
print(tab.round(1).to_string())
print("largest mean YP: unipolar %.1f, 100%% %.1f a.u." % (tab[0].max(), tab[100].max()))
near = tab.loc[tab.index <= 2.0]
print("ROI within 2 mm where the 100%% mean exceeds the unipolar mean: %d of %d (100%% at %.1f to %.1f%% of unipolar)"
% ((near[100] > near[0]).sum(), len(near), near["100% as % of unipolar"].min(), near["100% as % of unipolar"].max()))
print("YP per dish and distance (a.u.):")
print(t.pivot_table(index=["amp", "dish"], columns="abs_off", values="YP").round(0).to_string())
dishes: {0: ['Fig2_0_06', 'Fig2_0_07'], 100: ['Fig2_100_03', 'Fig2_100_07', 'Fig2_100_08']}
mean YP (a.u.) per distance from the centre (mm):
amp 0 100 100% as % of unipolar field (model, kV/cm)
abs_off
0.0 650.8 745.6 114.6 15.4
0.2 556.5 750.5 134.9 15.2
0.4 570.7 691.0 121.1 14.8
0.6 519.6 485.1 93.4 14.2
0.8 460.7 450.1 97.7 13.5
1.0 356.6 403.3 113.1 12.6
1.2 245.4 294.0 119.8 11.7
1.4 150.5 209.1 138.9 10.7
1.6 113.5 142.8 125.8 9.8
1.8 87.9 106.6 121.3 8.9
2.0 36.0 99.4 275.9 8.1
2.2 43.3 67.6 156.3 7.4
2.4 18.6 52.7 283.0 6.7
2.6 11.7 43.2 369.4 6.1
2.8 15.3 48.7 318.6 5.6
3.0 6.8 28.5 417.3 5.1
largest mean YP: unipolar 650.8, 100% 750.5 a.u.
ROI within 2 mm where the 100% mean exceeds the unipolar mean: 9 of 11 (100% at 93.4 to 275.9% of unipolar)
YP per dish and distance (a.u.):
abs_off 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
amp dish
0 Fig2_0_06 547.0 590.0 678.0 733.0 593.0 505.0 342.0 206.0 127.0 74.0 32.0 67.0 25.0 5.0 9.0 22.0
Fig2_0_07 754.0 523.0 464.0 306.0 328.0 208.0 149.0 95.0 100.0 102.0 40.0 19.0 12.0 18.0 22.0 -9.0
100 Fig2_100_03 655.0 496.0 408.0 321.0 248.0 264.0 195.0 192.0 129.0 72.0 64.0 47.0 40.0 54.0 65.0 23.0
Fig2_100_07 774.0 829.0 779.0 515.0 592.0 539.0 364.0 208.0 172.0 136.0 130.0 81.0 59.0 30.0 56.0 42.0
Fig2_100_08 808.0 927.0 886.0 619.0 511.0 406.0 323.0 227.0 127.0 111.0 105.0 74.0 59.0 46.0 25.0 20.0
The cells above give the dish numbers, dates and uptake on which the reconciliation's conclusion for this finding rests.