Rozsa et al. (2023) on DANDI:000341, part 1: slice recordings without induction groups¶

Paper: Rozsa, Toth, Olah, Baka, Lakovics, Barzo and Tamas (2023), "Temporal disparity of action potentials triggered in axon initial segments and distal axons in the neocortex", Sci. Adv. 9, eade4511, doi:10.1126/sciadv.ade4511. Claims file: claims/rozsa-2023.yaml, written from the version of record (Europe PMC full text) and its supplement.

Dataset: DANDI:000341, version 0.241220.1312 (doi:10.48324/dandi.000341/0.241220.1312). It is the only published version; the paper cites the dandiset without a version, so the most recent published version is pinned. The draft has the same 787 assets and size.

This notebook covers the ZD7288 recordings (folder Persistent_RAF_ZD7288), the soma and bleb recordings (Axonal_bleb_recording), the active human slices (In_vitro_Human_elevated_neuronal_activity) and the active rat slices with layer 5 LFP (In_vitro_oscillation_Rat). The induction recordings are in reproduce_rozsa_2023_induction.ipynb, the in vivo recordings in reproduce_rozsa_2023_invivo.ipynb.

Revised after the first verification round: the threshold is found on a trace smoothed to the Methods' 10 kHz filter, artefact APs are removed before any analysis, the mixture is fitted on robustly scaled features and its components are printed, steady current is judged in absolute terms, and the outputs the verifier asked for are added (metadata of each folder, Vm and LFP clocks, bleb sweep pairing and traces, further readings for fig2c and fig2h).

Claim Here
fig2c-zd7288-reduces-raf tested
figs2-zd7288-passive-properties tested
fig1hk-bleb-initiation-order tested
fig2h-bleb-sag-higher tested
fig3-human-ap-states tested
fig3f-human-pre-ap-fluctuation tested
fig3i-rat-lfp-rhythm tested
fig3l-rat-spontaneous-ra-proportion tested
fig3k-rat-pre-ap-fluctuation tested
fig3m-rat-ais-phase-coupling tested
fig3m-rat-ra-no-phase tested
figs3-no-modulators tested
the induction claims (fig1ab, fig1c, fig1d, fig1f, figs1b, figs1d, fig1g, fig2e, fig2il) other notebook
the in vivo claims (fig4*, figs4i, figs5) in vivo notebook
In [1]:
import zlib, time, resource, collections
import numpy as np
import pandas as pd
from scipy import stats, signal
import matplotlib.pyplot as plt
import raf

%matplotlib inline
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)
PAPER = "rozsa-2023"


def seed(claim):
    return zlib.crc32(f"{PAPER}/{claim}".encode())


T0 = time.time()
assets = raf.list_assets()
groups = collections.defaultdict(list)
for a in assets:
    groups[a["path"].split("/")[0]].append(a)
print(len(assets), "assets in", raf.DANDISET, raf.VERSION)
for g, v in groups.items():
    print(f"{g:45s} files {len(v):4d}  subjects {len({a['path'].split('/')[1] for a in v}):3d}  "
          f"{sum(a['size'] for a in v) / 1e9:7.1f} GB")
787 assets in 000341 0.241220.1312
Human_persistent_RAF                          files  313  subjects  50    147.5 GB
Rat_persistent_RAF                            files  132  subjects  62    113.1 GB
In_vivo                                       files  259  subjects 149    382.6 GB
In_vitro_oscillation_Rat                      files   39  subjects  25     51.7 GB
In_vitro_Human_elevated_neuronal_activity     files   26  subjects  15      9.1 GB
Persistent_RAF_ZD7288                         files    7  subjects   5      4.9 GB
Axonal_bleb_recording                         files   11  subjects   9      2.7 GB

Each file is read whole into memory (parallel range requests) and reduced at once to a table of APs and a table of sweeps (raf.extract); the raw traces are not kept, except the LFP of the rat recordings (decimated to about 500 Hz) and the soma and bleb traces of the dual recordings. Artefact APs (threshold outside -80 to -10 mV or peak above 100 mV, raf.plausible) are left out of every AP analysis below.

In [2]:
res = {}
for g in ("Persistent_RAF_ZD7288", "Axonal_bleb_recording", "In_vitro_Human_elevated_neuronal_activity",
          "In_vitro_oscillation_Rat"):
    t = time.time()
    keep = {"In_vitro_oscillation_Rat": ("LFP",), "Axonal_bleb_recording": ("Vm",)}.get(g, ())
    res[g] = raf.process_group(groups[g], keep=keep, workers=4)
    print(f"{g}: {len(res[g])} files in {time.time() - t:.0f} s; peak memory "
          f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")


def table(g):
    """One row per file: metadata, APs (main detection rule) and sweeps."""
    rows = []
    for p, (m, aps, sw, lfp) in res[g].items():
        rows.append(dict(path=p, file=p.split("/")[-1], species=m["subject_species"],
                         subject=m["subject_subject_id"], age=m.get("subject_age"),
                         meta=m, aps=aps, sw=sw, lfp=lfp))
    return rows
Persistent_RAF_ZD7288: 7 files in 30 s; peak memory 0.2 GB
Axonal_bleb_recording: 11 files in 15 s; peak memory 1.0 GB
In_vitro_Human_elevated_neuronal_activity: 26 files in 42 s; peak memory 1.0 GB
In_vitro_oscillation_Rat: 39 files in 349 s; peak memory 1.5 GB

Data check¶

In [3]:
for g in res:
    rows = table(g)
    print("==", g)
    print("  files", len(rows), "species", dict(collections.Counter(r["species"] for r in rows)),
          "subjects", len({r["subject"] for r in rows}))
    sw = pd.concat([r["sw"] for r in rows])
    print("  channels", dict(collections.Counter(sw.chan)))
    print("  sampling rates (Hz)", dict(collections.Counter(sw.rate.round())))
    vm = sw[sw.chan.str.startswith("Vm")]
    print(f"  Vm read as volts x 1000: median {vm.vmed.median():.1f} mV, range of sweep minima "
          f"{vm.vmin.min():.1f} to {vm.vmax.max():.1f} mV")
    print("  sweeps whose stimulus is stored in pA though its unit is amperes:",
          int(vm["stim_in_pA"].sum()) if "stim_in_pA" in vm else 0,
          "; with values above 1e16 pA, stimulus ignored:", int(vm["stim_bad"].sum()) if "stim_bad" in vm else 0)
    print(f"  stimulus relative to holding: {np.nanmin(vm.imin):.0f} to {np.nanmax(vm.imax):.0f} pA; "
          f"holding {np.nanmin(vm.hold):.0f} to {np.nanmax(vm.hold):.0f} pA")
    aps = pd.concat([r["aps"] for r in rows if len(r["aps"])])
    print(f"  AP candidates {len(aps)}, main rule (peak > 0 mV) {int(aps.main.sum())}, "
          f"variant (peak >= threshold + 30 mV) {int(aps.variant30.sum())}; main-rule artefacts left out "
          f"(threshold outside -80 to -10 mV or peak above 100 mV) {int((aps.main & ~raf.plausible(aps)).sum())}")
    m0 = rows[0]["meta"]
    print("  metadata of", rows[0]["file"])
    print("    general:", {k: v for k, v in m0["general"].items() if k not in ("pharmacology",)})
    print("    subject:", {k: v for k, v in m0.items() if k.startswith("subject_")})
    print("    electrodes:", m0["electrode_descriptions"])
    print("    pharmacology keys:", list(m0["pharmacology"]))
    print("    subject descriptions over the folder:",
          dict(collections.Counter(str(r["meta"].get("subject_description")) for r in rows).most_common(6)))
    ph = collections.Counter()
    for r in rows:
        for k, v in r["meta"]["pharmacology"].items():
            if v != "NaN" and ("Drug" in k and "Name" in k or k.startswith("Drugname")):
                ph[v] += 1
    print("  drugs named in general/pharmacology:", dict(ph))
    # Recordings deposited twice: the same sweep count and the same median Vm of the first 20 sweeps.
    fp = collections.defaultdict(list)
    for r in rows:
        v = r["sw"][r["sw"].chan.str.startswith("Vm")].sort_values("start")
        fp[(len(v), tuple(v.vmed.round(3).head(20)))].append(r["file"])
    dup = [v for v in fp.values() if len(v) > 1]
    print("  files with identical sweep fingerprints:", dup if dup else "none")
print()
print("The voltage series give conversion 1e-12 with unit volts, but the stored values are in volts")
print("(medians near -65 V x 1e-3 above); read with the stated conversion they would be picovolts.")
== Persistent_RAF_ZD7288
  files 7 species {'Homo sapiens': 4, 'Rattus norvegicus': 3} subjects 5
  channels {'Vm': 8174}
  sampling rates (Hz) {50000.0: 764, 100000.0: 7410}
  Vm read as volts x 1000: median -42.0 mV, range of sweep minima -118.5 to 89.4 mV
  sweeps whose stimulus is stored in pA though its unit is amperes: 11 ; with values above 1e16 pA, stimulus ignored: 0
  stimulus relative to holding: -100 to 390 pA; holding -40 to 0 pA
  AP candidates 45474, main rule (peak > 0 mV) 45171, variant (peak >= threshold + 30 mV) 45211; main-rule artefacts left out (threshold outside -80 to -10 mV or peak above 100 mV) 33
  metadata of sub-201028_ses-2010282tm-4-1-1_icephys.nwb
    general: {'experiment_description': 'Whole-cell patch-clamp, current-clamp, L1 interneuron, Persistent RAF+ ZD7288', 'experimenter': ['Martin, Toth'], 'institution': 'ELKH-SZTE Research Group for Cortical Microcircuits; University of Szeged, Hungary', 'keywords': ['Whole-cell patch-clamp', 'Layer 1', 'Persistent RAF ZD7288'], 'lab': 'Lab of Gabor Tamas', 'related_publications': ['https://doi.org/10.1101/2022.08.09.503303'], 'session_id': '2010282tm_4_1_1', 'slices': 'Slicethickness:320μm  chamber: submerged'}
    subject: {'subject_age': 'P60Y', 'subject_description': 'Disease: nan Brain Region: Right Parietal', 'subject_sex': 'F', 'subject_species': 'Homo sapiens', 'subject_subject_id': '201028'}
    electrodes: {'Micropipette': 'Micropipette (3–5 MOhm) filled with intracellular solution containing biocytin'}
    pharmacology keys: ['Chamber', 'Ca', 'Mg', 'DrugName1', 'DrugWashinGroup', 'DrugWashinTime1', 'DrugWashoutTime1', 'DrugConcentration1', 'komment']
    subject descriptions over the folder: {'Brain region: Somatosensory cortex, Species: Wistar Rat': 3, 'Disease: Shunt Brain Region: Right Parietal': 2, 'Disease: nan Brain Region: Right Parietal': 1, 'Disease: Tumor Brain Region: Right Frontal': 1}
  drugs named in general/pharmacology: {'ZD7288': 7}
  files with identical sweep fingerprints: none
== Axonal_bleb_recording
  files 11 species {'Rattus norvegicus': 6, 'Homo sapiens': 5} subjects 9
  channels {'Vm_soma': 1319, 'Vm_bleb': 641}
  sampling rates (Hz) {100000.0: 344, 50000.0: 1616}
  Vm read as volts x 1000: median -63.8 mV, range of sweep minima -433.9 to 78.9 mV
  sweeps whose stimulus is stored in pA though its unit is amperes: 731 ; with values above 1e16 pA, stimulus ignored: 0
  stimulus relative to holding: -950 to 390 pA; holding -783 to 90 pA
  AP candidates 1616, main rule (peak > 0 mV) 1405, variant (peak >= threshold + 30 mV) 1401; main-rule artefacts left out (threshold outside -80 to -10 mV or peak above 100 mV) 247
  metadata of sub-20220317_ses-2203171lr-5_icephys.nwb
    general: {'experiment_description': 'Simultaneous recording of soma and axonal bleb Layer 1 in vitro', 'experimenter': ['Rajmund, Lakovics'], 'institution': 'ELKH-SZTE Research Group for Cortical Microcircuits; University of Szeged, Hungary', 'keywords': ['Axonal bleb and somatic Whole-cell patch-clamp in Layer 1'], 'lab': 'Lab of Gabor Tamas', 'related_publications': ['https://doi.org/10.1101/2022.08.09.503303'], 'session_id': '2203171lr_5', 'slices': 'Slicethickness:320μm  chamber: submerged'}
    subject: {'subject_age': 'P22D', 'subject_description': 'Brain region: Somatosensory cortex, Species: Wistar Rat', 'subject_sex': 'M', 'subject_species': 'Rattus norvegicus', 'subject_subject_id': '20220317'}
    electrodes: {'Micropipette': 'Micropipette (3–5 MOhm) filled with intracellular solution containing biocytin and Alexa 594', 'Micropipette_bleb': 'Micropipette (20–30 MOhm) filled with intracellular solution containing biocytin and Alexa 488'}
    pharmacology keys: ['Anatomy', 'celltype', 'celltypeElfiz', 'Layer', 'Channel', 'BlebChannel', 'Electrode Distance (µm) xyz', 'slicethickness', 'Chamber', 'Ca', 'Mg', 'Comment']
    subject descriptions over the folder: {'Brain region: Somatosensory cortex, Species: Wistar Rat': 6, 'Disease: Ventriculostomia Brain Region: Right Frontal': 2, 'Disease: Tumor Brain Region: Right Frontal': 2, 'Disease: Tumor, shunt Brain Region: Right Parietal': 1}
  drugs named in general/pharmacology: {}
  files with identical sweep fingerprints: none
== In_vitro_Human_elevated_neuronal_activity
  files 26 species {'Homo sapiens': 26} subjects 15
  channels {'Vm': 692}
  sampling rates (Hz) {100000.0: 405, 50000.0: 287}
  Vm read as volts x 1000: median -64.3 mV, range of sweep minima -408.9 to 95.0 mV
  sweeps whose stimulus is stored in pA though its unit is amperes: 52 ; with values above 1e16 pA, stimulus ignored: 0
  stimulus relative to holding: -100 to 320 pA; holding -550 to 0 pA
  AP candidates 5768, main rule (peak > 0 mV) 5217, variant (peak >= threshold + 30 mV) 5326; main-rule artefacts left out (threshold outside -80 to -10 mV or peak above 100 mV) 6
  metadata of sub-160812_ses-1608121tm-4-8-1_icephys.nwb
    general: {'experiment_description': 'Whole-cell patch-clamp, current-clamp, Human L1 interneuron, Elevated Network Activity', 'experimenter': ['Martin, Toth'], 'institution': 'ELKH-SZTE Research Group for Cortical Microcircuits; University of Szeged, Hungary', 'keywords': ['Whole-cell patch-clamp', 'Layer 1', 'Human Neocortex', 'Elevated network activity'], 'lab': 'Lab of Gabor Tamas', 'related_publications': ['https://doi.org/10.1101/2022.08.09.503303'], 'session_id': '1608121tm_4_8_1', 'slices': 'Slicethickness:450μm  chamber:DSF'}
    subject: {'subject_age': 'P18Y', 'subject_description': 'Disease: Glyoma Brain Region: Left Temporal', 'subject_sex': 'F', 'subject_species': 'Homo sapiens', 'subject_subject_id': '160812'}
    electrodes: {'Micropipette': 'Micropipette (3–5 MOhm) filled with intracellular solution containing biocytin'}
    pharmacology keys: ['Ca', 'Mg', 'Time To first RAAP (s)', 'Drugname', 'cc', 'Drugname.1', 'cc.1']
    subject descriptions over the folder: {'Disease: Hydrocephalus Brain Region: Right Frontal': 5, 'Disease: Tumor Brain Region: Left Frontal': 4, 'Disease: Aneurism Brain Region: Right': 3, 'Disease: Glyoma Brain Region: Left Temporal': 2, 'Disease: Tumor Brain Region: Left Temporooccipital': 2, 'Disease: Tumor, Epilepsy Brain Region: Left Frontal': 2}
  drugs named in general/pharmacology: {'carbachol': 26, 'SCH23390': 26}
  files with identical sweep fingerprints: none
== In_vitro_oscillation_Rat
  files 39 species {'Rattus norvegicus': 39} subjects 25
  channels {'LFP_Trace': 8973, 'Vm': 17429}
  sampling rates (Hz) {100000.0: 10254, 50000.0: 14302, 5000.0: 114, 20000.0: 1732}
  Vm read as volts x 1000: median -44.3 mV, range of sweep minima -352.9 to 853.3 mV
  sweeps whose stimulus is stored in pA though its unit is amperes: 3 ; with values above 1e16 pA, stimulus ignored: 0
  stimulus relative to holding: -100 to 1000 pA; holding -955 to 120 pA
  AP candidates 120135, main rule (peak > 0 mV) 112633, variant (peak >= threshold + 30 mV) 113966; main-rule artefacts left out (threshold outside -80 to -10 mV or peak above 100 mV) 2638
  metadata of sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb
    general: {'experiment_description': 'Simultaneous L1 Whole-cell patch-clamp and L5 LFP recording in vitro', 'experimenter': ['Martin, Toth'], 'institution': 'ELKH-SZTE Research Group for Cortical Microcircuits; University of Szeged, Hungary', 'keywords': ['Whole-cell patch-clamp Layer 1', 'LFP Layer 5', 'Rat Neocortex'], 'lab': 'Lab of Gabor Tamas', 'related_publications': ['https://doi.org/10.1101/2022.08.09.503303'], 'session_id': '1610102tm_1_3,12_4', 'slices': 'Slicethickness:400μm  chamber:dualsuperfusion'}
    subject: {'subject_age': 'P24D', 'subject_description': 'Brain region: Somatosensory cortex, Species: Wistar Rat', 'subject_sex': 'M', 'subject_species': 'Rattus norvegicus', 'subject_subject_id': '1610102tm'}
    electrodes: {'Micropipette': 'Micropipette (3–5 MOhm) filled with intracellular solution containing biocytin', 'Micropipette_LFP': 'Micropipette (1-3 MOhm) filled with calcium free ACSF'}
    pharmacology keys: ['Ca', 'Mg', 'DrugName1', 'DrugConcentration1', 'DrugName2', 'DrugConcentration2', 'DrugName3', 'DrugConcentration3', 'DrugName4', 'DrugConcentration4', 'DrugName5', 'DrugConcentration5']
    subject descriptions over the folder: {'Brain region: Somatosensory cortex, Species: Wistar Rat': 39}
  drugs named in general/pharmacology: {'carbachol': 36, 'SCH23390': 37, 'Kainic-acid': 2, 'Gabazine': 5, 'Charbachol': 2, 'SCH23391': 1, '4-AP': 1}
  files with identical sweep fingerprints: none

The voltage series give conversion 1e-12 with unit volts, but the stored values are in volts
(medians near -65 V x 1e-3 above); read with the stated conversion they would be picovolts.

Clock check for the rat LFP recordings. Firing and LFP deflections are said to be synchronized (Figure 3I), so on a shared clock the AP count in 1 s bins should be correlated with the LFP at lag 0, and less so when the LFP is shifted by several seconds. The raw Vm is not kept, so the AP times stand in for the up states.

In [4]:
def vm_lfp_corr(r, shifts=(0, 2, 5, 10)):
    """Correlation of the LFP (1 s means) with the AP count in the same 1 s bins, averaged over
    LFP segments of at least 20 s with 5 APs or more, at LFP shifts in seconds."""
    if not r["lfp"] or not len(r["aps"]):
        return None
    out = {}
    t_ap = r["aps"][r["aps"].main].t_abs.to_numpy()
    for sh in shifts:
        cs = []
        for (st, rate, x) in r["lfp"].values():
            dur = len(x) / rate
            if dur < 20:
                continue
            nb = int(dur)
            lf = x[: nb * int(rate)].reshape(nb, int(rate)).mean(1)
            cnt = np.histogram(t_ap, bins=st + sh + np.arange(nb + 1))[0]
            if cnt.sum() >= 5 and np.std(lf) > 0:
                cs.append(np.corrcoef(lf, cnt)[0, 1])
        out[sh] = np.nanmean(cs) if cs else np.nan
    return out


rows_osc = table("In_vitro_oscillation_Rat")
cc = pd.DataFrame({r["file"]: vm_lfp_corr(r) for r in rows_osc}).T
print("Mean correlation of the 1 s LFP mean with the AP count, by LFP shift (s):")
print(cc.describe().round(3))

# Starting times of the Vm and LFP series side by side (first three recordings).
for r in rows_osc[:3]:
    s = r["sw"].sort_values("start")
    vm = s[s.chan.str.startswith("Vm")]
    lf = s[s.chan.str.startswith("LFP")]
    print(r["file"][:40])
    print("   Vm  (start s, duration s):", [(round(a, 2), round(b, 1)) for a, b in zip(vm.start.head(6), (vm.n / vm.rate).head(6))])
    print("   LFP (start s, duration s):", [(round(a, 2), round(b, 1)) for a, b in zip(lf.start.head(6), (lf.n / lf.rate).head(6))])
    same = len(set(vm.start.round(3)) & set(lf.start.round(3)))
    print(f"   Vm series {len(vm)}, LFP series {len(lf)}, sharing a starting time {same}")
# The same count over every recording with LFP series (verifier, round 2).
frac = []
for r in rows_osc:
    s = r["sw"]
    vm, lf = set(s[s.chan.str.startswith("Vm")].start.round(3)), set(s[s.chan.str.startswith("LFP")].start.round(3))
    if lf:
        frac.append(len(vm & lf) / len(lf))
print(f"recordings with LFP series {len(frac)}; LFP series sharing a starting time with a Vm series: median fraction "
      f"{np.median(frac):.3f}, lowest {min(frac):.3f}, recordings where every one does {sum(f == 1 for f in frac)}")


def ap_triggered_lfp(r, shift=0.0, half=1.0):
    """Mean LFP (about 500 Hz) from -1 to +1 s around the peaks of the APs of a recording (APs of the
    main rule, plausible), with the AP times shifted by `shift` seconds. Returns the mean, the number
    of APs and the LFP rate."""
    a = r["aps"]
    if not len(a) or not r["lfp"]:
        return None, 0, np.nan
    a = a[a.main & raf.plausible(a)]
    t = (a.sweep_start + a.t_peak).to_numpy() + shift
    segs = []
    for st, rate, x in r["lfp"].values():
        h = int(half * rate)
        i = np.round((t - st) * rate).astype(int)
        i = i[(i - h >= 0) & (i + h < len(x))]
        for k in i[:2000]:
            seg = x[k - h:k + h + 1].astype(float)
            segs.append(seg - seg.mean())
            used = rate
    if not segs:
        return None, 0, np.nan
    L = min(len(z) for z in segs)
    return np.mean([z[:L] for z in segs], axis=0), len(segs), used


trig = []
fig, ax = plt.subplots(figsize=(6, 3.5))
for r in rows_osc:
    m0, n0, fs0 = ap_triggered_lfp(r)
    if m0 is None or n0 < 20:
        continue
    c0, w0 = len(m0) // 2, int(round(0.05 * fs0))
    amp0 = m0[c0 - w0:c0 + w0 + 1].mean()
    null = [ap_triggered_lfp(r, shift=sh)[0] for sh in (-10, -5, 5, 10)]
    null = [z[len(z) // 2 - w0:len(z) // 2 + w0 + 1].mean() for z in null if z is not None]
    trig.append(dict(file=r["file"][:32], n_aps=n0, lfp_at_ap=amp0, shifted_mean=np.mean(null), shifted_sd=np.std(null),
                     lfp_sd=np.std(m0)))
    ax.plot((np.arange(len(m0)) - c0) / fs0 * 1000, m0, lw=0.6)
ax.set(xlabel="time from AP peak (ms)", ylabel="mean LFP (mV, segment mean removed)",
       title="AP-triggered LFP average, one line per recording")
plt.show()
trig = pd.DataFrame(trig)
print(trig.round(4).to_string())
z = (trig.lfp_at_ap - trig.shifted_mean) / trig.shifted_sd.replace(0, np.nan)
print(f"recordings {len(trig)}; mean LFP within 50 ms of the AP below the mean with AP times shifted by "
      f"5 or 10 s in {int((trig.lfp_at_ap < trig.shifted_mean).sum())}; |z| > 2 against the shifted values in "
      f"{int((z.abs() > 2).sum())}")
Mean correlation of the 1 s LFP mean with the AP count, by LFP shift (s):
           0       2       5       10
count  25.000  29.000  30.000  31.000
mean   -0.046  -0.011  -0.015  -0.057
std     0.221   0.227   0.230   0.277
min    -0.544  -0.536  -0.831  -0.779
25%    -0.207  -0.139  -0.108  -0.128
50%    -0.014  -0.004   0.007  -0.010
75%     0.036   0.081   0.138   0.099
max     0.544   0.539   0.340   0.384
sub-1610102tm_ses-1610102tm-1-3,12-4_ice
   Vm  (start s, duration s): [(0.0, 0.9), (2.03, 0.9), (4.05, 0.9), (6.08, 0.9), (8.11, 0.9), (10.14, 0.9)]
   LFP (start s, duration s): [(0.0, 0.9), (2.03, 0.9), (4.05, 0.9), (6.08, 0.9), (8.11, 0.9), (10.14, 0.9)]
   Vm series 33, LFP series 32, sharing a starting time 32
sub-1611161tm_ses-1611161tm-2-1-4_icephy
   Vm  (start s, duration s): [(0.0, 0.9), (2.01, 0.9), (4.03, 0.9), (6.05, 0.9), (8.08, 0.9), (10.11, 0.9)]
   LFP (start s, duration s): [(0.0, 0.9), (2.01, 0.9), (4.03, 0.9), (6.05, 0.9), (8.08, 0.9), (10.11, 0.9)]
   Vm series 298, LFP series 297, sharing a starting time 296
sub-1611161tm_ses-1611161tm-4-1-4_icephy
   Vm  (start s, duration s): [(0.0, 0.9), (2.03, 0.9), (4.06, 0.9), (6.08, 0.9), (8.17, 0.9), (10.19, 0.9)]
   LFP (start s, duration s): [(0.0, 0.9), (2.03, 0.9), (4.06, 0.9), (6.08, 0.9), (8.17, 0.9), (10.19, 0.9)]
   Vm series 500, LFP series 501, sharing a starting time 500
recordings with LFP series 39; LFP series sharing a starting time with a Vm series: median fraction 1.000, lowest 0.667, recordings where every one does 24
No description has been provided for this image
                                file  n_aps  lfp_at_ap  shifted_mean  shifted_sd  lfp_sd
0   sub-1610102tm_ses-1610102tm-1-3,     22    -0.0029        0.0020      0.0043  0.0065
1   sub-1608041tm_ses-1608041tm-3-5,     73     0.0010       -0.0018      0.0018  0.0027
2   sub-1708031tm_ses-1708031tm-3-1-     23     0.0013       -0.0041      0.0048  0.0073
3   sub-1611151tm_ses-1611151tm-3-1-    584    -0.0185       -0.0005      0.0005  0.0121
4   sub-1708022tm_ses-1708022tm-1-2-   7395    -0.0301       -0.0003      0.0003  0.0123
5   sub-1708031tm_ses-1708031tm-5-5-    337    -0.0054        0.0003      0.0006  0.0040
6   sub-1708162tm_ses-1708162tm-2-1-     41    -0.0005        0.0001      0.0003  0.0043
7   sub-1708171tm_ses-1708171tm-2-1-     74    -0.0004       -0.0002      0.0008  0.0027
8   sub-1807301tm_ses-1807301tm-2-1-   2286    -0.0194        0.0001      0.0002  0.0116
9   sub-1807272tm_ses-1807272tm-3-1-   1207    -0.1037        0.0002      0.0012  0.0618
10  sub-1708312tm_ses-1708312tm-7-1-     28    -0.0178       -0.0004      0.0008  0.0212
11  sub-1809111tm_ses-1809111tm-2-1,     26    -0.0047       -0.0009      0.0047  0.0049
12  sub-1807302tm_ses-1807302tm-3-1,   4836     0.0157        0.0001      0.0003  0.0076
13  sub-1809262tm_ses-1809262tm-1-2,    373     0.0006       -0.0004      0.0010  0.0107
14  sub-1810241tm_ses-1810241tm-1-2-    639     0.1034       -0.0026      0.0044  0.0540
15  sub-1908151tm_ses-1908151tm-3-1,     63     0.0016        0.0007      0.0005  0.0181
recordings 16; mean LFP within 50 ms of the AP below the mean with AP times shifted by 5 or 10 s in 10; |z| > 2 against the shifted values in 9

fig2c-zd7288-reduces-raf¶

Blocking HCN channels with ZD7288 (30 uM) reduces the duration of RAF (47.2 to 10.1 s) and the number of RA-APs (624 to 48) in human and rat layer 1 interneurons.

The wash-in time of ZD7288 is in each file's general/pharmacology (DrugWashinTime1, in seconds on the file clock, checked below against the sweep times). Control is the part of the recording before it, ZD7288 the part after. In each part, RA-APs by reading (c) of the claims file's header (raf.ra_aps_induction): APs without positive current after the first induction sweep of that part. RAF duration and RA-AP count as in fig1ab-raf-patterns, reading (i), one epoch per part. The Methods count the RA-APs of the continuous recording ("Analysis of RAF patterns": "number of RA-APs during continuous recording"); the APs in the interstimulus intervals of the induction are counted in the main reading and left out in a variant. Epoch reading (ii) of fig1ab, one epoch per induction run within each part, is shown too, with the per-cell mean over the part's epochs (0 when it has none). The one file at 20 uM is left out in a variant.

In [5]:
def split_raf(aps, sw, t_from, t_to, continuous_only=False, reading="i"):
    a = aps[(aps.t_abs >= t_from) & (aps.t_abs < t_to)]
    s = sw[(sw.start >= t_from) & (sw.start < t_to)]
    ais, ra, t0, runs = raf.ra_aps_induction(a, s)
    if continuous_only and len(ra):
        stepless = set(s[s.nsteps == 0].series)
        ra = ra[ra.series.isin(stepless)]
    if reading == "i":
        ep = raf.epochs(ra.t_abs)
        dur, n = (ep[0]["duration"] if ep else 0.0), len(ra)
    else:
        ep = raf.epochs(ra.t_abs, runs) if len(runs) else []
        dur = float(np.mean([e["duration"] for e in ep])) if ep else 0.0
        n = float(np.mean([e["n"] for e in ep])) if ep else 0.0
    return dict(n_ra=n, duration=dur, n_epochs=len(ep), n_runs=len(runs),
                n_ind=len(raf.induction_sweeps(s)), t_ind=t0, ais=len(ais))


zd_rows = []
for r in table("Persistent_RAF_ZD7288"):
    ph = r["meta"]["pharmacology"]
    T = float(ph["DrugWashinTime1"])
    aps = r["aps"][r["aps"].main & raf.plausible(r["aps"])]
    sw = r["sw"]
    end = (sw.start + sw.n / sw.rate).max()
    for reading in ("i", "ii"):
        for cont in (False, True):
            c = split_raf(aps, sw, -np.inf, T, cont, reading)
            z = split_raf(aps, sw, T, np.inf, cont, reading)
            zd_rows.append(dict(file=r["file"], species=r["species"].split()[0], drug=ph["DrugName1"],
                                conc=ph["DrugConcentration1"], washin_s=T, rec_end_s=round(end, 1),
                                epochs=reading, continuous_only=cont,
                                ctrl_ind_sweeps=c["n_ind"], zd_ind_sweeps=z["n_ind"],
                                ctrl_runs=c["n_runs"], zd_runs=z["n_runs"], ctrl_epochs=c["n_epochs"], zd_epochs=z["n_epochs"],
                                ctrl_dur=c["duration"], zd_dur=z["duration"],
                                ctrl_n=c["n_ra"], zd_n=z["n_ra"]))
zd = pd.DataFrame(zd_rows)
with pd.option_context("display.width", 250):
    print(zd.drop(columns=["drug"]).round(2).to_string())
                                            file species   conc  washin_s  rec_end_s epochs  continuous_only  ctrl_ind_sweeps  zd_ind_sweeps  ctrl_runs  zd_runs  ctrl_epochs  zd_epochs  ctrl_dur  zd_dur   ctrl_n     zd_n
0     sub-201028_ses-2010282tm-4-1-1_icephys.nwb    Homo  20 uM    173.91      890.6      i            False              118            461          2       10            1          1    122.84  573.65  1372.00  2280.00
1     sub-201028_ses-2010282tm-4-1-1_icephys.nwb    Homo  20 uM    173.91      890.6      i             True              118            461          2       10            1          1    119.14  571.52  1319.00  2168.00
2     sub-201028_ses-2010282tm-4-1-1_icephys.nwb    Homo  20 uM    173.91      890.6     ii            False              118            461          2       10            2         10     40.92   25.49   686.00   228.00
3     sub-201028_ses-2010282tm-4-1-1_icephys.nwb    Homo  20 uM    173.91      890.6     ii             True              118            461          2       10            2         10     34.50   20.45   659.50   216.80
4     sub-201210_ses-2012105tm-2-1-1_icephys.nwb    Homo  30 uM   1508.03     1759.6      i            False              619            171          2        3            1          1    170.00  205.36     3.00  1675.00
5     sub-201210_ses-2012105tm-2-1-1_icephys.nwb    Homo  30 uM   1508.03     1759.6      i             True              619            171          2        3            0          1      0.00  185.00     0.00  1633.00
6     sub-201210_ses-2012105tm-2-1-1_icephys.nwb    Homo  30 uM   1508.03     1759.6     ii            False              619            171          2        3            1          2     70.59   90.07     2.00   837.50
7     sub-201210_ses-2012105tm-2-1-1_icephys.nwb    Homo  30 uM   1508.03     1759.6     ii             True              619            171          2        3            0          2      0.00   72.18     0.00   816.50
8   sub-20201208_ses-2012082tm-2-1-1_icephys.nwb  Rattus  30 uM    884.28     1342.8      i            False              230            555          2        3            1          1     88.30  195.30   363.00    13.00
9   sub-20201208_ses-2012082tm-2-1-1_icephys.nwb  Rattus  30 uM    884.28     1342.8      i             True              230            555          2        3            1          1     39.98    1.20   354.00     3.00
10  sub-20201208_ses-2012082tm-2-1-1_icephys.nwb  Rattus  30 uM    884.28     1342.8     ii            False              230            555          2        3            2          2     35.61   36.87   181.50     6.00
11  sub-20201208_ses-2012082tm-2-1-1_icephys.nwb  Rattus  30 uM    884.28     1342.8     ii             True              230            555          2        3            2          1      8.77    1.20   177.00     3.00
12  sub-20201210_ses-2012101tm-1-1-1_icephys.nwb  Rattus  30 uM    727.31     1407.9      i            False              403           1226          5        3            1          1    202.85  202.18   915.00    13.00
13  sub-20201210_ses-2012101tm-1-1-1_icephys.nwb  Rattus  30 uM    727.31     1407.9      i             True              403           1226          5        3            1          0    156.25    0.00   877.00     0.00
14  sub-20201210_ses-2012101tm-1-1-1_icephys.nwb  Rattus  30 uM    727.31     1407.9     ii            False              403           1226          5        3            2          2     77.02   59.50   457.50     6.50
15  sub-20201210_ses-2012101tm-1-1-1_icephys.nwb  Rattus  30 uM    727.31     1407.9     ii             True              403           1226          5        3            2          0     18.97    0.00   438.50     0.00
16  sub-20201210_ses-2012103tm-2-1-1_icephys.nwb  Rattus  30 uM    892.36     1498.7      i            False              330            979          3        3            1          1    184.13  422.36   180.00    16.00
17  sub-20201210_ses-2012103tm-2-1-1_icephys.nwb  Rattus  30 uM    892.36     1498.7      i             True              330            979          3        3            1          1    153.04  188.08   131.00     2.00
18  sub-20201210_ses-2012103tm-2-1-1_icephys.nwb  Rattus  30 uM    892.36     1498.7     ii            False              330            979          3        3            3          3     37.77  112.32    60.00     5.33
19  sub-20201210_ses-2012103tm-2-1-1_icephys.nwb  Rattus  30 uM    892.36     1498.7     ii             True              330            979          3        3            3          0     18.20    0.00    43.67     0.00
20    sub-210122_ses-2101221tm-2-1-1_icephys.nwb    Homo  30 uM    243.16      887.2      i            False              139           1104          1        5            1          1     85.31  468.72  1044.00    36.00
21    sub-210122_ses-2101221tm-2-1-1_icephys.nwb    Homo  30 uM    243.16      887.2      i             True              139           1104          1        5            1          1     82.77   20.89  1039.00    25.00
22    sub-210122_ses-2101221tm-2-1-1_icephys.nwb    Homo  30 uM    243.16      887.2     ii            False              139           1104          1        5            1          3     85.31   53.50  1044.00    11.67
23    sub-210122_ses-2101221tm-2-1-1_icephys.nwb    Homo  30 uM    243.16      887.2     ii             True              139           1104          1        5            1          1     82.77   20.89  1039.00    25.00
24    sub-210122_ses-2101222tm-6-1-1_icephys.nwb    Homo  30 uM    144.33      818.8      i            False              218            857          2        3            1          1     68.07  450.26   915.00   145.00
25    sub-210122_ses-2101222tm-6-1-1_icephys.nwb    Homo  30 uM    144.33      818.8      i             True              218            857          2        3            1          1     44.25  401.98   889.00    86.00
26    sub-210122_ses-2101222tm-6-1-1_icephys.nwb    Homo  30 uM    144.33      818.8     ii            False              218            857          2        3            1          3     68.07  123.25   915.00    48.33
27    sub-210122_ses-2101222tm-6-1-1_icephys.nwb    Homo  30 uM    144.33      818.8     ii             True              218            857          2        3            1          3     44.25   44.23   889.00    28.67
In [6]:
EXP = {"dur": (47.2, 10.1), "n": (624, 48)}
for (reading, cont, only30), d in [((r_, c_, o_), d_[d_.conc.str.startswith("30")] if o_ else d_)
                                   for (r_, c_), d_ in zd.groupby(["epochs", "continuous_only"]) for o_ in (False, True)]:
    print(f"== epochs ({reading}), RA-APs {'of the continuous recording only' if cont else 'after induction, ISIs included'}"
          f"{', 30 uM files only' if only30 else ''} (n = {len(d)} cells)")
    hits = {"mean": 0, "median": 0}
    for q in ("dur", "n"):
        c, z = d[f"ctrl_{q}"], d[f"zd_{q}"]
        for stat in ("mean", "median"):
            hits[stat] += sum(abs(getattr(x, stat)() - e) <= 0.1 * e for x, e in zip((c, z), EXP[q]))
        c, z = d[f"ctrl_{q}"], d[f"zd_{q}"]
        p_t = stats.ttest_rel(c, z).pvalue
        rule = raf.paper_test(c, z, paired=True)
        print(f"  {q:4s} control mean {c.mean():8.1f} median {c.median():8.1f} | ZD7288 mean "
              f"{z.mean():8.1f} median {z.median():8.1f} | paired t P = {p_t:.4f}; "
              f"paper's rule: {rule[0]} P = {rule[1]:.4f}; cells decreasing {int((z < c).sum())}/{len(d)}")
    for sp, ds in d.groupby("species"):
        print(f"    {sp}: duration control {ds.ctrl_dur.round(1).tolist()} ZD {ds.zd_dur.round(1).tolist()}; "
              f"count control {ds.ctrl_n.round(1).tolist()} ZD {ds.zd_n.round(1).tolist()}")
    print(f"  values within tolerance: means {hits['mean']} of 4, medians {hits['median']} of 4")
print("expected: duration 47.2 -> 10.1 s, count 624 -> 48 (tolerance 10%), paired t P = 0.008 and 0.007")
== epochs (i), RA-APs after induction, ISIs included (n = 7 cells)
  dur  control mean    131.6 median    122.8 | ZD7288 mean    359.7 median    422.4 | paired t P = 0.0166; paper's rule: paired t P = 0.0166; cells decreasing 1/7
  n    control mean    684.6 median    915.0 | ZD7288 mean    596.9 median     36.0 | paired t P = 0.8261; paper's rule: paired t P = 0.8261; cells decreasing 5/7
    Homo: duration control [122.8, 170.0, 85.3, 68.1] ZD [573.6, 205.4, 468.7, 450.3]; count control [1372.0, 3.0, 1044.0, 915.0] ZD [2280.0, 1675.0, 36.0, 145.0]
    Rattus: duration control [88.3, 202.8, 184.1] ZD [195.3, 202.2, 422.4]; count control [363.0, 915.0, 180.0] ZD [13.0, 13.0, 16.0]
  values within tolerance: means 1 of 4, medians 0 of 4
== epochs (i), RA-APs after induction, ISIs included, 30 uM files only (n = 6 cells)
  dur  control mean    133.1 median    129.2 | ZD7288 mean    324.0 median    313.9 | paired t P = 0.0400; paper's rule: paired t P = 0.0400; cells decreasing 1/6
  n    control mean    570.0 median    639.0 | ZD7288 mean    316.3 median     26.0 | paired t P = 0.5609; paper's rule: paired t P = 0.5609; cells decreasing 5/6
    Homo: duration control [170.0, 85.3, 68.1] ZD [205.4, 468.7, 450.3]; count control [3.0, 1044.0, 915.0] ZD [1675.0, 36.0, 145.0]
    Rattus: duration control [88.3, 202.8, 184.1] ZD [195.3, 202.2, 422.4]; count control [363.0, 915.0, 180.0] ZD [13.0, 13.0, 16.0]
  values within tolerance: means 1 of 4, medians 1 of 4
== epochs (i), RA-APs of the continuous recording only (n = 7 cells)
  dur  control mean     85.1 median     82.8 | ZD7288 mean    195.5 median    185.0 | paired t P = 0.2475; paper's rule: paired t P = 0.2475; cells decreasing 3/7
  n    control mean    658.4 median    877.0 | ZD7288 mean    559.6 median     25.0 | paired t P = 0.8008; paper's rule: paired t P = 0.8008; cells decreasing 5/7
    Homo: duration control [119.1, 0.0, 82.8, 44.3] ZD [571.5, 185.0, 20.9, 402.0]; count control [1319.0, 0.0, 1039.0, 889.0] ZD [2168.0, 1633.0, 25.0, 86.0]
    Rattus: duration control [40.0, 156.3, 153.0] ZD [1.2, 0.0, 188.1]; count control [354.0, 877.0, 131.0] ZD [3.0, 0.0, 2.0]
  values within tolerance: means 1 of 4, medians 0 of 4
== epochs (i), RA-APs of the continuous recording only, 30 uM files only (n = 6 cells)
  dur  control mean     79.4 median     63.5 | ZD7288 mean    132.9 median    102.9 | paired t P = 0.5162; paper's rule: paired t P = 0.5162; cells decreasing 3/6
  n    control mean    548.3 median    615.5 | ZD7288 mean    291.5 median     14.0 | paired t P = 0.5512; paper's rule: paired t P = 0.5512; cells decreasing 5/6
    Homo: duration control [0.0, 82.8, 44.3] ZD [185.0, 20.9, 402.0]; count control [0.0, 1039.0, 889.0] ZD [1633.0, 25.0, 86.0]
    Rattus: duration control [40.0, 156.3, 153.0] ZD [1.2, 0.0, 188.1]; count control [354.0, 877.0, 131.0] ZD [3.0, 0.0, 2.0]
  values within tolerance: means 0 of 4, medians 1 of 4
== epochs (ii), RA-APs after induction, ISIs included (n = 7 cells)
  dur  control mean     59.3 median     68.1 | ZD7288 mean     71.6 median     59.5 | paired t P = 0.4464; paper's rule: paired t P = 0.4464; cells decreasing 3/7
  n    control mean    478.0 median    457.5 | ZD7288 mean    163.3 median     11.7 | paired t P = 0.2245; paper's rule: paired t P = 0.2245; cells decreasing 6/7
    Homo: duration control [40.9, 70.6, 85.3, 68.1] ZD [25.5, 90.1, 53.5, 123.2]; count control [686.0, 2.0, 1044.0, 915.0] ZD [228.0, 837.5, 11.7, 48.3]
    Rattus: duration control [35.6, 77.0, 37.8] ZD [36.9, 59.5, 112.3]; count control [181.5, 457.5, 60.0] ZD [6.0, 6.5, 5.3]
  values within tolerance: means 0 of 4, medians 0 of 4
== epochs (ii), RA-APs after induction, ISIs included, 30 uM files only (n = 6 cells)
  dur  control mean     62.4 median     69.3 | ZD7288 mean     79.3 median     74.8 | paired t P = 0.3650; paper's rule: paired t P = 0.3650; cells decreasing 2/6
  n    control mean    443.3 median    319.5 | ZD7288 mean    152.6 median      9.1 | paired t P = 0.3364; paper's rule: paired t P = 0.3364; cells decreasing 5/6
    Homo: duration control [70.6, 85.3, 68.1] ZD [90.1, 53.5, 123.2]; count control [2.0, 1044.0, 915.0] ZD [837.5, 11.7, 48.3]
    Rattus: duration control [35.6, 77.0, 37.8] ZD [36.9, 59.5, 112.3]; count control [181.5, 457.5, 60.0] ZD [6.0, 6.5, 5.3]
  values within tolerance: means 0 of 4, medians 0 of 4
== epochs (ii), RA-APs of the continuous recording only (n = 7 cells)
  dur  control mean     29.6 median     19.0 | ZD7288 mean     22.7 median     20.5 | paired t P = 0.6637; paper's rule: paired t P = 0.6637; cells decreasing 6/7
  n    control mean    463.8 median    438.5 | ZD7288 mean    155.7 median     25.0 | paired t P = 0.2260; paper's rule: paired t P = 0.2260; cells decreasing 6/7
    Homo: duration control [34.5, 0.0, 82.8, 44.3] ZD [20.5, 72.2, 20.9, 44.2]; count control [659.5, 0.0, 1039.0, 889.0] ZD [216.8, 816.5, 25.0, 28.7]
    Rattus: duration control [8.8, 19.0, 18.2] ZD [1.2, 0.0, 0.0]; count control [177.0, 438.5, 43.7] ZD [3.0, 0.0, 0.0]
  values within tolerance: means 0 of 4, medians 0 of 4
== epochs (ii), RA-APs of the continuous recording only, 30 uM files only (n = 6 cells)
  dur  control mean     28.8 median     18.6 | ZD7288 mean     23.1 median     11.0 | paired t P = 0.7611; paper's rule: paired t P = 0.7611; cells decreasing 5/6
  n    control mean    431.2 median    307.8 | ZD7288 mean    145.5 median     14.0 | paired t P = 0.3367; paper's rule: paired t P = 0.3367; cells decreasing 5/6
    Homo: duration control [0.0, 82.8, 44.3] ZD [72.2, 20.9, 44.2]; count control [0.0, 1039.0, 889.0] ZD [816.5, 25.0, 28.7]
    Rattus: duration control [8.8, 19.0, 18.2] ZD [1.2, 0.0, 0.0]; count control [177.0, 438.5, 43.7] ZD [3.0, 0.0, 0.0]
  values within tolerance: means 0 of 4, medians 1 of 4
expected: duration 47.2 -> 10.1 s, count 624 -> 48 (tolerance 10%), paired t P = 0.008 and 0.007

Result: not reproduced. No reading gives both decreases at P < 0.05. With one epoch per part and the interstimulus intervals, RAF duration rises after the ZD7288 wash-in time (mean 131.6 to 359.7 s, paired t P = 0.017, falling in 1 of 7 cells) and the RA-AP count does not fall significantly (684.6 to 596.9, P = 0.83). With one epoch per induction run, duration 59.3 to 71.6 s (P = 0.45) and count 478.0 to 163.3 (P = 0.22). At most one of the four values is within tolerance under any reading. The three rat cells lose nearly all RA-APs (363, 915, 180 to 13, 13, 16).

figs2-zd7288-passive-properties¶

ZD7288 increases input resistance (70 to 98 MOhm, P = 0.01), and hyperpolarizes the resting potential (-60 to -67 mV, P = 0.075) and decreases sag fraction (0.04 to 0.017, P = 0.057) without reaching significance.

From the sweeps with a single hyperpolarizing step (raf._sag), before and after the wash-in time. Input resistance: the steady deflection over the current of the smallest hyperpolarizing step (criterion; standard choice); resting potential: the median of the pre-step baselines; sag fraction as in fig2e-sag-species under reading (a) on the most hyperpolarizing step, with reading (b) and the step whose peak is nearest -90 mV shown as variants. The pre-step baseline includes any holding current; cells with a holding current in a period are listed.

In [7]:
def passive(sw):
    s = sw.dropna(subset=["sag_a"]) if "sag_a" in sw else sw.iloc[:0]
    if not len(s):
        return dict(n=0)
    small = s[s.i_step == s.i_step.max()]
    big = s[s.i_step == s.i_step.min()]
    near = s.iloc[[int(np.argmin(np.abs(s.vpeak.to_numpy() + 90)))]]
    return dict(n=len(s), r_in=small.r_in.median(), v_rest=s.base.median(),
                hold=float(np.nanmedian(s.hold)),
                sag_a_big=big.sag_a.median(), sag_b_big=big.sag_b.median(),
                sag_a_90=near.sag_a.iloc[0], sag_b_90=near.sag_b.iloc[0],
                step_small=small.i_step.iloc[0], step_big=big.i_step.iloc[0])


pp = []
for r in table("Persistent_RAF_ZD7288"):
    T = float(r["meta"]["pharmacology"]["DrugWashinTime1"])
    sw = r["sw"][r["sw"].chan == "Vm"]
    for per, s in (("control", sw[sw.start < T]), ("ZD7288", sw[sw.start >= T])):
        pp.append(dict(file=r["file"], period=per, **passive(s)))
pp = pd.DataFrame(pp)
print(pp.round(3).to_string())
                                            file   period   n     r_in  v_rest   hold  sag_a_big  sag_b_big  sag_a_90  sag_b_90  step_small  step_big
0     sub-201028_ses-2010282tm-4-1-1_icephys.nwb  control  10  219.771 -58.855 -1.729      0.130      0.149     0.125     0.144       -20.0    -100.0
1     sub-201028_ses-2010282tm-4-1-1_icephys.nwb   ZD7288  35  265.762 -57.069  0.000      0.099      0.110     0.097     0.108       -20.0    -100.0
2     sub-201210_ses-2012105tm-2-1-1_icephys.nwb  control  11  597.311 -62.643  0.000      0.056      0.059     0.044     0.046       -20.0    -100.0
3     sub-201210_ses-2012105tm-2-1-1_icephys.nwb   ZD7288  14  480.842 -61.716 -6.790      0.047      0.049     0.108     0.121       -20.0    -100.0
4   sub-20201208_ses-2012082tm-2-1-1_icephys.nwb  control  15  117.415 -67.798  0.000      0.033      0.034     0.033     0.034       -20.0    -100.0
5   sub-20201208_ses-2012082tm-2-1-1_icephys.nwb   ZD7288  39  122.219 -72.759  0.000      0.035      0.037     0.039     0.040       -20.0    -100.0
6   sub-20201210_ses-2012101tm-1-1-1_icephys.nwb  control  15  102.848 -60.344  0.000      0.034      0.035     0.041     0.043       -20.0    -100.0
7   sub-20201210_ses-2012101tm-1-1-1_icephys.nwb   ZD7288  48  113.635 -63.432  0.000      0.020      0.021     0.021     0.022       -20.0    -100.0
8   sub-20201210_ses-2012103tm-2-1-1_icephys.nwb  control  10  110.312 -66.872  0.000      0.072      0.078     0.090     0.099       -20.0    -100.0
9   sub-20201210_ses-2012103tm-2-1-1_icephys.nwb   ZD7288  49  137.803 -68.405  0.000      0.094      0.104     0.065     0.070       -20.0    -100.0
10    sub-210122_ses-2101221tm-2-1-1_icephys.nwb  control  10  146.199 -65.168  0.000      0.115      0.130     0.124     0.142       -20.0    -100.0
11    sub-210122_ses-2101221tm-2-1-1_icephys.nwb   ZD7288  28  140.981 -68.472  0.000      0.120      0.136     0.027     0.027       -20.0    -100.0
12    sub-210122_ses-2101222tm-6-1-1_icephys.nwb  control   5  424.964 -63.550  0.000      0.041      0.043     0.034     0.035       -20.0    -100.0
13    sub-210122_ses-2101222tm-6-1-1_icephys.nwb   ZD7288  32  506.180 -60.667  0.000      0.036      0.037     0.038     0.040       -20.0    -100.0
In [8]:
w = pp.pivot(index="file", columns="period")
ok = w["n"].min(axis=1) > 0
print(f"cells with step sweeps in both periods: {int(ok.sum())} of {len(w)}")
w = w[ok]
for q, exp in (("r_in", (70, 98)), ("v_rest", (-60, -67)), ("sag_a_big", (0.04, 0.017)),
               ("sag_b_big", None), ("sag_a_90", None), ("sag_b_90", None)):
    c, z = w[q]["control"].astype(float), w[q]["ZD7288"].astype(float)
    m = ~(c.isna() | z.isna())
    c, z = c[m], z[m]
    p = stats.ttest_rel(c, z).pvalue if len(c) > 1 else np.nan
    rule = raf.paper_test(c, z, paired=True)
    print(f"{q:10s} n={len(c)} control median {c.median():8.3f} mean {c.mean():8.3f} | ZD7288 median "
          f"{z.median():8.3f} mean {z.mean():8.3f} | paired t P = {p:.3f}; paper's rule {rule[0]} P = {rule[1]:.3f}"
          + (f" | expected {exp[0]} -> {exp[1]}" if exp else ""))
cells with step sweeps in both periods: 7 of 7
r_in       n=7 control median  146.199 mean  245.546 | ZD7288 median  140.981 mean  252.489 | paired t P = 0.776; paper's rule paired t P = 0.776 | expected 70 -> 98
v_rest     n=7 control median  -63.550 mean  -63.604 | ZD7288 median  -63.432 mean  -64.646 | paired t P = 0.386; paper's rule paired t P = 0.386 | expected -60 -> -67
sag_a_big  n=7 control median    0.056 mean    0.069 | ZD7288 median    0.047 mean    0.064 | paired t P = 0.537; paper's rule paired t P = 0.537 | expected 0.04 -> 0.017
sag_b_big  n=7 control median    0.059 mean    0.075 | ZD7288 median    0.049 mean    0.070 | paired t P = 0.546; paper's rule paired t P = 0.546
sag_a_90   n=7 control median    0.044 mean    0.070 | ZD7288 median    0.039 mean    0.057 | paired t P = 0.483; paper's rule paired t P = 0.483
sag_b_90   n=7 control median    0.046 mean    0.077 | ZD7288 median    0.040 mean    0.061 | paired t P = 0.478; paper's rule paired t P = 0.478

Result: not reproduced. Input resistance does not rise (median 146.2 to 141.0 MOhm, paired t P = 0.78); resting potential (-63.6 to -63.4 mV) and sag fraction (0.056 to 0.047) do not change. Two of six values, the resting potentials, are within tolerance.

fig1hk-bleb-initiation-order¶

In dual soma and axonal bleb recordings of human NGFCs, AIS-APs reach the soma first and the bleb second, while RA-APs reach the bleb first, and RA-APs have lower somatic threshold and pre-AP slope.

The cell class is in each file's general/pharmacology (celltype: NGF or no recovery). Somatic and bleb sweeps are paired by sweep number (Vm_soma_<k>, Vm_bleb_<k>; the pairs are checked below to start at the same time). For each somatic AP, the bleb AP within 3 ms is taken (a standard choice); latency is bleb time minus soma time, at the threshold and at the peak (the criterion's two readings). AIS-APs and RA-APs by reading (b), a Gaussian mixture on threshold and slope fitted to the somatic APs of the human bleb recordings pooled; the dandiset has no AP labels, so reading (a) cannot be run. The bleb threshold uses the same smoothed dV/dt as the somatic one (raf.dvdt).

The somatic thresholds of these files are checked against the voltage during the steps: an unbalanced bridge adds the drop over the pipette resistance to the recorded potential during current injection, which raises the apparent threshold of APs fired during depolarizing steps. jump is the voltage step within 0.15 ms of the onset of a depolarizing step (raf.extract). As a classification that does not rest on the threshold, the APs are also split by the sign of their latency, and the two groups' thresholds and slopes compared.

In [9]:
def bleb_latency(r, win_ms=3.0):
    """Soma-to-bleb latency for each somatic AP of a dual recording. The bleb signal is small (its
    peaks are mostly below 0 mV), so bleb APs are not detected on their own: in the bleb sweep of the
    same number, the bleb peak is the maximum within 3 ms of the somatic peak and the bleb threshold
    the first sample of the run with dV/dt >= 5 mV/ms before the steepest point ahead of that peak,
    as for somatic APs (standard choices). Latencies with no bleb run reaching 5 mV/ms are NaN."""
    aps = r["aps"]
    if not len(aps):
        return pd.DataFrame()
    so = aps[aps.main & raf.plausible(aps) & (aps.chan == "Vm_soma")].copy()
    raw = r["lfp"]
    out = []
    for _, a in so.iterrows():
        k = a.series.rsplit("_", 1)[1]
        b = raw.get(f"Vm_bleb_{k}")
        row = a.to_dict()
        if b is not None:
            st, rate, x = b
            ms = rate / 1000
            lo, hi = int((a.t_peak - win_ms / 1000) * rate), int((a.t_peak + win_ms / 1000) * rate)
            lo, hi = max(lo, 1), min(hi, len(x) - 1)
            if hi - lo > 4:
                seg = x[lo:hi].astype(float)
                pk = lo + int(np.argmax(seg))
                w = max(1, int(round(raf.SMOOTH_S * rate)))
                a0 = max(0, lo - 1 - w)
                dv = raf.dvdt(x[a0:pk + w + 1].astype(float), rate)[lo - 1 - a0:pk - a0]
                row["bleb_amp"] = float(x[pk] - np.median(x[max(0, lo - int(5 * ms)):lo]))
                row["lat_peak_ms"] = (pk / rate - a.t_peak) * 1000
                if len(dv) and dv.max() >= raf.DVDT:
                    j = int(np.argmax(dv))
                    while j > 0 and dv[j - 1] >= raf.DVDT:
                        j -= 1
                    row["lat_thr_ms"] = ((lo - 1 + j) / rate - a.t_thr) * 1000
                else:
                    row["lat_thr_ms"] = np.nan
        out.append(row)
    return pd.DataFrame(out)


bleb = []
for r in table("Axonal_bleb_recording"):
    ph = r["meta"]["pharmacology"]
    d = bleb_latency(r)
    n_bleb_sweeps = int((r["sw"].chan == "Vm_bleb").sum())
    bleb.append(dict(file=r["file"], species=r["species"].split()[0], celltype=ph.get("celltype"),
                     distance_um=float(ph["Electrode Distance (µm) xyz"]) if "Electrode Distance (µm) xyz" in ph else np.nan,
                     comment=ph.get("Comment", ""), bleb_sweeps=n_bleb_sweeps, pairs=d))
print(pd.DataFrame([{k: v for k, v in b.items() if k != "pairs"} | {
    "soma_APs": len(b["pairs"]), "with_bleb_sweep": int(b["pairs"].lat_peak_ms.notna().sum()) if "lat_peak_ms" in b["pairs"] else 0,
    "bleb_thr_found": int(b["pairs"].lat_thr_ms.notna().sum()) if "lat_thr_ms" in b["pairs"] else 0}
    for b in bleb]).to_string())
print()
print("Pairing and bridge check per file:")
for r in table("Axonal_bleb_recording"):
    sw = r["sw"]
    so, bl = sw[sw.chan == "Vm_soma"].copy(), sw[sw.chan == "Vm_bleb"].copy()
    for d in (so, bl):
        d["k"] = d.series.str.rsplit("_", n=1).str[1].astype(int)
    mm = so.merge(bl, on="k", suffixes=("_s", "_b"))
    dt = (mm.start_b - mm.start_s).abs()
    j = so.dropna(subset=["jump_mv"]) if "jump_mv" in so else so.iloc[:0]
    a = r["aps"]
    a = a[a.main & raf.plausible(a) & (a.chan == "Vm_soma")] if len(a) else a
    dep = a[a.i_thr > 5] if len(a) else a
    nodep = a[a.i_thr <= 5] if len(a) else a
    print(f"  {r['file'][:30]} soma sweeps {len(so)}, bleb {len(bl)}, pairs by number {len(mm)}, largest start "
          f"difference {dt.max() if len(dt) else np.nan:.4f} s; onset jump {np.median(j.jump_mv / j.jump_pa * 1000) if len(j) else np.nan:.0f} MOhm "
          f"(median over {len(j)} steps); somatic APs during depolarizing steps {len(dep)} (threshold median "
          f"{dep.thr.median() if len(dep) else np.nan:.1f} mV, current {dep.i_thr.median() if len(dep) else np.nan:.0f} pA), "
          f"without current {len(nodep)} (threshold median {nodep.thr.median() if len(nodep) else np.nan:.1f} mV); "
          f"pre-step baseline median {so.vmed.median():.1f} mV")
                                         file species     celltype  distance_um                 comment  bleb_sweeps  soma_APs  with_bleb_sweep  bleb_thr_found
0    sub-20220317_ses-2203171lr-5_icephys.nwb  Rattus  no recovery        218.0  AP Transmission, small            0        39                0               0
1    sub-20220427_ses-2204271lr-4_icephys.nwb  Rattus  no recovery         44.0   AP Transmission,small          115       120               40               4
2    sub-20220428_ses-2204282lr-1_icephys.nwb  Rattus  no recovery        167.0   AP Transmission,small          151        79                0               0
3    sub-20220503_ses-2205031lr-1_icephys.nwb  Rattus          NGF        132.0                     NaN           88       171              105              36
4    sub-20220511_ses-2205111tm-2_icephys.nwb  Rattus          NGF        106.0     2 bleb on same cell           21        45                0               0
5   sub-20220511_ses-2205111tm-22_icephys.nwb  Rattus          NGF        162.0     2 bleb on same cell           40        45                0               0
6      sub-220504_ses-2205041lr-1_icephys.nwb    Homo          NGF         56.0         AP Transmission           33       381              336             237
7      sub-220505_ses-2205051lr-1_icephys.nwb    Homo  no recovery          NaN  AP Transmission, small           50       117               76              55
8      sub-220505_ses-2205051lr-2_icephys.nwb    Homo          NGF          NaN         AP Transmission           43        62               39              39
9      sub-220512_ses-2205121lr-3_icephys.nwb    Homo  no recovery        100.0   same patient (220505)           43        19                0               0
10     sub-220616_ses-2206161tm-4_icephys.nwb    Homo  no recovery         82.0    not good measurement           57        79               33              33

Pairing and bridge check per file:
  sub-20220317_ses-2203171lr-5_i soma sweeps 203, bleb 0, pairs by number 0, largest start difference nan s; onset jump 28 MOhm (median over 54 steps); somatic APs during depolarizing steps 39 (threshold median -12.0 mV, current 330 pA), without current 0 (threshold median nan mV); pre-step baseline median -40.5 mV
  sub-20220427_ses-2204271lr-4_i soma sweeps 167, bleb 115, pairs by number 115, largest start difference 0.0000 s; onset jump 26 MOhm (median over 20 steps); somatic APs during depolarizing steps 40 (threshold median -20.7 mV, current 280 pA), without current 80 (threshold median -20.2 mV); pre-step baseline median -60.1 mV
  sub-20220428_ses-2204282lr-1_i soma sweeps 192, bleb 151, pairs by number 151, largest start difference 0.0000 s; onset jump 31 MOhm (median over 40 steps); somatic APs during depolarizing steps 0 (threshold median nan mV, current nan pA), without current 79 (threshold median -11.8 mV); pre-step baseline median -61.7 mV
  sub-20220503_ses-2205031lr-1_i soma sweeps 164, bleb 88, pairs by number 88, largest start difference 0.0000 s; onset jump 28 MOhm (median over 13 steps); somatic APs during depolarizing steps 105 (threshold median -11.2 mV, current 300 pA), without current 66 (threshold median -15.2 mV); pre-step baseline median -63.7 mV
  sub-20220511_ses-2205111tm-2_i soma sweeps 118, bleb 21, pairs by number 21, largest start difference 0.0000 s; onset jump nan MOhm (median over 0 steps); somatic APs during depolarizing steps 0 (threshold median nan mV, current nan pA), without current 45 (threshold median -21.4 mV); pre-step baseline median 0.5 mV
  sub-20220511_ses-2205111tm-22_ soma sweeps 118, bleb 40, pairs by number 40, largest start difference 0.0000 s; onset jump nan MOhm (median over 0 steps); somatic APs during depolarizing steps 0 (threshold median nan mV, current nan pA), without current 45 (threshold median -21.4 mV); pre-step baseline median 0.5 mV
  sub-220504_ses-2205041lr-1_ice soma sweeps 62, bleb 33, pairs by number 33, largest start difference 0.0000 s; onset jump 57 MOhm (median over 17 steps); somatic APs during depolarizing steps 295 (threshold median -21.7 mV, current 160 pA), without current 86 (threshold median -26.3 mV); pre-step baseline median -57.5 mV
  sub-220505_ses-2205051lr-1_ice soma sweeps 74, bleb 50, pairs by number 50, largest start difference 0.0000 s; onset jump 41 MOhm (median over 11 steps); somatic APs during depolarizing steps 76 (threshold median -13.4 mV, current 140 pA), without current 41 (threshold median -26.9 mV); pre-step baseline median -57.7 mV
  sub-220505_ses-2205051lr-2_ice soma sweeps 55, bleb 43, pairs by number 43, largest start difference 0.0000 s; onset jump 31 MOhm (median over 17 steps); somatic APs during depolarizing steps 39 (threshold median -21.8 mV, current 200 pA), without current 23 (threshold median -26.5 mV); pre-step baseline median -62.7 mV
  sub-220512_ses-2205121lr-3_ice soma sweeps 82, bleb 43, pairs by number 43, largest start difference 0.0000 s; onset jump nan MOhm (median over 0 steps); somatic APs during depolarizing steps 0 (threshold median nan mV, current nan pA), without current 19 (threshold median -17.9 mV); pre-step baseline median -63.7 mV
  sub-220616_ses-2206161tm-4_ice soma sweeps 84, bleb 57, pairs by number 57, largest start difference 0.0000 s; onset jump nan MOhm (median over 0 steps); somatic APs during depolarizing steps 0 (threshold median nan mV, current nan pA), without current 79 (threshold median -30.4 mV); pre-step baseline median -69.4 mV
In [10]:
hum = [b for b in bleb if b["species"] == "Homo" and len(b["pairs"])]
allh = pd.concat([b["pairs"].assign(file=b["file"], celltype=b["celltype"]) for b in hum])
allh["ra"], info = raf.gmm_classes(allh, seed("fig1hk-bleb-initiation-order"))
print(f"human somatic APs {len(allh)}; RA-APs by the mixture {int(allh.ra.sum())}; components",
      {k: (round(v, 2) if isinstance(v, float) else v) for k, v in info.items()})
print("RA component size under seeds +0, +1000 to +4000:", raf.gmm_seed_range(allh, seed("fig1hk-bleb-initiation-order")))
for (f, ct), d in allh.groupby(["file", "celltype"]):
    for cls, dd in d.groupby("ra"):
        name = "RA-AP " if cls else "AIS-AP"
        print(f"{f[:32]} {ct:12s} {name} n={len(dd):4d} with bleb sweep {int(dd.lat_peak_ms.notna().sum()) if 'lat_peak_ms' in dd else 0:4d} "
              f"median latency thr {dd.get('lat_thr_ms', pd.Series(dtype=float)).median():6.3f} ms "
              f"peak {dd.get('lat_peak_ms', pd.Series(dtype=float)).median():6.3f} ms | "
              f"threshold {dd.thr.median():6.1f} mV slope {dd.slope.median():5.2f} mV/ms")
# Rat recordings, for comparison (not judged)
rat = [b for b in bleb if b["species"] == "Rattus" and len(b["pairs"])]
allr = pd.concat([b["pairs"].assign(file=b["file"], celltype=b["celltype"]) for b in rat])
allr["ra"], _ = raf.gmm_classes(allr, seed("fig1hk-bleb-initiation-order") + 1)
print("rat, for comparison:")
for c in ("lat_thr_ms", "lat_peak_ms", "bleb_amp"):
    if c not in allr:
        allr[c] = np.nan
print(allr.groupby(["file", "celltype", "ra"]).agg(n=("thr", "size"), lat_thr=("lat_thr_ms", "median"),
                                       lat_peak=("lat_peak_ms", "median"), bleb_amp=("bleb_amp", "median"),
                                       thr=("thr", "median"), slope=("slope", "median")).round(3))
print()
print("Human NGFCs, APs split by the sign of the latency at threshold (bleb first: negative):")
for f, d in allh[allh.celltype == "NGF"].groupby("file"):
    d = d.dropna(subset=["lat_thr_ms"])
    for neg, dd in d.groupby(d.lat_thr_ms < 0):
        print(f"  {f[:30]} {'bleb first' if neg else 'soma first'}: n={len(dd)}, threshold median {dd.thr.median():.1f} mV, "
              f"slope {dd.slope.median():.2f} mV/ms, current at threshold median {dd.i_thr.median():.0f} pA, "
              f"latency at peak median {dd.lat_peak_ms.median():.2f} ms")

# Example soma and bleb traces of the two human NGFCs, thresholds marked.
raw_by_file = {r["file"]: r["lfp"] for r in table("Axonal_bleb_recording")}
ex = []
for f, d in allh[allh.celltype == "NGF"].groupby("file"):
    for cls, dd in d.dropna(subset=["lat_thr_ms"]).groupby("ra"):
        ex.append(dd.iloc[len(dd) // 2])
fig, axs = plt.subplots(1, len(ex), figsize=(4 * len(ex), 3.5), squeeze=False)
for ax, a in zip(axs[0], ex):
    raw = raw_by_file[a.file]
    st, rate, xs = raw[a.series]
    xb = raw[a.series.replace("soma", "bleb")][2]
    i0, h = int(a.thr_idx), int(0.004 * rate)
    t = (np.arange(i0 - h, i0 + h) - i0) / rate * 1000
    ax.plot(t, xs[i0 - h:i0 + h], "k", lw=0.8, label="soma")
    ax.plot(t, xb[i0 - h:i0 + h], "r", lw=0.8, label="bleb")
    ax.axvline(0, color="k", ls=":")
    if np.isfinite(a.lat_thr_ms):
        ax.axvline(a.lat_thr_ms, color="r", ls=":")
    ax.set(title=f"{a.file[4:16]} {a.series} {'RA' if a.ra else 'AIS'} class\nthr {a.thr:.1f} mV, I {a.i_thr:.0f} pA",
           xlabel="ms from somatic threshold", ylabel="mV")
    ax.legend(fontsize=7)
plt.tight_layout()
plt.show()
for a in ex:
    print(f"example {a.file[:30]} {a.series}: soma threshold {a.thr:.1f} mV at {a.t_thr:.4f} s, latency at threshold "
          f"{a.lat_thr_ms:.2f} ms, at peak {a.lat_peak_ms:.2f} ms")
human somatic APs 658; RA-APs by the mixture 74; components {'n': 658, 'n_ra': 74, 'w_ra': 0.11, 'w_ais': 0.89, 'thr_ra': -64.51, 'thr_ais': -21.89, 'slope_ra': 0.14, 'slope_ais': 1.15, 'sd_thr_ra': 4.49, 'sd_thr_ais': 6.07, 'sd_slope_ra': 0.66, 'sd_slope_ais': 0.98, 'ra_slope_lower': True}
RA component size under seeds +0, +1000 to +4000: [74, 74, 74, 74, 74]
sub-220504_ses-2205041lr-1_iceph NGF          AIS-AP n= 340 with bleb sweep  295 median latency thr -0.200 ms peak -0.140 ms | threshold  -21.3 mV slope  0.94 mV/ms
sub-220504_ses-2205041lr-1_iceph NGF          RA-AP  n=  41 with bleb sweep   41 median latency thr -0.180 ms peak  0.200 ms | threshold  -60.6 mV slope  0.14 mV/ms
sub-220505_ses-2205051lr-1_iceph no recovery  AIS-AP n= 117 with bleb sweep   76 median latency thr  0.640 ms peak  0.360 ms | threshold  -15.0 mV slope  1.56 mV/ms
sub-220505_ses-2205051lr-2_iceph NGF          AIS-AP n=  62 with bleb sweep   39 median latency thr  0.160 ms peak  0.120 ms | threshold  -22.8 mV slope  1.11 mV/ms
sub-220512_ses-2205121lr-3_iceph no recovery  AIS-AP n=  19 with bleb sweep    0 median latency thr    nan ms peak    nan ms | threshold  -17.9 mV slope  1.29 mV/ms
sub-220616_ses-2206161tm-4_iceph no recovery  AIS-AP n=  46 with bleb sweep    0 median latency thr    nan ms peak    nan ms | threshold  -29.0 mV slope  1.78 mV/ms
sub-220616_ses-2206161tm-4_iceph no recovery  RA-AP  n=  33 with bleb sweep   33 median latency thr -0.630 ms peak -1.110 ms | threshold  -69.6 mV slope  0.10 mV/ms
rat, for comparison:
                                                               n  lat_thr  lat_peak  bleb_amp     thr  slope
file                                      celltype    ra                                                    
sub-20220317_ses-2203171lr-5_icephys.nwb  no recovery False   38      NaN       NaN       NaN -11.892  1.143
                                                      True     1      NaN       NaN       NaN -16.782  3.027
sub-20220427_ses-2204271lr-4_icephys.nwb  no recovery False  109     0.50      0.63     0.911 -19.799  1.319
                                                      True    11      NaN       NaN       NaN -27.287  2.782
sub-20220428_ses-2204282lr-1_icephys.nwb  no recovery False   78      NaN       NaN       NaN -11.803  1.296
                                                      True     1      NaN       NaN       NaN -11.756  3.161
sub-20220503_ses-2205031lr-1_icephys.nwb  NGF         False  155     0.04     -0.13     0.394 -11.881  1.239
                                                      True    16    -1.23     -0.14     0.337 -13.856  4.675
sub-20220511_ses-2205111tm-22_icephys.nwb NGF         False   43      NaN       NaN       NaN -21.390  1.166
                                                      True     2      NaN       NaN       NaN -22.649  3.349
sub-20220511_ses-2205111tm-2_icephys.nwb  NGF         False   43      NaN       NaN       NaN -21.390  1.166
                                                      True     2      NaN       NaN       NaN -22.649  3.349

Human NGFCs, APs split by the sign of the latency at threshold (bleb first: negative):
  sub-220504_ses-2205041lr-1_ice soma first: n=96, threshold median -18.3 mV, slope 1.55 mV/ms, current at threshold median 160 pA, latency at peak median 0.34 ms
  sub-220504_ses-2205041lr-1_ice bleb first: n=141, threshold median -27.5 mV, slope 0.25 mV/ms, current at threshold median 160 pA, latency at peak median -0.46 ms
  sub-220505_ses-2205051lr-2_ice soma first: n=33, threshold median -21.5 mV, slope 1.14 mV/ms, current at threshold median 200 pA, latency at peak median 0.14 ms
  sub-220505_ses-2205051lr-2_ice bleb first: n=6, threshold median -28.3 mV, slope -0.05 mV/ms, current at threshold median 180 pA, latency at peak median -0.21 ms
No description has been provided for this image
example sub-220504_ses-2205041lr-1_ice Vm_soma_37: soma threshold -19.9 mV at 0.1873 s, latency at threshold 0.48 ms, at peak 0.30 ms
example sub-220504_ses-2205041lr-1_ice Vm_soma_48: soma threshold -63.6 mV at 0.2430 s, latency at threshold 0.44 ms, at peak 0.38 ms
example sub-220505_ses-2205051lr-2_ice Vm_soma_21: soma threshold -19.7 mV at 0.2778 s, latency at threshold 0.22 ms, at peak 0.10 ms

Result: not reproduced. In the NGFC 220504 the bleb leads for the AIS class (median latency -0.20 ms at threshold, -0.14 ms at peak) as for the RA class (-0.18 ms at threshold); in 220505-2 all 62 somatic APs fall in the AIS class (+0.16 ms) and none in the RA class. The mixture's classes agree with the paper's description (RA component threshold -64.5 against -21.9 mV, slope 0.14 against 1.15 mV/ms). Split by the sign of the latency, the bleb-first APs of 220504 have the lower threshold (-27.5 against -18.3 mV) and slope (0.25 against 1.55 mV/ms), which is the paper's pattern, but that split is not one of the criterion's readings. The per-file median somatic thresholds lie at -30.4 to -11.2 mV, with or without current (the RA-class APs of 220504 and 220616 have medians of -60.6 and -69.6 mV), and the voltage jumps at step onset imply 26 to 57 MOhm of uncompensated resistance, so the somatic thresholds of these files are doubtful.

fig2h-bleb-sag-higher¶

Axonal blebs show about four times the sag fraction of the soma of the same layer 1 interneurons (0.4 against 0.1), at 106 um Euclidean soma-bleb distance.

Each compartment's sag from the hyperpolarizing steps injected into it (soma trace with a somatic step, bleb trace with a bleb step), per cell, under the claim's readings: formula (a) or (b), on the most hyperpolarizing step or the step whose peak is nearest -90 mV. The criterion's variant takes the bleb value from the bleb trace during a somatic step (raf._sag on the bleb trace with the somatic step's timing). A two-sample t test across cells as the paper names it; a paired t test as a variant. Checks asked for by the verifier: step sweeps whose sag peak lies below -150 mV (an electrode artefact or bridge error; sweep minima reach -434 mV) are left out in a variant, and the two files of one rat cell with two blebs (2 bleb on same cell) give one somatic value in a variant. The distance is the file's Electrode Distance (µm) xyz.

In [11]:
def sag_pick(s, how, clean=False):
    s = s.dropna(subset=["sag_a"]) if "sag_a" in s else s.iloc[:0]
    if clean and len(s):
        s = s[s.vpeak > -150]
    if not len(s):
        return None
    if how == "most":
        return s[s.i_step == s.i_step.min()].iloc[0]
    return s.iloc[int(np.argmin(np.abs(s.vpeak.to_numpy() + 90)))]


def bleb_during_soma(r):
    # Sag of the bleb trace during each somatic hyperpolarizing step sweep.
    out = []
    so = r["sw"][(r["sw"].chan == "Vm_soma")]
    so = so.dropna(subset=["sag_a"]) if "sag_a" in so else so.iloc[:0]
    for _, w in so.iterrows():
        b = r["lfp"].get(w.series.replace("soma", "bleb"))
        if b is None or len(w.neg_steps) != 1:
            continue
        st, rate, xb = b
        if len(xb) != w.n:
            continue
        sg_ = raf._sag(xb.astype(float), rate, list(w.neg_steps))
        if sg_:
            out.append(sg_)
    return pd.DataFrame(out)


rows = []
for r in table("Axonal_bleb_recording"):
    bs = bleb_during_soma(r)
    for how in ("most", "near90"):
        for clean in (False, True):
            so = sag_pick(r["sw"][r["sw"].chan == "Vm_soma"], how, clean)
            bl = sag_pick(r["sw"][r["sw"].chan == "Vm_bleb"], how, clean)
            bv = sag_pick(bs, how, clean)
            g = lambda x, k: getattr(x, k) if x is not None else np.nan
            rows.append(dict(file=r["file"][:30], species=r["species"].split()[0], step=how, clean=clean,
                             soma_a=g(so, "sag_a"), bleb_a=g(bl, "sag_a"), blebvar_a=g(bv, "sag_a"),
                             soma_b=g(so, "sag_b"), bleb_b=g(bl, "sag_b"), blebvar_b=g(bv, "sag_b"),
                             soma_step=g(so, "i_step"), bleb_step=g(bl, "i_step"), blebvar_step=g(bv, "i_step"),
                             soma_peak=g(so, "vpeak"), bleb_peak=g(bl, "vpeak"), blebvar_peak=g(bv, "vpeak")))
sg = pd.DataFrame(rows)
with pd.option_context("display.width", 250):
    print(sg[~sg.clean].drop(columns="clean").round(3).to_string())
TAB = []
for (how, clean), d in sg.groupby(["step", "clean"]):
    for f in ("a", "b"):
        for bleb_col in ("bleb", "blebvar"):
            for once in (False, True):
                dd = d.copy()
                if once:   # the second bleb of the same rat cell gives no second somatic value
                    dd.loc[dd.file.str.contains("2205111tm-22"), f"soma_{f}"] = np.nan
                s_, b_ = dd[f"soma_{f}"].dropna(), dd[f"{bleb_col}_{f}"].dropna()
                both = dd.dropna(subset=[f"soma_{f}", f"{bleb_col}_{f}"])
                p2 = stats.ttest_ind(b_, s_).pvalue if len(b_) > 1 and len(s_) > 1 else np.nan
                pp_ = stats.ttest_rel(both[f"{bleb_col}_{f}"], both[f"soma_{f}"]).pvalue if len(both) > 1 else np.nan
                TAB.append(dict(step=how, artefact_sweeps_out=clean, formula=f,
                                bleb_trace="bleb step" if bleb_col == "bleb" else "somatic step",
                                soma_once=once, soma_n=len(s_), soma_median=s_.median(), bleb_n=len(b_),
                                bleb_median=b_.median(), bleb_mean=b_.mean(), soma_mean=s_.mean(),
                                two_sample_P=p2, paired_P=pp_, n_pairs=len(both)))
TAB = pd.DataFrame(TAB)
with pd.option_context("display.width", 250, "display.max_rows", 100):
    print(TAB.round(4).to_string())
dist = pd.Series([b["distance_um"] for b in bleb])
print(f"soma-bleb distance: n={dist.notna().sum()} median {dist.median():.0f} um mean {dist.mean():.0f} um "
      f"range {dist.min():.0f} to {dist.max():.0f}")
print("expected: soma 0.1, bleb 0.4 (tolerance 10%), two-sample t P < 0.001, distance 106 um")
                              file species    step  soma_a  bleb_a  blebvar_a  soma_b  bleb_b  blebvar_b  soma_step  bleb_step  blebvar_step  soma_peak  bleb_peak  blebvar_peak
0   sub-20220317_ses-2203171lr-5_i  Rattus    most   0.055     NaN        NaN   0.058     NaN        NaN      -90.0        NaN           NaN    -69.845        NaN           NaN
2   sub-20220317_ses-2203171lr-5_i  Rattus  near90   0.055     NaN        NaN   0.058     NaN        NaN      -90.0        NaN           NaN    -69.845        NaN           NaN
4   sub-20220427_ses-2204271lr-4_i  Rattus    most   0.024   0.074      0.778   0.025   0.080        NaN     -700.0     -700.0        -700.0   -123.843   -143.624       -78.402
6   sub-20220427_ses-2204271lr-4_i  Rattus  near90   0.027   0.038      0.248   0.028   0.040      0.330     -260.0     -700.0        -700.0    -90.157   -113.921       -80.848
8   sub-20220428_ses-2204282lr-1_i  Rattus    most   0.030   0.163        NaN   0.031   0.195        NaN     -700.0     -950.0           NaN   -190.645   -143.221           NaN
10  sub-20220428_ses-2204282lr-1_i  Rattus  near90   0.034   0.092        NaN   0.035   0.101        NaN     -700.0     -700.0           NaN   -181.480   -122.168           NaN
12  sub-20220503_ses-2205031lr-1_i  Rattus    most   0.010   0.116      0.899   0.010   0.132        NaN     -700.0     -950.0        -700.0   -147.222   -165.591       -65.238
14  sub-20220503_ses-2205031lr-1_i  Rattus  near90   0.081   0.028      0.899   0.088   0.029        NaN     -700.0     -950.0        -700.0   -143.303   -120.279       -65.238
16  sub-20220511_ses-2205111tm-2_i  Rattus    most   0.038   0.010        NaN   0.039   0.010        NaN     -800.0     -700.0           NaN   -150.061   -135.117           NaN
18  sub-20220511_ses-2205111tm-2_i  Rattus  near90   0.067   0.027        NaN   0.072   0.027        NaN     -700.0     -700.0           NaN   -133.976   -134.168           NaN
20  sub-20220511_ses-2205111tm-22_  Rattus    most   0.038   0.270        NaN   0.039   0.370        NaN     -800.0     -700.0           NaN   -150.061   -291.626           NaN
22  sub-20220511_ses-2205111tm-22_  Rattus  near90   0.067   0.136        NaN   0.072   0.157        NaN     -700.0     -400.0           NaN   -133.976   -168.730           NaN
24  sub-220504_ses-2205041lr-1_ice    Homo    most   0.018   0.052      0.496   0.018   0.055      0.985     -700.0     -700.0        -700.0   -191.111   -244.472       -78.106
26  sub-220504_ses-2205041lr-1_ice    Homo  near90   0.021   0.008      0.479   0.021   0.008      0.920     -700.0     -700.0        -700.0   -181.078   -219.493       -78.623
28  sub-220505_ses-2205051lr-1_ice    Homo    most   0.007   0.048      1.002   0.007   0.050        NaN     -800.0     -700.0        -800.0   -156.097   -126.079      -176.074
30  sub-220505_ses-2205051lr-1_ice    Homo  near90   0.011   0.029      0.628   0.011   0.030      1.692     -800.0     -700.0        -800.0   -155.725   -112.664       -59.815
32  sub-220505_ses-2205051lr-2_ice    Homo    most   0.013   0.446      1.022   0.013   0.806        NaN     -800.0     -900.0        -800.0   -185.627   -216.926      -174.933
34  sub-220505_ses-2205051lr-2_ice    Homo  near90   0.018   0.206      0.887   0.018   0.260      7.870     -800.0     -700.0        -800.0   -175.606   -152.722       -89.863
36  sub-220512_ses-2205121lr-3_ice    Homo    most   0.018   0.142      1.186   0.019   0.166        NaN     -800.0     -900.0        -800.0   -156.244   -230.555       -38.317
38  sub-220512_ses-2205121lr-3_ice    Homo  near90   0.018   0.035      0.852   0.018   0.037        NaN     -700.0     -900.0        -800.0   -143.052   -187.490       -38.681
40  sub-220616_ses-2206161tm-4_ice    Homo    most   0.055   0.113      0.845   0.058   0.128        NaN     -300.0     -250.0        -300.0    -99.256   -159.960       -63.076
42  sub-220616_ses-2206161tm-4_ice    Homo  near90   0.057   0.134      0.902   0.060   0.155        NaN     -200.0     -200.0        -300.0    -90.003    -98.144       -63.898
      step  artefact_sweeps_out formula    bleb_trace  soma_once  soma_n  soma_median  bleb_n  bleb_median  bleb_mean  soma_mean  two_sample_P  paired_P  n_pairs
0     most                False       a     bleb step      False      11       0.0244      10       0.1148     0.1435     0.0278        0.0082    0.0192       10
1     most                False       a     bleb step       True      10       0.0213      10       0.1148     0.1435     0.0268        0.0110    0.0440        9
2     most                False       a  somatic step      False      11       0.0244       7       0.8988     0.8897     0.0278        0.0000    0.0000        7
3     most                False       a  somatic step       True      10       0.0213       7       0.8988     0.8897     0.0268        0.0000    0.0000        7
4     most                False       b     bleb step      False      11       0.0250      10       0.1297     0.1991     0.0289        0.0273    0.0477       10
5     most                False       b     bleb step       True      10       0.0218      10       0.1297     0.1991     0.0278        0.0345    0.0949        9
6     most                False       b  somatic step      False      11       0.0250       1       0.9846     0.9846     0.0289           NaN       NaN        1
7     most                False       b  somatic step       True      10       0.0218       1       0.9846     0.9846     0.0278           NaN       NaN        1
8     most                 True       a     bleb step      False       7       0.0549       6       0.0610     0.0685     0.0427        0.2793    0.6889        4
9     most                 True       a     bleb step       True       6       0.0396       6       0.0610     0.0685     0.0385        0.2421    0.6889        4
10    most                 True       a  somatic step      False       7       0.0549       7       0.7776     0.7821     0.0427        0.0000    0.0024        4
11    most                 True       a  somatic step       True       6       0.0396       7       0.7776     0.7821     0.0385        0.0000    0.0024        4
12    most                 True       b     bleb step      False       7       0.0581       6       0.0652     0.0768     0.0452        0.2669    0.6759        4
13    most                 True       b     bleb step       True       6       0.0415       6       0.0652     0.0768     0.0405        0.2378    0.6759        4
14    most                 True       b  somatic step      False       7       0.0581       3       1.0454     1.7310     0.0452        0.0043       NaN        0
15    most                 True       b  somatic step       True       6       0.0415       3       1.0454     1.7310     0.0405        0.0087       NaN        0
16  near90                False       a     bleb step      False      11       0.0341      10       0.0367     0.0733     0.0414        0.1487    0.1663       10
17  near90                False       a     bleb step       True      10       0.0308      10       0.0367     0.0733     0.0389        0.1365    0.2619        9
18  near90                False       a  somatic step      False      11       0.0341       7       0.8517     0.6994     0.0414        0.0000    0.0004        7
19  near90                False       a  somatic step       True      10       0.0308       7       0.8517     0.6994     0.0389        0.0000    0.0004        7
20  near90                False       b     bleb step      False      11       0.0353      10       0.0381     0.0843     0.0438        0.1374    0.1613       10
21  near90                False       b     bleb step       True      10       0.0318      10       0.0381     0.0843     0.0410        0.1300    0.2545        9
22  near90                False       b  somatic step      False      11       0.0353       4       1.3060     2.7031     0.0438        0.0176    0.2219        4
23  near90                False       b  somatic step       True      10       0.0318       4       1.3060     2.7031     0.0410        0.0242    0.2219        4
24  near90                 True       a     bleb step      False       7       0.0565       6       0.0337     0.0579     0.0532        0.8083    0.9662        4
25  near90                 True       a     bleb step       True       6       0.0558       6       0.0337     0.0579     0.0509        0.7402    0.9662        4
26  near90                 True       a  somatic step      False       7       0.0565       7       0.8517     0.6994     0.0532        0.0000    0.0212        4
27  near90                 True       a  somatic step       True       6       0.0558       7       0.8517     0.6994     0.0509        0.0001    0.0212        4
28  near90                 True       b     bleb step      False       7       0.0599       6       0.0349     0.0636     0.0567        0.7618    0.9883        4
29  near90                 True       b     bleb step       True       6       0.0590       6       0.0349     0.0636     0.0541        0.7034    0.9883        4
30  near90                 True       b  somatic step      False       7       0.0599       4       1.3060     2.7031     0.0567        0.0656       NaN        1
31  near90                 True       b  somatic step       True       6       0.0590       4       1.3060     2.7031     0.0541        0.0911       NaN        1
soma-bleb distance: n=9 median 106 um mean 119 um range 44 to 218
expected: soma 0.1, bleb 0.4 (tolerance 10%), two-sample t P < 0.001, distance 106 um

Result: partially reproduced. Under the criterion's main reading the bleb sag is higher than the somatic one (most hyperpolarizing step, formula (a): 0.115 against 0.024, two-sample t P = 0.0082; with the duplicated rat soma counted once, P = 0.011), but not at P < 0.001, and neither value is within tolerance. The difference rests on step sweeps whose sag peak lies below -150 mV: without them it vanishes (0.061 against 0.055, P = 0.28). The bleb trace during a somatic step gives values near 0.9 (P < 0.001), which reflects a bleb deflection too small for the formula. The median soma-bleb distance is 106 um, as in the paper.

fig3-human-ap-states¶

In active human slices (n = 26 cells), AIS-APs occur only in depolarized up states in all 7 cells with AIS-APs, while spontaneous RA-APs, seen in 6 cells, also occur in hyperpolarized down and transition states.

APs of the sweeps without current injection only (the claim's "without current injection"). AIS-APs and RA-APs by reading (b): a Gaussian mixture on threshold and slope fitted to these APs of the 26 human active-slice recordings pooled. The dandiset carries no AP labels (reading (a)); five files have a Time To first RAAP (s) entry in general/pharmacology, shown beside the result. States per cell from the histogram of the membrane potential of the sweeps without current, by the criterion's readings: (i) a two-Gaussian fit, down and up within one SD of each mean, transition between; (ii) the range between the two means cut in thirds. The AP's potential is the mean 0 to 50 ms before threshold, or the threshold.

In [12]:
def no_current_aps(r):
    a, s = r["aps"], r["sw"]
    if not len(a):
        return a
    quiet = set(s[(s.nsteps == 0) & s.chan.str.startswith("Vm")].series)
    return a[a.main & raf.plausible(a) & a.series.isin(quiet)]


def states(hist, sd):
    """Two-Gaussian fit to a membrane potential histogram (bins raf.HIST_BINS); returns the bounds
    of down and up states under readings (i) and (ii)."""
    from sklearn.mixture import GaussianMixture
    centers = (raf.HIST_BINS[:-1] + raf.HIST_BINS[1:]) / 2
    w = np.round(hist / hist.sum() * 20000).astype(int)
    x = np.repeat(centers, w)[:, None]
    gm = GaussianMixture(2, random_state=sd).fit(x)
    order = np.argsort(gm.means_[:, 0])
    mu = gm.means_[order, 0]
    sdv = np.sqrt(gm.covariances_[order, 0, 0])
    i_down, i_up = mu[0] + sdv[0], mu[1] - sdv[1]
    if i_down > i_up:
        i_down = i_up = (mu[0] + mu[1]) / 2
    third = (mu[1] - mu[0]) / 3
    return dict(mu_down=mu[0], mu_up=mu[1], sd_down=sdv[0], sd_up=sdv[1],
                i_down=i_down, i_up=i_up, ii_down=mu[0] + third, ii_up=mu[1] - third)


def classify_state(v, b, reading):
    lo, hi = (b["i_down"], b["i_up"]) if reading == "i" else (b["ii_down"], b["ii_up"])
    return np.where(v <= lo, "down", np.where(v >= hi, "up", "transition"))


hrows = table("In_vitro_Human_elevated_neuronal_activity")
H = pd.concat([no_current_aps(r).assign(file=r["file"]) for r in hrows if len(no_current_aps(r))])
H["ra"], GM_H = raf.gmm_classes(H, seed("fig3-human-ap-states"))
print("mixture components:", {k: (round(v, 2) if isinstance(v, float) else v) for k, v in GM_H.items()})
print("RA component size under seeds +0, +1000 to +4000:", raf.gmm_seed_range(H, seed("fig3-human-ap-states")))
print(f"APs with a positive holding current (absolute current at threshold above 5 pA): {int((H.i_abs > 5).sum())}; "
      f"without a stimulus series: {int(H.i_abs.isna().sum())}")
fig, ax = plt.subplots(figsize=(5, 4))
ax.scatter(H.thr, H.slope.clip(-5, 15), s=3, c=np.where(H.ra, "r", "k"), alpha=0.4)
ax.set(xlabel="threshold (mV)", ylabel="pre-AP slope (mV/ms), clipped to -5 to 15",
       title="human active slices: red RA component, black AIS")
plt.show()
print(f"slopes outside -5 to 15 mV/ms: {int((~H.slope.between(-5, 15)).sum())}")
print(f"human active slices: {len(hrows)} files, {len(H)} APs without current, RA-APs {int(H.ra.sum())}")
print(H.groupby("ra")[["thr", "slope"]].describe().round(2).T)
bounds = {}
for r in hrows:
    s = r["sw"]
    hs = [h for h in s.get("hist", pd.Series(dtype=object)).dropna()] if "hist" in s else []
    if hs:
        bounds[r["file"]] = states(np.sum(hs, axis=0), seed("fig3-human-ap-states"))
print(pd.DataFrame(bounds).T.round(1).to_string())
mixture components: {'n': 3101, 'n_ra': 1466, 'w_ra': 0.5, 'w_ais': 0.5, 'thr_ra': -46.19, 'thr_ais': -40.27, 'slope_ra': 3.54, 'slope_ais': 2.18, 'sd_thr_ra': 4.63, 'sd_thr_ais': 6.36, 'sd_slope_ra': 1.11, 'sd_slope_ais': 0.75, 'ra_slope_lower': False}
RA component size under seeds +0, +1000 to +4000: [1466, 1466, 1466, 1466, 1466]
APs with a positive holding current (absolute current at threshold above 5 pA): 0; without a stimulus series: 0
No description has been provided for this image
slopes outside -5 to 15 mV/ms: 0
human active slices: 26 files, 3101 APs without current, RA-APs 1466
ra             False    True 
thr   count  1635.00  1466.00
      mean    -40.23   -46.61
      std       6.28     4.28
      min     -76.61   -71.05
      25%     -42.62   -49.89
      50%     -38.62   -45.82
      75%     -36.55   -43.97
      max     -21.78   -24.12
slope count  1635.00  1466.00
      mean      2.15     3.66
      std       0.75     1.03
      min      -1.21    -1.97
      25%       1.82     2.99
      50%       2.27     3.43
      75%       2.60     4.10
      max       4.80     9.18
                                             mu_down  mu_up  sd_down  sd_up  i_down  i_up  ii_down  ii_up
sub-160812_ses-1608121tm-4-8-1_icephys.nwb     -75.0  -70.2      6.6    6.3   -72.6 -72.6    -73.4  -71.8
sub-160812_ses-1608121tm-5-7-4_icephys.nwb     -70.7  -60.7      0.5    1.1   -70.2 -61.7    -67.4  -64.0
sub-161004_ses-1610042tm-1-1-2_icephys.nwb     -65.0  -60.9      3.3    6.1   -62.9 -62.9    -63.6  -62.3
sub-161004_ses-1610042tm-2-1-2_icephys.nwb     -66.8  -59.9      6.2    1.2   -63.4 -63.4    -64.5  -62.2
sub-161005_ses-1610051tm-1-22-4_icephys.nwb    -60.8  -56.0      1.0    1.9   -59.8 -57.9    -59.2  -57.6
sub-161005_ses-1610052tm-1-1-4_icephys.nwb     -67.9  -64.9      1.7    1.7   -66.4 -66.4    -66.9  -65.9
sub-161011_ses-1610111tm-2-1-4_icephys.nwb     -73.3  -53.5      3.2    3.8   -70.2 -57.3    -66.7  -60.1
sub-161011_ses-1610111tm-1-1-4_icephys.nwb     -73.6  -53.4      3.6    7.4   -70.0 -60.8    -66.9  -60.1
sub-161014_ses-1610141tm-1-1-4_icephys.nwb     -66.3  -51.1      6.0    6.2   -60.3 -57.3    -61.2  -56.2
sub-161025_ses-1610252tm-2-1-4_icephys.nwb     -65.3  -56.4      3.3    2.5   -62.0 -58.9    -62.4  -59.4
sub-161025_ses-1610251tm-1-1-4_icephys.nwb     -57.7  -57.1      2.1    3.8   -57.4 -57.4    -57.5  -57.3
sub-161130_ses-1611301tm-1-1-4_icephys.nwb     -62.5  -61.8     11.4    3.2   -62.1 -62.1    -62.2  -62.0
sub-161130_ses-1611301tm-2-1-4_icephys.nwb     -72.2  -62.6      3.5    2.0   -68.6 -64.7    -69.0  -65.8
sub-170126_ses-1701261tm-3-1-4_icephys.nwb     -75.4  -69.1      0.4    1.1   -75.0 -70.2    -73.3  -71.2
sub-170323_ses-1703231tm-1-1-4_icephys.nwb     -67.2  -65.1      2.6    0.6   -66.2 -66.2    -66.5  -65.8
sub-170323_ses-1703231tm-2-1-4_icephys.nwb     -74.6  -69.3      1.0    1.3   -73.7 -70.6    -72.8  -71.0
sub-170323_ses-1703232tm-2-1-4_icephys.nwb     -70.2  -62.4      4.4    2.8   -65.8 -65.3    -67.6  -65.0
sub-170331_ses-1703311tm-2-1-4_icephys.nwb     -68.6  -63.7      4.0    4.4   -66.2 -66.2    -67.0  -65.4
sub-170331_ses-1703312tm-1-1-4_icephys.nwb     -66.1  -65.2      0.5    0.5   -65.6 -65.6    -65.8  -65.5
sub-170719_ses-1707191tm-3-1-4_icephys.nwb     -65.6  -62.2      0.9    1.0   -64.7 -63.2    -64.5  -63.4
sub-170908_ses-1709081tm-3-1-4_icephys.nwb     -69.5  -63.8      1.1    2.3   -68.5 -66.1    -67.6  -65.7
sub-180919_ses-1809191tm-1-7-1_icephys.nwb     -67.6  -53.6      1.9    2.9   -65.6 -56.4    -62.9  -58.2
sub-190108_ses-1901081tm-1-6-2_icephys.nwb     -63.3  -57.0      1.6    2.6   -61.7 -59.5    -61.2  -59.1
sub-220120_ses-2201201tm-1-1-1_icephys.nwb     -67.5  -61.5      1.0    1.5   -66.6 -63.0    -65.5  -63.5
sub-220120_ses-2201201tm-2-1-1_icephys.nwb     -60.5  -58.9      0.8    0.9   -59.7 -59.7    -60.0  -59.4
sub-220120_ses-2201201tm-3-1-1_icephys.nwb     -64.4  -53.9      1.8    2.5   -62.6 -56.4    -60.9  -57.4
In [13]:
tf = {r["file"]: r["meta"]["pharmacology"].get("Time To first RAAP (s)", "NaN") for r in hrows}
res_states = {}
for reading in ("i", "ii"):
    for pot in ("vpre", "thr"):
        rows = []
        for f, d in H.groupby("file"):
            if f not in bounds:
                continue
            st = classify_state(d[pot].to_numpy(), bounds[f], reading)
            ais, ra = st[~d.ra.to_numpy()], st[d.ra.to_numpy()]
            rows.append(dict(file=f[:30], n_ais=len(ais), ais_up=int((ais == "up").sum()),
                             n_ra=len(ra), ra_down=int((ra == "down").sum()), ra_trans=int((ra == "transition").sum()),
                             ra_up=int((ra == "up").sum()), label_time_to_first_RAAP=tf[f]))
        t = pd.DataFrame(rows)
        res_states[(reading, pot)] = t
        n_ais = int((t.n_ais > 0).sum())
        all_up = int(((t.n_ais > 0) & (t.ais_up == t.n_ais)).sum())
        n_ra = int((t.n_ra > 0).sum())
        ra_dt = int(((t.n_ra > 0) & ((t.ra_down + t.ra_trans) > 0)).sum())
        print(f"reading ({reading}), potential {pot}: cells with AIS-APs {n_ais} (expected 7), all AIS-APs "
              f"in up states in {all_up}; cells with RA-APs {n_ra} (expected 6), with RA-APs in down or "
              f"transition states {ra_dt}")
print(res_states[("i", "vpre")].to_string())
print("files with a 'Time To first RAAP' entry:", {k[:30]: v for k, v in tf.items() if v != "NaN"})
d = H[H.file.isin([k for k, v in tf.items() if v != "NaN"])]
print("RA-APs by the mixture in those files:", d.groupby("file").ra.sum().to_dict())
print("variant AP rule (peak >= threshold + 30 mV): APs",
      int(sum(r["aps"].variant30.sum() for r in hrows if len(r["aps"]))), "of which also main",
      int(sum((r["aps"].variant30 & r["aps"].main).sum() for r in hrows if len(r["aps"]))))
reading (i), potential vpre: cells with AIS-APs 20 (expected 7), all AIS-APs in up states in 10; cells with RA-APs 12 (expected 6), with RA-APs in down or transition states 6
reading (i), potential thr: cells with AIS-APs 20 (expected 7), all AIS-APs in up states in 11; cells with RA-APs 12 (expected 6), with RA-APs in down or transition states 0
reading (ii), potential vpre: cells with AIS-APs 20 (expected 7), all AIS-APs in up states in 10; cells with RA-APs 12 (expected 6), with RA-APs in down or transition states 6
reading (ii), potential thr: cells with AIS-APs 20 (expected 7), all AIS-APs in up states in 11; cells with RA-APs 12 (expected 6), with RA-APs in down or transition states 0
                              file  n_ais  ais_up  n_ra  ra_down  ra_trans  ra_up label_time_to_first_RAAP
0   sub-160812_ses-1608121tm-4-8-1     23      19   713        3         0    710                      NaN
1   sub-160812_ses-1608121tm-5-7-4      1       1     0        0         0      0                    305.0
2   sub-161004_ses-1610042tm-1-1-2     32      32     2        0         0      2                      NaN
3   sub-161004_ses-1610042tm-2-1-2      8       8    32        0         0     32                      NaN
4   sub-161005_ses-1610052tm-1-1-4      0       0    10        0         0     10                      NaN
5   sub-161011_ses-1610111tm-1-1-4      7       7   234        0         2    232                      NaN
6   sub-161011_ses-1610111tm-2-1-4     97      97     0        0         0      0                      NaN
7   sub-161014_ses-1610141tm-1-1-4   1048    1048    24        0         0     24                      NaN
8   sub-161025_ses-1610251tm-1-1-4     54      50     2        0         0      2                    701.0
9   sub-161025_ses-1610252tm-2-1-4    251     248     8        5         2      1                    716.0
10  sub-161130_ses-1611301tm-1-1-4      1       1     0        0         0      0                      NaN
11  sub-161130_ses-1611301tm-2-1-4      1       0     0        0         0      0                      NaN
12  sub-170323_ses-1703231tm-1-1-4      1       1     0        0         0      0                      NaN
13  sub-170323_ses-1703231tm-2-1-4      4       2     0        0         0      0                      NaN
14  sub-170323_ses-1703232tm-2-1-4     20      19    71        1         0     70                     20.0
15  sub-170331_ses-1703311tm-2-1-4     47      45   368        1         0    367                      NaN
16  sub-170719_ses-1707191tm-3-1-4      2       1     0        0         0      0                      NaN
17  sub-170908_ses-1709081tm-3-1-4     11      11     0        0         0      0                      NaN
18  sub-180919_ses-1809191tm-1-7-1      5       3     1        0         1      0                     99.0
19  sub-220120_ses-2201201tm-1-1-1     16      15     0        0         0      0                      NaN
20  sub-220120_ses-2201201tm-3-1-1      6       6     1        0         0      1                      NaN
files with a 'Time To first RAAP' entry: {'sub-160812_ses-1608121tm-5-7-4': '305.0', 'sub-161025_ses-1610252tm-2-1-4': '716.0', 'sub-161025_ses-1610251tm-1-1-4': '701.0', 'sub-170323_ses-1703232tm-2-1-4': '20.0', 'sub-180919_ses-1809191tm-1-7-1': '99.0'}
RA-APs by the mixture in those files: {'sub-160812_ses-1608121tm-5-7-4_icephys.nwb': 0, 'sub-161025_ses-1610251tm-1-1-4_icephys.nwb': 2, 'sub-161025_ses-1610252tm-2-1-4_icephys.nwb': 8, 'sub-170323_ses-1703232tm-2-1-4_icephys.nwb': 71, 'sub-180919_ses-1809191tm-1-7-1_icephys.nwb': 1}
variant AP rule (peak >= threshold + 30 mV): APs 5326 of which also main 5212

Result: blocked (methods_underspecified). The mixture's lower-threshold component has the steeper mean slope (3.54 against 2.18 mV/ms), the opposite of the paper's RA-APs, so its classes are not the paper's and reading (a) cannot be run. For the record, with these classes 20 cells have AIS-APs and 12 RA-APs (expected 7 and 6); with the mean potential before threshold, reading (i), all AIS-APs are in up states in 10 of 20 cells and RA-APs reach down or transition states in 6 of 12.

fig3f-human-pre-ap-fluctuation¶

In active human slices, membrane potential fluctuations (SD) 0 to 50 ms before AIS-APs are larger than before RA-APs (1.49 against 0.78 mV).

The SD of the membrane potential in the 50 ms before each AP, the window ending at the threshold or at the peak (the criterion's readings), APs pooled across cells, classes as above. APs with less than 50 ms of trace before them are left out.

In [14]:
def sd_compare(D, label):
    """Pooled and per-cell comparison; the variant 'isolated' keeps APs with no AP in the 50 ms
    before their threshold, so that the window holds no spike (not in the paper; shown because a
    preceding spike inflates the SD)."""
    D = D.sort_values(["file", "series", "t_thr"]).copy()
    prev = D.groupby(["file", "series"]).t_peak.shift(1)
    D["isolated"] = (D.t_thr - prev).fillna(np.inf) > 0.05
    for col in ("sd_thr", "sd_peak"):
        a, b = D[~D.ra & D.isolated][col].dropna(), D[D.ra & D.isolated][col].dropna()
        p = stats.mannwhitneyu(a, b).pvalue if len(a) and len(b) else np.nan
        print(f"{label} [isolated APs] window to {col[3:]}: AIS-AP {a.median():.2f} mV (n={len(a)}), "
              f"RA-AP {b.median():.2f} mV (n={len(b)}), Mann-Whitney P = {p:.2g}")
        a, b = D[~D.ra][col].dropna(), D[D.ra][col].dropna()
        p = stats.mannwhitneyu(a, b, alternative="two-sided").pvalue if len(a) and len(b) else np.nan
        pc = D.dropna(subset=[col]).groupby(["file", "ra"])[col].median().unstack()
        pcp = stats.mannwhitneyu(pc[False].dropna(), pc[True].dropna()).pvalue if True in pc and pc[True].notna().sum() > 0 else np.nan
        print(f"{label} window to {col[3:]}: AIS-AP SD median {a.median():.2f} mV (n={len(a)}), RA-AP "
              f"{b.median():.2f} mV (n={len(b)}), Mann-Whitney P = {p:.2g}; per-cell medians "
              f"P = {pcp:.2g} ({pc[False].notna().sum()} and {pc[True].notna().sum() if True in pc else 0} cells)")


sd_compare(H, "human")
print("expected: AIS 1.49 mV, RA 0.78 mV (tolerance 10%), Mann-Whitney P < 0.001")
human [isolated APs] window to thr: AIS-AP 2.04 mV (n=895), RA-AP 2.71 mV (n=747), Mann-Whitney P = 8.7e-87
human window to thr: AIS-AP SD median 3.18 mV (n=1633), RA-AP 5.43 mV (n=1466), Mann-Whitney P = 2.2e-73; per-cell medians P = 0.09 (20 and 12 cells)
human [isolated APs] window to peak: AIS-AP 4.30 mV (n=895), RA-AP 4.95 mV (n=747), Mann-Whitney P = 1.8e-98
human window to peak: AIS-AP SD median 4.97 mV (n=1633), RA-AP 7.13 mV (n=1466), Mann-Whitney P = 2e-79; per-cell medians P = 0.11 (20 and 12 cells)
expected: AIS 1.49 mV, RA 0.78 mV (tolerance 10%), Mann-Whitney P < 0.001

Result: blocked (methods_underspecified). The classes are those of fig3-human-ap-states, whose RA component has the steeper slope. For the record, with these classes the SD before RA-APs is the higher one (window to threshold 5.43 against 3.18 mV, P = 2.2e-73; window to peak 7.13 against 4.97 mV).

Rat active slices with layer 5 LFP¶

The condition of each recording is read from general/pharmacology: carbachol (also spelled Charbachol) with SCH23390 is the active slice of Figure 3; recordings with neither are the slices without modulators of Figure S3. Some recordings list further drugs (kainic acid, gabazine, 4-AP); they are kept in the main set and left out in a variant. APs of the gap-free sweeps of at least 5 s (long_sweep_aps), classed by reading (b), a mixture fitted to these APs of all rat slice recordings of this folder pooled. The variant keeps only APs without steady current: at most 5 pA at threshold in absolute terms, holding current included (the first round measured it relative to the holding level, which removed nothing).

In [15]:
def cond(m):
    drugs = {v.lower().replace("charbachol", "carbachol") for k, v in m["pharmacology"].items()
             if k.startswith("DrugName") and v != "NaN"}
    if {"carbachol", "sch23390"} <= drugs:
        return "modulators" + ("+" + "+".join(sorted(drugs - {"carbachol", "sch23390"})) if drugs - {"carbachol", "sch23390"} else "")
    if not drugs:
        return "none"
    return "+".join(sorted(drugs))


def long_sweep_aps(r, min_s=5.0):
    """APs of the gap-free sweeps (at least 5 s; a standard choice), with or without a steady
    current: the Methods say some cells needed steady somatic current to reach AIS-AP threshold
    ("In vitro oscillations")."""
    a, s = r["aps"], r["sw"]
    if not len(a):
        return a
    long_ = set(s[(s.n / s.rate >= min_s) & s.chan.str.startswith("Vm")].series)
    return a[a.main & raf.plausible(a) & a.series.isin(long_)]


R = []
for r in rows_osc:
    r["cond"] = cond(r["meta"])
    a = long_sweep_aps(r)
    if len(a):
        R.append(a.assign(file=r["file"], cond=r["cond"]))
R = pd.concat(R)
R["ra"], GM_R = raf.gmm_classes(R, seed("fig3l-rat-spontaneous-ra-proportion"))
R["steady"] = R.i_abs > 5
print("mixture components:", {k: (round(v, 2) if isinstance(v, float) else v) for k, v in GM_R.items()})
print("RA component size under seeds +0, +1000 to +4000:", raf.gmm_seed_range(R, seed("fig3l-rat-spontaneous-ra-proportion")))
print("recordings by condition:", dict(collections.Counter(r["cond"] for r in rows_osc)))
print(f"APs of gap-free sweeps {len(R)}, RA-APs {int(R.ra.sum())}; of these without steady current "
      f"(absolute current at most 5 pA) {int((~R.steady).sum())}, RA-APs among them {int((R.ra & ~R.steady).sum())}; "
      f"APs without a stimulus series {int(R.i_abs.isna().sum())}")
print(R.groupby("ra")[["thr", "slope"]].median().round(2))
fig, ax = plt.subplots(figsize=(5, 4))
ax.scatter(R.thr, R.slope.clip(-5, 15), s=2, c=np.where(R.ra, "b", "k"), alpha=0.3)
ax.set(xlabel="threshold (mV)", ylabel="pre-AP slope (mV/ms), clipped to -5 to 15",
       title="rat active slices: blue RA component, black AIS")
plt.show()
print(f"slopes outside -5 to 15 mV/ms: {int((~R.slope.between(-5, 15)).sum())}")
mixture components: {'n': 18779, 'n_ra': 14161, 'w_ra': 0.69, 'w_ais': 0.31, 'thr_ra': -50.81, 'thr_ais': -44.07, 'slope_ra': 1.12, 'slope_ais': 2.79, 'sd_thr_ra': 7.67, 'sd_thr_ais': 6.98, 'sd_slope_ra': 0.65, 'sd_slope_ais': 1.79, 'ra_slope_lower': True}
RA component size under seeds +0, +1000 to +4000: [14161, 14164, 14164, 14164, 14164]
recordings by condition: {'modulators': 30, 'modulators+gabazine+kainic-acid': 1, 'modulators+gabazine': 4, 'carbachol+kainic-acid+sch23391': 1, 'none': 2, 'modulators+4-ap': 1}
APs of gap-free sweeps 18779, RA-APs 14161; of these without steady current (absolute current at most 5 pA) 18231, RA-APs among them 13730; APs without a stimulus series 0
         thr  slope
ra                 
False -42.98   2.98
True  -51.02   1.06
No description has been provided for this image
slopes outside -5 to 15 mV/ms: 13
In [16]:
# Share of APs in the RA class, against the paper's counts (verifier, round 2). Figure 3M counts 76
# RA-APs and 534 AIS-APs in 22 rat cells; the human bleb mixture of fig1hk is shown beside it.
per = R.groupby("file").ra.mean()
kept = R[R.file.isin([r["file"] for r in rows_osc if r["cond"].startswith("modulators")])]
print(f"rat active slices, all gap-free APs: RA class {int(R.ra.sum())} of {len(R)} ({R.ra.mean():.3f}); "
      f"carbachol + SCH23390 recordings {int(kept.ra.sum())} of {len(kept)} ({kept.ra.mean():.3f})")
print(f"   per recording, median RA share {per.median():.3f}; recordings where the RA class is more than half "
      f"of the APs {int((per > 0.5).sum())} of {len(per)}")
print(f"paper, Figure 3M: 76 of {76 + 534} APs ({76 / (76 + 534):.3f})")
print(f"human bleb mixture (fig1hk): {int(allh.ra.sum())} of {len(allh)} ({allh.ra.mean():.3f})")
print("component threshold medians (mV): RA", round(R[R.ra].thr.median(), 1), "AIS", round(R[~R.ra].thr.median(), 1))
rat active slices, all gap-free APs: RA class 14161 of 18779 (0.754); carbachol + SCH23390 recordings 13674 of 18258 (0.749)
   per recording, median RA share 0.868; recordings where the RA class is more than half of the APs 28 of 32
paper, Figure 3M: 76 of 610 APs (0.125)
human bleb mixture (fig1hk): 74 of 658 (0.112)
component threshold medians (mV): RA -51.0 AIS -43.0

The rat mixture passes the slope check, but its RA class holds about three quarters of the APs (0.754 over all APs, 0.70 after the delta selection of the phase analysis below), against one eighth in the paper's Figure 3M (76 of 610), and it is more than half of the APs in 28 of 32 recordings. Its classes therefore cannot be the paper's, which is what the human and in vivo claims have in common with these (there the evidence was an inverted slope). The two classes also lie 8 mV apart in threshold; in the rat induction recordings, where the classes come from the protocol (reading (c)), RA-APs lie about 20 mV below AIS-APs (-61.6 against -41.2 mV in sporadic cells, induction notebook, fig1c), but those AIS-APs are evoked by current pulses and at 100 kHz the order reverses, so this comparison is weaker evidence than the share. The four rat claims that rest on these classes (fig3l, fig3k, fig3m-rat-ais-phase-coupling, fig3m-rat-ra-no-phase) are blocked (methods_underspecified); the verifier agreed in round 3.

fig3i-rat-lfp-rhythm¶

In active rat slices, layer 5 LFP shows rhythmic low-frequency deflections at 1.1 Hz, synchronized to up states of the layer 1 interneurons.

Per recording, LFP segments of at least 8 s, resampled to 500 Hz. Reading (i): the peak of the Welch power spectrum (8 s windows, averaged over segments) in 0.5 to 4 Hz; reading (ii): the number of cycles of the 0.5 to 4 Hz Butterworth-filtered LFP (order 2, zero phase, as in the header) per second, counted as wraps of the Hilbert phase. Median over recordings.

In [17]:
FS = 500.0


def lfp_segments(r, min_s=8.0):
    out = []
    for name, (st, rate, x) in sorted(r["lfp"].items(), key=lambda kv: kv[1][0]):
        if len(x) / rate < min_s:
            continue
        q = int(round(rate / FS))
        y = signal.decimate(x.astype(float), q, ftype="fir") if q > 1 else x.astype(float)
        out.append((st, rate / q, y))
    return out


def rhythm(r, band=(0.5, 4.0), order=2):
    segs = lfp_segments(r, 8.0 if band[0] >= 0.5 else 40.0)
    if not segs:
        return dict(n_seg=0, lfp_s=0.0)
    nper = int((8 if band[0] >= 0.5 else 40) * FS)
    ps = []
    cyc, dur = 0.0, 0.0
    sos = signal.butter(order, band, btype="band", fs=FS, output="sos")
    for st, fs, y in segs:
        f, p = signal.welch(y - y.mean(), fs=fs, nperseg=min(nper, len(y)))
        ps.append(np.interp(np.arange(0, 10, 0.025), f, p))
        ph = np.unwrap(np.angle(signal.hilbert(signal.sosfiltfilt(sos, y))))
        cyc += (ph[-1] - ph[0]) / (2 * np.pi)
        dur += len(y) / fs
    f = np.arange(0, 10, 0.025)
    P = np.mean(ps, axis=0)
    m = (f >= band[0]) & (f <= band[1])
    return dict(n_seg=len(segs), lfp_s=dur, peak_hz=f[m][np.argmax(P[m])], cycles_hz=cyc / dur)


rh = pd.DataFrame([dict(file=r["file"][:32], cond=r["cond"], **rhythm(r)) for r in rows_osc])
print(rh.round(3).to_string())
                                file                             cond  n_seg     lfp_s  peak_hz  cycles_hz
0   sub-1610102tm_ses-1610102tm-1-3,                       modulators      8   396.376    0.500      0.845
1   sub-1611161tm_ses-1611161tm-2-1-                       modulators      4   192.328    1.625      0.790
2   sub-1611161tm_ses-1611161tm-4-1-                       modulators      4   282.292    0.875      0.925
3   sub-1608041tm_ses-1608041tm-3-5,                       modulators     11   765.446    1.500      1.160
4   sub-1611161tm_ses-1611161tm-3-1-                       modulators      6   320.180    0.875      0.940
5   sub-1707261tm_ses-1707261tm-2-3-                       modulators      8   803.652    0.500      0.998
6   sub-1610101tm_ses-1610101tm-3-4-                       modulators     29  1276.018    0.500      1.262
7   sub-1611161tm_ses-1611161tm-6-1-                       modulators      4   342.406    0.875      0.923
8   sub-1707261tm_ses-1707261tm-3-1-                       modulators      2   282.650    0.500      0.584
9   sub-1611161tm_ses-1611161tm-5-1-                       modulators      4   235.090    0.875      0.880
10  sub-1708031tm_ses-1708031tm-3-1-                       modulators      5   660.044    1.375      1.085
11  sub-1611151tm_ses-1611151tm-3-1-                       modulators     35  2193.764    1.125      0.889
12  sub-1708161tm_ses-1708161tm-1-1-                       modulators      3   435.406    1.250      1.573
13  sub-1708161tm_ses-1708161tm-2-1-                       modulators      4   497.410    1.500      1.550
14  sub-1708022tm_ses-1708022tm-1-2-  modulators+gabazine+kainic-acid     23  2228.478    0.500      1.185
15  sub-1708031tm_ses-1708031tm-5-5-                       modulators     39  2801.438    1.500      0.937
16  sub-1708162tm_ses-1708162tm-2-1-                       modulators     12   776.380    0.500      1.298
17  sub-1708162tm_ses-1708162tm-2-9-                       modulators     10   350.360    0.500      1.162
18  sub-1709151tm_ses-1709151tm-2-1-                       modulators      3   265.078    1.375      1.543
19  sub-1708171tm_ses-1708171tm-3-1-                       modulators      4   653.000    0.500      1.591
20  sub-1708171tm_ses-1708171tm-2-1-                       modulators     19  1355.964    1.750      1.569
21  sub-1807261tm_ses-1807261tm-4-1-              modulators+gabazine      9   346.916    1.000      0.571
22  sub-1709151tm_ses-1709151tm-1-1,                       modulators     19  2167.294    1.250      1.579
23  sub-1807301tm_ses-1807301tm-2-1-              modulators+gabazine     21  1294.862    0.500      1.028
24  sub-1807272tm_ses-1807272tm-3-1-              modulators+gabazine     16  1814.966    0.500      1.026
25  sub-1808102tm_ses-1808102tm-4-1,                       modulators      6   208.130    1.125      0.615
26  sub-1809111tm_ses-1809111tm-1-3,                       modulators      9   677.122    1.375      1.524
27  sub-1708312tm_ses-1708312tm-7-1-                       modulators     24  4024.176    0.500      1.352
28  sub-1809071tm_ses-1809071tm-2-1,                       modulators     27  1138.818    2.250      1.961
29  sub-1809111tm_ses-1809111tm-2-1,                       modulators      3    63.342    1.500      1.058
30  sub-1809181tm_ses-1809181tm-1-3,                       modulators      7   332.390    1.750      0.484
31  sub-1808102tm_ses-1808102tm-5-1,                       modulators      6   470.822    1.125      0.935
32  sub-1807302tm_ses-1807302tm-3-1,              modulators+gabazine     30  1811.262    0.500      0.733
33  sub-1809262tm_ses-1809262tm-1-2,   carbachol+kainic-acid+sch23391     14   717.240    0.500      0.250
34  sub-1810101tm_ses-1810101tm-2-1,                       modulators     16   627.898    1.250      0.960
35  sub-1810101tm_ses-1810101tm-3-1-                       modulators      6   224.904    1.250      0.960
36  sub-1908151tm_ses-1908151tm-2-1,                             none      5   792.596    0.500      0.394
37  sub-1810241tm_ses-1810241tm-1-2-                  modulators+4-ap     20   901.046    0.500      0.889
38  sub-1908151tm_ses-1908151tm-3-1,                             none     24  2136.376    0.500      0.406
In [18]:
for label, d in (("carbachol + SCH23390, all", rh[rh.cond.str.startswith("modulators")]),
                 ("carbachol + SCH23390 only", rh[rh.cond == "modulators"])):
    d = d[d.n_seg > 0]
    print(f"{label}: recordings with LFP {len(d)}; (i) spectral peak median {d.peak_hz.median():.2f} Hz "
          f"(SD {d.peak_hz.std():.2f}); (ii) cycle rate median {d.cycles_hz.median():.2f} Hz (SD {d.cycles_hz.std():.2f})")
print("expected: 1.1 Hz (tolerance 0.11)")
carbachol + SCH23390, all: recordings with LFP 36; (i) spectral peak median 1.06 Hz (SD 0.48); (ii) cycle rate median 1.01 Hz (SD 0.35)
carbachol + SCH23390 only: recordings with LFP 30; (i) spectral peak median 1.19 Hz (SD 0.47); (ii) cycle rate median 1.03 Hz (SD 0.36)
expected: 1.1 Hz (tolerance 0.11)

Result: reproduced. Over 36 recordings the LFP's spectral peak is at a median 1.06 Hz and its cycle rate 1.01 Hz (30 recordings without extra drugs: 1.19 and 1.03 Hz), all within 1.1 +- 0.11 Hz. The synchronization to up states is not judged (criterion).

fig3l-rat-spontaneous-ra-proportion¶

In active rat slices, 13 of 40 layer 1 interneurons fire spontaneous RA-APs, and all recovered ones (n = 5) are NGFCs.

In [19]:
for label, keep, nosteady in (("carbachol + SCH23390, all", lambda c: c.startswith("modulators"), False),
                              ("carbachol + SCH23390 only", lambda c: c == "modulators", False),
                              ("carbachol + SCH23390, all, APs under steady current left out", lambda c: c.startswith("modulators"), True)):
    files = [r["file"] for r in rows_osc if keep(r["cond"])]
    d = R[R.file.isin(files)]
    if nosteady:
        d = d[~d.steady]
    per = d.groupby("file").ra.sum().reindex(files, fill_value=0)
    print(f"{label}: cells {len(files)}, with at least one RA-AP {int((per > 0).sum())}, with at least two "
          f"{int((per > 1).sum())}; RA-APs per cell {sorted(per[per > 0].astype(int).tolist())}")
print("expected: 13 cells (tolerance 1.3) of 40. Cell morphology: no cell type field in these files.")
carbachol + SCH23390, all: cells 36, with at least one RA-AP 29, with at least two 27; RA-APs per cell [1, 1, 2, 2, 3, 5, 6, 6, 6, 11, 11, 13, 15, 15, 16, 17, 18, 19, 22, 43, 65, 92, 233, 238, 445, 518, 1672, 3266, 6913]
carbachol + SCH23390 only: cells 30, with at least one RA-AP 23, with at least two 21; RA-APs per cell [1, 1, 2, 2, 3, 5, 6, 6, 6, 11, 11, 13, 15, 15, 16, 17, 18, 19, 43, 65, 92, 238, 445]
carbachol + SCH23390, all, APs under steady current left out: cells 36, with at least one RA-AP 28, with at least two 26; RA-APs per cell [1, 1, 2, 2, 3, 5, 6, 6, 6, 11, 11, 13, 15, 16, 17, 18, 19, 22, 33, 43, 61, 92, 233, 238, 518, 1672, 3266, 6913]
expected: 13 cells (tolerance 1.3) of 40. Cell morphology: no cell type field in these files.

Result: blocked (methods_underspecified). The mixture, whose RA component has the lower threshold and the lower slope as the paper describes (-50.8 against -44.1 mV, 1.12 against 2.79 mV/ms), labels RA-APs in 29 of 36 active-slice cells (23 of 30 without extra drugs; 28 of 36 without APs under steady current), against 13 of 40. The mixture's classes fail the share check above (about three quarters of the APs in the RA class, against one eighth in the paper), so these numbers do not test the claim; the outcome was changed from not reproduced to blocked after verification round 3.

fig3k-rat-pre-ap-fluctuation¶

In active rat slices, AIS-APs occur during up states with larger membrane potential fluctuations before them, and RA-APs during down states with smaller ones.

In [20]:
RA_ = R[R.cond.str.startswith("modulators")]
sd_compare(RA_, "rat")
print("The state of each rat AP is not computed here: the rat files' sweeps without current are")
print("the same kind, but the claim does not judge it (criterion).")
rat [isolated APs] window to thr: AIS-AP 2.23 mV (n=1489), RA-AP 0.87 mV (n=5817), Mann-Whitney P = 7.1e-251
rat window to thr: AIS-AP SD median 8.78 mV (n=4579), RA-AP 7.82 mV (n=13649), Mann-Whitney P = 4.3e-65; per-cell medians P = 0.25 (21 and 29 cells)
rat [isolated APs] window to peak: AIS-AP 4.48 mV (n=1489), RA-AP 3.62 mV (n=5817), Mann-Whitney P = 1.4e-168
rat window to peak: AIS-AP SD median 10.03 mV (n=4579), RA-AP 8.65 mV (n=13649), Mann-Whitney P = 5.7e-75; per-cell medians P = 0.41 (21 and 29 cells)
The state of each rat AP is not computed here: the rat files' sweeps without current are
the same kind, but the claim does not judge it (criterion).

Result: blocked (methods_underspecified). Under the mixture classes, the SD before AIS-APs is higher with the window ending at the peak (10.03 against 8.65 mV, Mann-Whitney P = 5.9e-75) and at threshold (8.78 against 7.82 mV, P = 4.3e-65), and among isolated APs; per-cell medians do not differ (P = 0.25 and 0.41). The mixture's classes fail the share check above (about three quarters of the APs in the RA class, against one eighth in the paper), so these numbers do not test the claim; the outcome was changed from reproduced to blocked after verification round 3.

fig3m-rat-ais-phase-coupling and fig3m-rat-ra-no-phase¶

In active rat slices, AIS-APs are coupled near the trough of the slow LFP oscillation (mean vector length 0.093, angle 314 degrees). RA-APs show no phase preference.

The Methods' phase procedure (header of the claims file): for each AP, the 4 s LFP segment centred on its peak; FFT power times frequency; the AP is kept when the power in 0.5 to 4 Hz over that in 0.5 to 45 Hz exceeds 0.1. The LFP segment is band-passed 0.5 to 4 Hz (Butterworth order 2, zero phase; order 4 the variant), Hilbert phase at the AP peak, shifted by 180 degrees so that the trough is 0 and 360 degrees and the peak 180 (Methods convention). Rayleigh test on the APs pooled across cells.

In [21]:
def ap_phases(r, aps, order=2):
    out = []
    for name, (st, rate, x) in r["lfp"].items():
        dur = len(x) / rate
        sel = aps[(aps.t_peak_abs >= st + 2) & (aps.t_peak_abs <= st + dur - 2)]
        if not len(sel):
            continue
        q = int(round(rate / FS))
        y = signal.decimate(x.astype(float), q, ftype="fir") if q > 1 else x.astype(float)
        fs = rate / q
        sos = signal.butter(order, (0.5, 4.0), btype="band", fs=fs, output="sos")
        ph = np.angle(signal.hilbert(signal.sosfiltfilt(sos, y)), deg=True)
        for _, ap in sel.iterrows():
            i = int(round((ap.t_peak_abs - st) * fs))
            h = int(round(2 * fs))
            if i - h < 0 or i + h > len(y):
                continue
            seg = y[i - h:i + h]
            F = np.fft.rfftfreq(len(seg), 1 / fs)
            P = np.abs(np.fft.rfft(seg - seg.mean())) ** 2 * F
            ratio = P[(F >= 0.5) & (F <= 4)].sum() / P[(F >= 0.5) & (F <= 45)].sum()
            out.append(dict(file=r["file"], cond=r["cond"], ra=ap.ra, steady=ap.steady, ratio=ratio,
                            phase=(ph[i] + 180) % 360))
    return pd.DataFrame(out)


R["t_peak_abs"] = R.sweep_start + R.t_peak
PH = {}
for order in (2, 4):
    parts = []
    for r in rows_osc:
        if not r["cond"].startswith("modulators"):
            continue
        d = R[R.file == r["file"]]
        if len(d):
            parts.append(ap_phases(r, d, order))
    PH[order] = pd.concat(parts)
print({o: len(v) for o, v in PH.items()}, "APs with a 4 s LFP segment")
{2: 16806, 4: 16806} APs with a 4 s LFP segment
In [22]:
def phase_report(P, label):
    for ra, name in ((False, "AIS-APs"), (True, "RA-APs")):
        d = P[P.ra == ra]
        k = d[d.ratio > 0.1]
        rr, ang, p, n = raf.rayleigh(k.phase)
        print(f"{label} {name}: with LFP {len(d)} from {d.file.nunique()} cells; kept by delta ratio {n} "
              f"from {k.file.nunique()} cells; vector length {rr:.3f}, angle {ang:.0f} deg, Rayleigh P = {p:.2g}")
        if len(k):
            print("   per cell (kept APs):", k.groupby("file").size().sort_values(ascending=False).head(25).to_dict())


phase_report(PH[2], "order 2")
phase_report(PH[4], "order 4")
phase_report(PH[2][PH[2].cond == "modulators"], "order 2, carbachol + SCH23390 only")
phase_report(PH[2][~PH[2].steady], "order 2, APs under steady current left out")
print("expected AIS-APs: length 0.093 (tolerance 0.0093), angle 314 deg (within 31.4), P < 0.001, n = 534 from 22 cells")
print("expected RA-APs: P = 0.07 (no preference at P < 0.05), n = 76 from 22 cells")
order 2 AIS-APs: with LFP 4261 from 17 cells; kept by delta ratio 3867 from 15 cells; vector length 0.313, angle 256 deg, Rayleigh P = 5.1e-169
   per cell (kept APs): {'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 1634, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 689, 'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 472, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 471, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 371, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 143, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 42, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 15, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 10, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 9, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 5, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 3, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 1, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 1, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 1}
order 2 RA-APs: with LFP 12545 from 27 cells; kept by delta ratio 8896 from 24 cells; vector length 0.192, angle 293 deg, Rayleigh P = 1.3e-144
   per cell (kept APs): {'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 3585, 'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 2902, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 1043, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 466, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 433, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 197, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 117, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 43, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 18, 'sub-1809071tm_ses-1809071tm-2-1,3-1_icephys.nwb': 15, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 13, 'sub-1610101tm_ses-1610101tm-3-4-4_icephys.nwb': 12, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 10, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 9, 'sub-1807261tm_ses-1807261tm-4-1-1_icephys.nwb': 8, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 5, 'sub-1709151tm_ses-1709151tm-1-1,11-4_icephys.nwb': 5, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 4, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 3, 'sub-1708162tm_ses-1708162tm-2-1-4_icephys.nwb': 2, 'sub-1708312tm_ses-1708312tm-7-1-4_icephys.nwb': 2, 'sub-1809181tm_ses-1809181tm-1-3,4-1_icephys.nwb': 2, 'sub-1707261tm_ses-1707261tm-2-3-4_icephys.nwb': 1, 'sub-1707261tm_ses-1707261tm-3-1-4_icephys.nwb': 1}
order 4 AIS-APs: with LFP 4261 from 17 cells; kept by delta ratio 3867 from 15 cells; vector length 0.307, angle 255 deg, Rayleigh P = 2.2e-162
   per cell (kept APs): {'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 1634, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 689, 'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 472, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 471, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 371, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 143, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 42, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 15, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 10, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 9, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 5, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 3, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 1, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 1, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 1}
order 4 RA-APs: with LFP 12545 from 27 cells; kept by delta ratio 8896 from 24 cells; vector length 0.188, angle 291 deg, Rayleigh P = 5.1e-139
   per cell (kept APs): {'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 3585, 'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 2902, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 1043, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 466, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 433, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 197, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 117, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 43, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 18, 'sub-1809071tm_ses-1809071tm-2-1,3-1_icephys.nwb': 15, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 13, 'sub-1610101tm_ses-1610101tm-3-4-4_icephys.nwb': 12, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 10, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 9, 'sub-1807261tm_ses-1807261tm-4-1-1_icephys.nwb': 8, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 5, 'sub-1709151tm_ses-1709151tm-1-1,11-4_icephys.nwb': 5, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 4, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 3, 'sub-1708162tm_ses-1708162tm-2-1-4_icephys.nwb': 2, 'sub-1708312tm_ses-1708312tm-7-1-4_icephys.nwb': 2, 'sub-1809181tm_ses-1809181tm-1-3,4-1_icephys.nwb': 2, 'sub-1707261tm_ses-1707261tm-2-3-4_icephys.nwb': 1, 'sub-1707261tm_ses-1707261tm-3-1-4_icephys.nwb': 1}
order 2, carbachol + SCH23390 only AIS-APs: with LFP 315 from 12 cells; kept by delta ratio 230 from 10 cells; vector length 0.655, angle 319 deg, Rayleigh P = 2.4e-49
   per cell (kept APs): {'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 143, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 42, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 15, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 10, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 9, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 5, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 3, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 1, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 1, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 1}
order 2, carbachol + SCH23390 only RA-APs: with LFP 925 from 21 cells; kept by delta ratio 695 from 18 cells; vector length 0.575, angle 319 deg, Rayleigh P = 1.5e-110
   per cell (kept APs): {'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 433, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 117, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 43, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 18, 'sub-1809071tm_ses-1809071tm-2-1,3-1_icephys.nwb': 15, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 13, 'sub-1610101tm_ses-1610101tm-3-4-4_icephys.nwb': 12, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 10, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 9, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 5, 'sub-1709151tm_ses-1709151tm-1-1,11-4_icephys.nwb': 5, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 4, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 3, 'sub-1708162tm_ses-1708162tm-2-1-4_icephys.nwb': 2, 'sub-1708312tm_ses-1708312tm-7-1-4_icephys.nwb': 2, 'sub-1809181tm_ses-1809181tm-1-3,4-1_icephys.nwb': 2, 'sub-1707261tm_ses-1707261tm-2-3-4_icephys.nwb': 1, 'sub-1707261tm_ses-1707261tm-3-1-4_icephys.nwb': 1}
order 2, APs under steady current left out AIS-APs: with LFP 4146 from 17 cells; kept by delta ratio 3752 from 15 cells; vector length 0.311, angle 251 deg, Rayleigh P = 8.1e-163
   per cell (kept APs): {'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 1634, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 689, 'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 472, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 471, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 371, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 42, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 28, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 15, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 10, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 9, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 5, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 3, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 1, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 1, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 1}
order 2, APs under steady current left out RA-APs: with LFP 12126 from 26 cells; kept by delta ratio 8479 from 23 cells; vector length 0.164, angle 289 deg, Rayleigh P = 6.3e-100
   per cell (kept APs): {'sub-1708022tm_ses-1708022tm-1-2-4_icephys.nwb': 3585, 'sub-1807302tm_ses-1807302tm-3-1,2,4-1_icephys.nwb': 2902, 'sub-1807301tm_ses-1807301tm-2-1-1_icephys.nwb': 1043, 'sub-1807272tm_ses-1807272tm-3-1-1_icephys.nwb': 466, 'sub-1810241tm_ses-1810241tm-1-2-1_icephys.nwb': 197, 'sub-1708031tm_ses-1708031tm-5-5-4_icephys.nwb': 117, 'sub-1608041tm_ses-1608041tm-3-5,17-4_icephys.nwb': 42, 'sub-1611151tm_ses-1611151tm-3-1-4_icephys.nwb': 32, 'sub-1708171tm_ses-1708171tm-2-1-3_icephys.nwb': 18, 'sub-1708171tm_ses-1708171tm-3-1-3_icephys.nwb': 13, 'sub-1610101tm_ses-1610101tm-3-4-4_icephys.nwb': 12, 'sub-1709151tm_ses-1709151tm-2-1-4_icephys.nwb': 10, 'sub-1809111tm_ses-1809111tm-2-1,5-1_icephys.nwb': 9, 'sub-1807261tm_ses-1807261tm-4-1-1_icephys.nwb': 8, 'sub-1708031tm_ses-1708031tm-3-1-4_icephys.nwb': 5, 'sub-1709151tm_ses-1709151tm-1-1,11-4_icephys.nwb': 5, 'sub-1610102tm_ses-1610102tm-1-3,12-4_icephys.nwb': 4, 'sub-1810101tm_ses-1810101tm-3-1-1_icephys.nwb': 3, 'sub-1708162tm_ses-1708162tm-2-1-4_icephys.nwb': 2, 'sub-1708312tm_ses-1708312tm-7-1-4_icephys.nwb': 2, 'sub-1809181tm_ses-1809181tm-1-3,4-1_icephys.nwb': 2, 'sub-1707261tm_ses-1707261tm-3-1-4_icephys.nwb': 1, 'sub-1707261tm_ses-1707261tm-2-3-4_icephys.nwb': 1}
expected AIS-APs: length 0.093 (tolerance 0.0093), angle 314 deg (within 31.4), P < 0.001, n = 534 from 22 cells
expected RA-APs: P = 0.07 (no preference at P < 0.05), n = 76 from 22 cells

Result: blocked (methods_underspecified). Under the mixture classes and without the recordings with extra drugs, 230 AIS-APs from 10 cells are coupled near the trough (319 degrees, Rayleigh P = 2.4e-49) with a vector length of 0.655, not 0.093; with all 36 recordings the angle is 256 degrees, outside tolerance; order 4 gives 255 degrees. The mixture's classes fail the share check above (about three quarters of the APs in the RA class, against one eighth in the paper), so these numbers do not test the claim; the outcome was changed from partially reproduced to blocked after verification round 3.

In [23]:
d = PH[2][PH[2].ra & (PH[2].ratio > 0.1)]
rr, ang, p, n = raf.rayleigh(d.phase)
print(f"RA-APs, order 2: n {n}, vector length {rr:.3f}, angle {ang:.0f} deg, Rayleigh P = {p:.3g}")
d2 = PH[2][PH[2].ra & (PH[2].ratio > 0.1) & (PH[2].cond == "modulators")]
print("order 2, carbachol + SCH23390 only: n %d, length %.3f, angle %.0f, P = %.3g" % (raf.rayleigh(d2.phase)[3], *raf.rayleigh(d2.phase)[:3]))
d4 = PH[4][PH[4].ra & (PH[4].ratio > 0.1)]
print("order 4: n %d, length %.3f, angle %.0f, P = %.3g" % (raf.rayleigh(d4.phase)[3], *raf.rayleigh(d4.phase)[:3]))
d5 = PH[2][PH[2].ra & (PH[2].ratio > 0.1) & ~PH[2].steady]
print("order 2, APs under steady current left out: n %d, length %.3f, angle %.0f, P = %.3g" % (raf.rayleigh(d5.phase)[3], *raf.rayleigh(d5.phase)[:3]))
RA-APs, order 2: n 8896, vector length 0.192, angle 293 deg, Rayleigh P = 1.3e-144
order 2, carbachol + SCH23390 only: n 695, length 0.575, angle 319, P = 1.47e-110
order 4: n 8896, length 0.188, angle 291, P = 5.06e-139
order 2, APs under steady current left out: n 8479, length 0.164, angle 289, P = 6.26e-100

Result: blocked (methods_underspecified). Under the mixture classes, RA-APs are phase coupled in every population (all recordings: 8896 APs, length 0.192, P = 1.3e-144; without extra drugs: 695 APs, length 0.575, P = 1.5e-110; APs under steady current left out: P = 6.3e-100). The mixture's classes fail the share check above (about three quarters of the APs in the RA class, against one eighth in the paper), so these numbers do not test the claim; the outcome was changed from not reproduced to blocked after verification round 3.

figs3-no-modulators¶

In rat slices in in vivo-like ACSF without carbachol and SCH23390 (n = 90), elevated network activity with low-frequency up states (0.11 Hz) appears and layer 1 interneurons fire spontaneous RA-APs (4 NGFCs and 5 non-NGFCs).

In [24]:
nm = [r for r in rows_osc if r["cond"] == "none"]
print(f"recordings without carbachol and SCH23390: {len(nm)} (paper: 90)")
rows = []
for r in nm:
    x = rhythm(r, band=(0.05, 4.0))
    per = R[(R.file == r["file"])].ra.sum()
    rows.append(dict(file=r["file"][:32], ra_aps=int(per), **x))
d = pd.DataFrame(rows)
print(d.round(3).to_string())
if len(d):
    print(f"median spectral peak {d.peak_hz.median():.3f} Hz, cycle rate {d.cycles_hz.median():.3f} Hz; "
          f"cells with RA-APs {int((d.ra_aps > 0).sum())}")
print("expected: 0.11 Hz (tolerance 0.011), 9 cells with RA-APs")
print(f"notebook time {(time.time() - T0) / 60:.1f} min, peak memory "
      f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
recordings without carbachol and SCH23390: 2 (paper: 90)
                               file  ra_aps  n_seg     lfp_s  peak_hz  cycles_hz
0  sub-1908151tm_ses-1908151tm-2-1,       2      4   775.788     0.05      0.040
1  sub-1908151tm_ses-1908151tm-3-1,      98     10  1862.340     0.05      0.049
median spectral peak 0.050 Hz, cycle rate 0.045 Hz; cells with RA-APs 2
expected: 0.11 Hz (tolerance 0.011), 9 cells with RA-APs
notebook time 7.8 min, peak memory 1.6 GB

Result: blocked (data_missing). Only 2 of the paper's 90 recordings without modulators are in the dandiset, both from one rat. Their spectral peak sits at the lower edge of the band (0.05 Hz), so no peak is found, and 2 cells cannot be compared with 9; the numbers above are shown for information.

Summary¶

Claim Outcome
fig2c-zd7288-reduces-raf not reproduced
figs2-zd7288-passive-properties not reproduced
fig1hk-bleb-initiation-order not reproduced
fig2h-bleb-sag-higher partially reproduced
fig3-human-ap-states blocked, methods_underspecified
fig3f-human-pre-ap-fluctuation blocked, methods_underspecified
fig3i-rat-lfp-rhythm reproduced
fig3l-rat-spontaneous-ra-proportion blocked, methods_underspecified
fig3k-rat-pre-ap-fluctuation blocked, methods_underspecified
fig3m-rat-ais-phase-coupling blocked, methods_underspecified
fig3m-rat-ra-no-phase blocked, methods_underspecified
figs3-no-modulators blocked, data_missing
in vivo claims (9) in vivo notebook

A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.

How the analysis differs from the paper's. The dandiset has no AP labels, so AIS-APs and RA-APs are separated by a two-component mixture on threshold and pre-AP slope (reading (b) of the claims file), fitted after artefact APs are removed. In the rat active slices and the human bleb recordings its RA component has the lower threshold and slope, as the paper describes; in the rat bleb recordings and the human active slices it has the steeper slope, so the two human claims are blocked. In the rat active slices the RA class holds 0.754 of the APs (0.70 after the delta selection), against 0.125 in the paper's Figure 3M, so its classes cannot be the paper's either, and the four claims on rat spontaneous activity that rest on them are blocked (methods_underspecified), as the verifier agreed in round 3. The claims file's reading (b) has no share check, so this is a judgement. The ZD7288 comparison splits each recording at the wash-in time the files give. The bleb latency uses the bleb trace around each somatic AP, since bleb APs are too small to detect on their own.

What was found about the dataset. The voltage series state a conversion of 1e-12 while the values are in volts; many stimulus series are stored in pA under a unit of amperes. Sampling rates range from 5 to 100 kHz in these folders. Cell classes are recorded only for the bleb recordings. One bleb file has no bleb sweeps; the per-file median somatic AP thresholds of the bleb recordings lie at -30.4 to -11.2 mV, and some of their hyperpolarizing steps reach below -150 mV. Only 2 of the 90 recordings without modulators are present, and several active rat recordings carry drugs the paper does not mention (gabazine, kainic acid, 4-AP). In 24 of the 39 rat recordings with an LFP every LFP series starts at the same time as a Vm series (median fraction 1.000, lowest 0.667). The AP count and the LFP are no more correlated at lag 0 than at shifted lags (mean -0.046), and the AP-triggered LFP average departs from its time-shifted value (|z| > 2) in 9 of 16 recordings, 7 below and 2 above it, so the evidence for a shared clock in the rat recordings is weak.