Reproducing Peron et al. (2020) from CRCNS ssc-11¶
Paper. Peron S, Pancholi R, Voelcker B, Wittenbach JD, Olafsdottir HF, Freeman J, Svoboda K
(2020). Recurrent interactions in local cortical circuits. Nature 579, 256-259.
doi:10.1038/s41586-020-2062-x. The claims file
(claims/peron-2020.yaml) was written from the version of record, with its Methods, Extended
Data figure legends, Extended Data Table 1 and reporting summary.
Data set. CRCNS ssc-11 (doi:10.6080/K0Z31WWG), read
from the public bucket crcnsarchive under ssc-11/live/data/, one an<id>.tar.gz per mouse
(16 files, 120.9 GB compressed). CRCNS data sets are not versioned, so the version is recorded as
unversioned; the bucket holds one copy of each file (no old/ folder), the one described by
the data descriptor version 0.6 (20 February 2020), which is the version the paper's data
statement points to. It is pinned here by the MD5 sums of checksums.md5, printed below for
every file read, so that a later change is detectable.
Reading. A gzip stream cannot be read at an offset, so each archive is streamed once from
front to back and every member the claims use is reduced in memory as it passes (helper
peron2020.py). Nothing is written to disk. Four archives are read at a time; the full pass
takes 11 to 18 minutes, depending on the connection (648 s in one run and 1,052 s in
another; the time of this run is printed below).
Code. Methods the claims file does not fix are taken from the paper's analysis code, github.com/peronlab/ablation at commit 74b7321, which the claims file cites; each place is named in the helper's docstring or the cell that uses it.
| Claim | Tested here |
|---|---|
| model-amplification-increases, model-equal-connectivity-ablation-increases, model-increased-connectivity-ablation-decreases, model-more-ablation-larger-decline, model-slow-input-sensitive, model-response-similarity | Yes: the network model of the Methods, rebuilt and simulated here (last sections) |
| model-all-or-none-robust | No: the Methods' rule for its input strength gives no positive strength here (blocked, see its section) |
| neurons-per-mouse, representation-sizes | Yes |
| touch-ablation-size, whisking-ablation-size, silent-ablation-size | Yes |
| touch-ablation-reduces-touch, touch-ablation-touch-count, touch-ablation-whisking-unchanged | Yes |
| whisking-ablation-no-effect-touch, whisking-ablation-no-effect-whisking | Yes |
| silent-ablation-no-effect-touch, silent-ablation-no-effect-whisking | Yes |
| ablation-type-specificity, ablation-size-correlation | Yes |
| distance-dependence-touch, distance-dependence-whisking-absent | Yes |
| behaviour-unchanged | Yes |
| response-similarity-touch-ablation, response-similarity-example, response-similarity-whisking-ablation | Yes |
| ablation-no-off-target-event-rate, ablation-success-rate | Yes |
| per-mouse-table | Yes |
| glial-reaction-local | No: the histology is not in the data set (blocked, data missing) |
import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import optimize, stats
import peron2020 as P
warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 200)
started = time.time()
md5 = P.checksums()
data, sizes = P.load_all(workers=4)
print(f"CRCNS {P.DATASET}, version {P.VERSION} (doi:{P.DOI})")
print(f"streamed {len(data)} archives in {time.time() - started:.0f} s")
for a in sorted(data):
r = data[a]
print(f"an{a}.tar.gz md5 {md5['data/an' + a + '.tar.gz']} {sizes[a] / 1e9:5.2f} GB "
f"read {r.get('bytes', 0) / 1e9:5.2f} GB in {r.get('seconds', 0):4.0f} s, reconnections {r.get('reopens')}, "
f"errors {len(r['errors'])}")
CRCNS ssc-11, version unversioned (doi:10.6080/K0Z31WWG) streamed 16 archives in 808 s an250220.tar.gz md5 485e8eff7dcd90d773c5cb8735452295 9.68 GB read 9.68 GB in 245 s, reconnections 0, errors 0 an257218.tar.gz md5 966d79a04169a6b714c2ce3f6f414156 4.94 GB read 4.94 GB in 131 s, reconnections 0, errors 0 an257220.tar.gz md5 baac8233000d77db40423dfce0366e5f 2.69 GB read 2.69 GB in 73 s, reconnections 0, errors 0 an258836.tar.gz md5 cf76b797f5ad3815e660bb8ae84c8efb 8.38 GB read 8.38 GB in 218 s, reconnections 0, errors 0 an271211.tar.gz md5 d184f2804f815ada357da0b7268cd613 11.81 GB read 11.81 GB in 307 s, reconnections 0, errors 0 an272761.tar.gz md5 46bac15b704c04375a6f338a7746a58a 2.86 GB read 2.86 GB in 95 s, reconnections 0, errors 0 an274424.tar.gz md5 42a603f246ea67a22403feff9c70fd10 3.68 GB read 3.68 GB in 122 s, reconnections 0, errors 0 an274577.tar.gz md5 8b5fb408a172294ad0d6e06d107a32d1 7.06 GB read 7.06 GB in 197 s, reconnections 0, errors 0 an275798.tar.gz md5 c1f15d73c9d30f266d5bea89197c898f 11.04 GB read 11.04 GB in 287 s, reconnections 0, errors 0 an275801.tar.gz md5 783986e5a323a1d7c265669ec23bfba0 11.88 GB read 11.88 GB in 291 s, reconnections 0, errors 0 an276013.tar.gz md5 f38b3825ed1539435046a83dc42a6f22 8.55 GB read 8.55 GB in 217 s, reconnections 0, errors 0 an278288.tar.gz md5 3854befded92d6fb30dce1b7817c9449 8.18 GB read 8.18 GB in 200 s, reconnections 0, errors 0 an278759.tar.gz md5 c8c8ae66d85b2161e3c7597fb4f5a6e0 4.79 GB read 4.79 GB in 119 s, reconnections 0, errors 0 an278937.tar.gz md5 d63a40e4386ba34127c7d6164f1427aa 8.27 GB read 8.27 GB in 189 s, reconnections 0, errors 0 an278939.tar.gz md5 1374085c2466dff3e8f9d2617d299dbe 9.56 GB read 9.56 GB in 281 s, reconnections 0, errors 0 an281915.tar.gz md5 7a90f6b602691490abc56dcd0505136b 7.50 GB read 7.50 GB in 180 s, reconnections 0, errors 0
Data check¶
What each archive holds, against the data descriptor ("session_neuropilone_????_merged"
directories of an*_vol_NN_sess_struct.mat files, and ablation logs) and the paper (16 mice,
24 ablations, 4 to 6 subvolumes of 3 planes, imaging at about 7 Hz).
rows = []
for a in sorted(data):
for dname, files in data[a]["sess"].items():
for fn, r in sorted(files.items()):
rows.append({"mouse": a, "dir": dname.replace("session_neuropilone_", "").replace("_merged", ""), "file": fn[-19:-16],
"format": r["format"], "mouseId": r["mouse"], "whisker": r["whisker"], "cells": len(r["ca_ids"]),
"planes": int(r["plane"].max()) + 1, "frames": r["n_frames"], "frame_ms": round(r["ca_dt_ms"], 1),
"trials": r["n_trials"], "touches": len(r["touch_on"]), "whisker_dt_ms": r["wh_dt_ms"],
"roi_ids_eq_ca_ids": bool(np.array_equal(r["roi_ids"], r["ca_ids"])),
"has_trial_avgs": r["hitL"] is not None and r["hitR"] is not None,
"trial_avg_frames": None if r["hitL"] is None else r["hitL"].shape[0]})
files = pd.DataFrame(rows)
print("Errors while reading:", sum(len(data[a]["errors"]) for a in data))
print("Session files:", len(files), "; by format:", files.format.value_counts().to_dict())
print("mouseId in file matches archive name:", bool((files.mouseId == "an" + files.mouse).all()))
print("ROI ids of roiArray in the order of caTSA.ids, every file:", bool(files.roi_ids_eq_ca_ids.all()))
print("Files without trial-averaged dF/F features:", files[~files.has_trial_avgs][["mouse", "dir", "file"]].values.tolist())
print("Files with both trial-averaged dF/F features:", int(files.has_trial_avgs.sum()), "of", len(files),
"; frames in them:", sorted(files.trial_avg_frames.dropna().unique().tolist()))
print("Planes per subvolume file:", files.planes.value_counts().to_dict())
print("Imaging frame interval (ms):", files.frame_ms.min(), "to", files.frame_ms.max(),
f"({1000 / files.frame_ms.max():.2f} to {1000 / files.frame_ms.min():.2f} Hz)")
print("Whisker video sample interval (ms):", sorted(files.whisker_dt_ms.unique().tolist()))
summ = files.groupby(["mouse", "dir"]).agg(subvolumes=("file", "count"), cells=("cells", "sum"),
trials=("trials", "sum"), whisker=("whisker", "first")).reset_index()
print(summ.to_string(index=False))
print("\nMice:", files.mouse.nunique(), "; whisker tags per mouse:", files.groupby("mouse").whisker.nunique().max(), "(1 = one whisker per mouse)")
Errors while reading: 0
Session files: 201 ; by format: {'v7.3': 107, 'v5': 94}
mouseId in file matches archive name: True
ROI ids of roiArray in the order of caTSA.ids, every file: True
Files without trial-averaged dF/F features: [['278939', 'postablate_silent', '_01'], ['278939', 'postablate_silent', '_02'], ['278939', 'postablate_silent', '_03'], ['278939', 'postablate_silent', '_04'], ['278939', 'postablate_silent', '_05'], ['278939', 'postablate_silent', '_06']]
Files with both trial-averaged dF/F features: 195 of 201 ; frames in them: [70.0, 75.0]
Planes per subvolume file: {3: 187, 2: 14}
Imaging frame interval (ms): 133.2 to 142.9 (7.00 to 7.51 Hz)
Whisker video sample interval (ms): [2.0, 2.5]
mouse dir subvolumes cells trials whisker
250220 postablate 6 8844 837 c3
250220 preablate 6 8844 919 c3
257218 postablate 6 6215 1211 c3
257218 preablate 6 6215 762 c3
257220 postablate 6 3663 951 d3
257220 preablate 6 3663 890 d3
258836 postablate_silent 6 7290 918 c2
258836 postablate_touch 6 7290 761 c2
258836 preablate 6 7290 939 c2
271211 postablate_silent 6 9415 1038 c2
271211 postablate_touch 6 9415 1055 c2
271211 preablate 6 9415 1045 c2
272761 postablate 4 6359 598 c2
272761 preablate 4 6359 458 c2
274424 postablate 4 7785 578 c1
274424 preablate 4 7785 507 c1
274577 postablate 4 12173 588 c3
274577 preablate 4 12173 916 c3
275798 postablate_silent 4 11364 581 c2
275798 postablate_whisking 4 11364 812 c2
275798 preablate 4 11364 1057 c2
275801 postablate_silent 4 8354 793 c3
275801 postablate_touch 4 8354 993 c3
275801 postablate_whisking 4 8354 699 c3
275801 preablate 4 8354 1048 c3
276013 postablate_silent 4 11659 355 c3
276013 postablate_whisking 4 11659 697 c3
276013 preablate 4 11659 637 c3
278288 postablate 4 9314 960 c2
278288 preablate 4 9314 1135 c2
278759 postablate 4 9187 520 c2
278759 preablate 4 9187 719 c2
278937 postablate_silent 5 4230 915 d1
278937 postablate_whisking 5 4230 797 d1
278937 preablate 6 5225 1024 d1
278939 postablate_silent 6 7167 999 c2
278939 postablate_whisking 6 7167 1069 c2
278939 preablate 6 7167 1218 c2
281915 postablate_touch 5 7002 780 c2
281915 postablate_whisking 5 7002 867 c2
281915 preablate 5 7002 614 c2
Mice: 16 ; whisker tags per mouse: 1 (1 = one whisker per mouse)
# every member of every archive, by kind
kinds = []
for a in sorted(data):
for name, size in data[a]["members"]:
rel = name.split("/", 1)[1] if "/" in name else ""
k = ("session struct" if rel.endswith("sess_struct.mat") else "JRC ablation log" if "/ablation_log_" in rel
else "NYU attempt log" if "_attempt_" in rel else "curation file" if (rel.endswith("manualCurationData.mat") or rel.endswith("ablation_ids_manually_curated.mat") or (rel.count("/") == 0 and rel.endswith(".mat")))
else "directory" if size == 0 else "other")
kinds.append({"mouse": a, "kind": k, "size": size, "name": rel})
kinds = pd.DataFrame(kinds)
print(kinds.groupby("kind").agg(n=("size", "size"), GB=("size", lambda s: round(s.sum() / 1e9, 1))).to_string())
print("\nOther files:")
oth = kinds[kinds.kind == "other"].copy()
oth["base"] = oth.name.map(lambda n: n.rsplit("/", 1)[-1])
oth["ext"] = oth.base.map(lambda n: n.rsplit(".", 1)[-1].lower() if "." in n else "(none)")
print(f"{len(oth)} files; by extension:", oth.ext.value_counts().to_dict())
for a, g in oth.groupby("mouse"):
print(f"an{a}: {len(g)} files, {round(g['size'].sum() / 1e6, 1)} MB:", sorted(set(g.base)))
hist = oth[oth.base.str.contains("iba|gfap|histo|slice|section|\\.tif|\\.czi|\\.lsm|\\.nd2|\\.jpg|\\.png", case=False, regex=True)]
print("Files whose name suggests histology or images (iba, gfap, histo, slice, section, tif, czi, lsm, nd2, jpg, png):", len(hist), sorted(set(hist.base))[:20])
print("\nCuration files read:", {a: sorted(data[a]["small"]) for a in sorted(data)})
n GB
kind
JRC ablation log 476 77.1
NYU attempt log 510 0.9
curation file 38 0.0
directory 91 0.0
other 44 2.9
session struct 201 85.8
Other files:
44 files; by extension: {'mat': 44}
an250220: 2 files, 146.8 MB: ['ablation_master_log_v2.mat']
an257218: 1 files, 58.0 MB: ['ablation_master_log_v2.mat']
an257220: 1 files, 26.8 MB: ['ablation_master_log_v2.mat']
an258836: 3 files, 104.6 MB: ['ablation_master_log_v2.mat']
an271211: 2 files, 147.2 MB: ['ablation_master_log_v2.mat']
an272761: 2 files, 77.5 MB: ['2019-03-24_1445-an272761_session_log.mat', 'an272761_roiArrayBrowser.mat']
an274424: 1 files, 91.1 MB: ['2019-04-07_1040-an274424_session_log.mat']
an274577: 2 files, 177.4 MB: ['2019-04-04_1617-an274577_session_log.mat', 'an274577_roiArrayBrowser_ablation_targets.mat']
an275798: 5 files, 460.0 MB: ['2019-05-07_1205-an275798_session_log.mat', '2019-05-07_1212-an275798_session_log.mat', '2019-05-17_1353-an275798_session_log.mat', 'an275798_roiArrayBrowser_2019_05_17.mat', 'an275798_roiArrayBrowser_ablation_silent_targets.mat']
an275801: 4 files, 327.5 MB: ['2019-05-21_1805-an275801_session_log.mat', '2019-05-21_1947-an275801_session_log.mat', '2019-05-31_2231-an275801_session_log.mat', '2019-05-31_2343-an275801_session_log.mat']
an276013: 6 files, 532.3 MB: ['2019-06-11_1210-an276013_session_log.mat', '2019-06-17_1815-an276013_session_log.mat', '2019-06-17_1917-an276013_session_log.mat', 'an276013_ablation_whisking_target_list.mat', 'an276013_roiArrayBrowser.mat', 'an276013_silent_ablation_target_list.mat']
an278288: 2 files, 186.6 MB: ['2019-07-08_1915-an278288_session_log.mat', '2019-07-08_2042-an278288_session_log.mat']
an278759: 1 files, 92.8 MB: ['2019-07-17_1451-an278759_session_log.mat']
an278937: 4 files, 192.9 MB: ['ablation_master_log.mat', 'ablation_master_log_v2.mat']
an278939: 4 files, 172.8 MB: ['ablation_master_log.mat', 'ablation_master_log_v2.mat']
an281915: 4 files, 127.7 MB: ['ablation_master_log.mat', 'ablation_master_log_v2.mat']
Files whose name suggests histology or images (iba, gfap, histo, slice, section, tif, czi, lsm, nd2, jpg, png): 0 []
Curation files read: {'250220': ['ablation_logs/2014_07_13/ablation_ids_manually_curated.mat', 'ablation_logs/2014_07_15/ablation_ids_manually_curated.mat', 'an250220_all.mat'], '257218': ['ablation_logs/2014_09_01/ablation_ids_manually_curated.mat', 'an257218_2014_09_01.mat'], '257220': ['ablation_logs/2014_09_17/ablation_ids_manually_curated.mat', 'an257220_2014_09_17.mat'], '258836': ['ablation_logs/2014_10_11/ablation_ids_manually_curated.mat', 'an258836_2014_10_11.mat', 'an258836_2014_10_14.mat', 'an258836_2014_10_16.mat'], '271211': ['ablation_logs/2014_11_12/ablation_ids_manually_curated.mat', 'ablation_logs/2014_11_16/ablation_ids_manually_curated.mat', 'an271211_2014_11_12.mat', 'an271211_2014_11_16.mat'], '272761': ['2019_03_24_ablation/manualCurationData.mat'], '274424': ['2019_04_07_ablation/manualCurationData.mat'], '274577': ['2019_04_04_ablation/manualCurationData.mat'], '275798': ['2019_05_07_ablation/manualCurationData.mat', '2019_05_17_ablation/manualCurationData.mat'], '275801': ['2019_05_21_ablation/manualCurationData.mat', '2019_05_31_ablation/manualCurationData.mat'], '276013': ['2019_06_11_ablation_silent/manualCurationData.mat', '2019_06_17_ablation_whisking/manualCurationData.mat'], '278288': ['2019_07_08_ablation_whisking/manualCurationData.mat'], '278759': ['2019_07_17_whisking_ablation/manualCurationData.mat'], '278937': ['ablation_logs/2015_01_30/ablation_ids_manually_curated.mat', 'ablation_logs/2015_02_04/ablation_ids_manually_curated.mat', 'an278937_2015_01_30.mat', 'an278937_2015_02_04.mat'], '278939': ['ablation_logs/2015_01_30/ablation_ids_manually_curated.mat', 'ablation_logs/2015_02_04/ablation_ids_manually_curated.mat', 'an278939_2015_01_30.mat', 'an278939_2015_02_04.mat'], '281915': ['ablation_logs/2015_02_23/ablation_ids_manually_curated.mat', 'ablation_logs/2015_03_02/ablation_ids_manually_curated.mat', 'an281915_2015_02_23.mat', 'an281915_2015_03_02.mat']}
Duplicates. The analysis code reuses one directory as the post-ablation data of one ablation and the pre-ablation data of the next (get_data_path.m); that is by design. The check below looks for the same recording deposited twice: two session files, in any archive, with the same number of cells, frames and trials and identical touch scores.
fp = {}
for a in sorted(data):
for dname, fl in data[a]["sess"].items():
for fn, r in fl.items():
t = r["per"]["t"]
key = (len(r["ca_ids"]), r["n_frames"], r["n_trials"], np.round(np.nan_to_num(t[:50]), 6).tobytes())
fp.setdefault(key, []).append(f"an{a}/{dname}/{fn}")
dups = [v for v in fp.values() if len(v) > 1]
print("Session files:", sum(len(v) for v in fp.values()), "; distinct recordings:", len(fp), "; duplicated groups:", len(dups))
for v in dups:
print(" ", v)
Session files: 201 ; distinct recordings: 201 ; duplicated groups: 0
Clocks. The encoding scores were computed by the authors; this attempt does not recompute them from dF/F. It checks that the touch times and the imaging frames share a clock: for each session file, the mean dF/F of that file's neurons with touch score above 0.1 is aligned to the first touch of each trial, and to the same times shifted 2 s earlier. A response that rises after the true touch times and not after the shifted ones shows the alignment.
rowc = []
for a in sorted(data):
for dname, fl in data[a]["sess"].items():
for fn, r in fl.items():
lags = r["trig_lags"]
base = lambda v: np.nanmean(v[(lags >= -5) & (lags <= -1)])
resp = lambda v: np.nanmean(v[(lags >= 1) & (lags <= 6)])
rowc.append({"mouse": a, "dir": dname, "file": fn, "n_onsets": r["trig_n"],
"true": resp(r["trig_real"]) - base(r["trig_real"]),
"shifted": resp(r["trig_shift"]) - base(r["trig_shift"])})
clk = pd.DataFrame(rowc)
print(f"Session files: {len(clk)}; response after true touch onsets (mean dF/F, frames 1 to 6 minus -5 to -1): "
f"median {clk.true.median():.3f}, positive in {(clk.true > 0).sum()}")
print(f"Same for onsets shifted 2 s earlier: median {clk.shifted.median():.3f}, positive in {(clk.shifted > 0).sum()}")
print("Wilcoxon signed-rank, true against shifted, over files: p =", f"{stats.wilcoxon(clk.true, clk.shifted).pvalue:.2g}")
per_mouse = clk.groupby("mouse")[["true", "shifted"]].median().round(3)
print(per_mouse.T.to_string())
print("Files where the true response is not larger than the shifted one:")
print(clk[clk.true <= clk.shifted].to_string(index=False))
r0 = data["272761"]["sess"]["session_neuropilone_preablate_merged"]
r0 = r0[sorted(r0)[0]]
fig, ax = plt.subplots(figsize=(4, 3))
ax.plot(r0["trig_lags"], r0["trig_real"], label="first touch")
ax.plot(r0["trig_lags"], r0["trig_shift"], label="2 s earlier")
ax.set_xlabel("frames from onset"); ax.set_ylabel("mean dF/F, touch-scored cells"); ax.legend(); ax.set_title("an272761 vol 1 pre")
print("Plotted range:", np.round([np.nanmin([r0['trig_real'], r0['trig_shift']]), np.nanmax([r0['trig_real'], r0['trig_shift']])], 3))
Session files: 201; response after true touch onsets (mean dF/F, frames 1 to 6 minus -5 to -1): median 0.127, positive in 201 Same for onsets shifted 2 s earlier: median -0.001, positive in 86 Wilcoxon signed-rank, true against shifted, over files: p = 9.8e-35 mouse 250220 257218 257220 258836 271211 272761 274424 274577 275798 275801 276013 278288 278759 278937 278939 281915 true 0.099 0.156 0.137 0.084 0.134 0.177 0.083 0.107 0.132 0.285 0.098 0.100 0.162 0.084 0.097 0.137 shifted -0.005 -0.009 -0.009 -0.003 -0.004 0.003 0.000 0.001 0.002 0.004 0.005 0.001 0.002 0.003 -0.002 -0.001 Files where the true response is not larger than the shifted one: Empty DataFrame Columns: [mouse, dir, file, n_onsets, true, shifted] Index: [] Plotted range: [0.019 0.381]
Per-neuron tables¶
For each of the 24 ablations, the table of get_ablation_data.m: pre-ablation and
post-ablation touch and whisking scores, shuffle rejections, event rates, positions, the
ablated neurons of the curation files, and the two proximity exclusions (the Methods cylinder,
the main reading; the code's signed depth rule, a variant). Neurons are matched across periods
by ROI id, as the code does; that a ROI id names the same neuron in the pre and post files is
an assumption the data set does not let us check beyond the ids themselves (the session files
are merged across days by the authors).
T, INFO = {}, {}
for (a, abl) in P.ABLATIONS:
T[(a, abl)], INFO[(a, abl)] = P.ablation_table(data[a], a, abl)
info = pd.DataFrame([{"mouse": a, "ablation": abl, **v} for (a, abl), v in INFO.items()])
print(info.to_string(index=False))
d0 = pd.concat([T[k] for k in T])
for c in ["t_pre", "t_post", "w_pre", "w_post", "t_pre_sh", "w_pre_sh", "er_pre", "er_post", "x", "y", "z"]:
v = d0[c]
print(f"{c:9s} range {np.nanmin(v):8.3f} to {np.nanmax(v):8.3f} median {np.nanmedian(v):7.3f} NaN {int(v.isna().sum())}")
print("Units: scores are correlations (unitless), event rates Hz, positions um (600 um / 512 pixels; planes 15 um apart; subvolumes 45 um apart, as the code).")
print("Every ablated id found among the neurons:", bool((info.n_ablated_ids == info.n_ablated_found).all()))
print("Neurons dropped as not in both periods:", info.n_dropped_unmatched.sum(), "(all in", info[info.n_dropped_unmatched > 0][["mouse", "ablation"]].values.tolist(), ")")
mouse ablation n_pre_raw n_post_raw n_dropped_unmatched n_ablated_ids n_ablated_found 274424 touch 7785 7785 0 17 17 272761 touch 6359 6359 0 14 14 274577 touch 12173 12173 0 11 11 275798 silent 11364 11364 0 13 13 275798 whisking 11364 11364 0 11 11 275801 silent 8354 8354 0 14 14 275801 touch 8354 8354 0 9 9 276013 silent 11659 11659 0 16 16 276013 whisking 11659 11659 0 9 9 278288 whisking 9314 9314 0 25 25 278759 whisking 9187 9187 0 11 11 250220 touch 8844 8844 0 50 50 257218 silent 6215 6215 0 20 20 257220 touch 3663 3663 0 9 9 258836 silent 7290 7290 0 16 16 258836 touch 7290 7290 0 15 15 271211 silent 9415 9415 0 16 16 271211 touch 9415 9415 0 15 15 278937 silent 5225 4230 995 15 15 278937 whisking 4230 4230 0 12 12 278939 silent 7167 7167 0 20 20 278939 whisking 7167 7167 0 13 13 281915 whisking 7002 7002 0 8 8 281915 touch 7002 7002 0 11 11 t_pre range -0.668 to 0.779 median -0.020 NaN 5648 t_post range -0.438 to 0.781 median -0.020 NaN 4053 w_pre range -0.340 to 0.705 median -0.004 NaN 5684 w_post range -0.421 to 0.712 median -0.006 NaN 4059 t_pre_sh range -0.323 to 0.448 median -0.033 NaN 5122 w_pre_sh range -0.298 to 0.378 median -0.029 NaN 5086 er_pre range 0.000 to 0.659 median 0.013 NaN 1 er_post range 0.000 to 0.692 median 0.012 NaN 7 x range 1.172 to 599.297 median 291.775 NaN 41 y range 0.000 to 597.483 median 298.136 NaN 41 z range 0.000 to 255.000 median 105.000 NaN 0 Units: scores are correlations (unitless), event rates Hz, positions um (600 um / 512 pixels; planes 15 um apart; subvolumes 45 um apart, as the code). Every ablated id found among the neurons: True Neurons dropped as not in both periods: 995 (all in [['278937', 'silent']] )
# neurons with a NaN event rate fall in no event-rate decile, so the shuffle test never rejects them
rowsn = []
for (a, abl), d in T.items():
for per in ["pre", "post"]:
nn = d[f"er_{per}"].isna()
rowsn.append({"mouse": a, "ablation": abl, "period": per, "nan_rate": int(nn.sum()),
"of_which_t_above_0.1": int((nn & (d[f"t_{per}"] > 0.1)).sum()), "of_which_w_above_0.1": int((nn & (d[f"w_{per}"] > 0.1)).sum())})
rowsn = pd.DataFrame(rowsn)
print(rowsn[rowsn.nan_rate > 0].to_string(index=False))
print("Neurons with a NaN event rate, over all tables and periods:", int(rowsn.nan_rate.sum()),
"; with a touch or whisking score above 0.1:", int(rowsn["of_which_t_above_0.1"].sum() + rowsn["of_which_w_above_0.1"].sum()))
memb_nan = sum(int((P.members(d, r) & (d.er_pre.isna() | d.er_post.isna())).sum()) for d in T.values() for r in ["t", "w"])
print("Members (either representation, any ablation) with a NaN event rate in either period:", memb_nan)
mouse ablation period nan_rate of_which_t_above_0.1 of_which_w_above_0.1 274424 touch post 1 0 0 272761 touch post 4 0 0 274577 touch post 1 0 0 278288 whisking pre 1 0 0 278759 whisking post 1 0 0 Neurons with a NaN event rate, over all tables and periods: 8 ; with a touch or whisking score above 0.1: 0 Members (either representation, any ablation) with a NaN event rate in either period: 0
neurons-per-mouse¶
Volumetric imaging in L2/3 of the spared whisker's barrel column recorded 8,126 ± 2,436 (mean ± s.d.) neurons per mouse across 16 mice.
The first ablation of each mouse, as ablation_summ_stats.m (first_anims). The count is the
size of the per-neuron table, which keeps only neurons present in both periods; the raw count of
the pre-ablation files is shown too.
FIRST = {"touch": ["250220", "257220", "274424", "272761", "274577"],
"silent": ["257218", "258836", "271211", "278937", "278939", "275801", "275798", "276013"],
"whisking": ["281915", "278288", "278759"]}
# Extended Data Table 1, transcribed from the PDF of the paper (reference values, not results)
EDT1 = pd.DataFrame([
("250220", "touch", 8844, 50, 867, -0.122, 422, -0.076), ("257218", "silent", 6215, 20, 743, 0.018, 366, 0.032),
("257220", "touch", 3663, 9, 389, -0.004, 455, 0.025), ("258836", "silent", 7290, 16, 481, 0.066, 666, -0.012),
("258836", "touch", None, 15, 488, -0.055, 655, 0.001), ("271211", "silent", 9415, 16, 2476, -0.012, 551, -0.007),
("271211", "touch", None, 15, 1951, -0.061, 692, 0.021), ("278937", "silent", 4230, 15, 146, 0.004, 379, 0.001),
("278937", "whisking", None, 12, 150, -0.006, 392, 0.011), ("278939", "silent", 7167, 20, 636, -0.024, 698, 0.001),
("278939", "whisking", None, 13, 523, -0.017, 649, -0.015), ("281915", "whisking", 7002, 8, 723, -0.010, 550, 0.004),
("281915", "touch", None, 11, 601, -0.022, 672, 0.008), ("274424", "touch", 7785, 17, 706, -0.029, 718, -0.014),
("272761", "touch", 6359, 14, 509, -0.001, 410, 0.000), ("274577", "touch", 12173, 11, 1380, -0.013, 657, 0.004),
("275801", "silent", 8354, 14, 220, 0.000, 738, -0.007), ("275801", "touch", None, 9, 197, -0.065, 698, -0.006),
("275798", "silent", 11364, 13, 959, 0.002, 958, 0.002), ("275798", "whisking", None, 11, 972, 0.008, 1037, 0.011),
("278288", "whisking", 9314, 25, 969, -0.008, 813, -0.006), ("276013", "silent", 11659, 16, 652, 0.028, 1072, -0.001),
("276013", "whisking", None, 9, 634, -0.012, 968, -0.008), ("278759", "whisking", 9187, 11, 617, -0.003, 526, -0.004)],
columns=["mouse", "ablation", "cells", "ablated", "touch", "dRtouch", "whisking", "dRwhisking"])
first = []
for abl, mice in FIRST.items():
for a in mice:
d = T[(a, abl)]
first.append({"mouse": a, "first_ablation": abl, "cells_table": len(d), "cells_raw_pre": INFO[(a, abl)]["n_pre_raw"],
"EDT1_cells": int(EDT1[(EDT1.mouse == a) & (EDT1.ablation == abl)].cells.iloc[0]),
"touch_a": P.class_counts(d, "t", "a")[0], "whisking_a": P.class_counts(d, "w", "a")[0],
"touch_b": P.class_counts(d, "t", "b")[0], "whisking_b": P.class_counts(d, "w", "b")[0]})
first = pd.DataFrame(first)
print(first.to_string(index=False))
print(f"\nNeurons per mouse (table size): mean {first.cells_table.mean():.1f}, s.d. {first.cells_table.std():.1f} (paper 8,126 +/- 2,436; n = {len(first)})")
print(f"Raw pre-ablation count (variant): mean {first.cells_raw_pre.mean():.1f}, s.d. {first.cells_raw_pre.std():.1f}")
print("Per-mouse counts equal to Extended Data Table 1:", int((first.cells_table == first.EDT1_cells).sum()), "of", len(first))
mouse first_ablation cells_table cells_raw_pre EDT1_cells touch_a whisking_a touch_b whisking_b 250220 touch 8844 8844 8844 1244 1064 749 388 257220 touch 3663 3663 3663 613 591 316 259 274424 touch 7785 7785 7785 779 768 527 533 272761 touch 6359 6359 6359 486 426 331 289 274577 touch 12173 12173 12173 1445 841 1009 415 257218 silent 6215 6215 6215 780 603 507 224 258836 silent 7290 7290 7290 333 772 243 429 271211 silent 9415 9415 9415 2338 1516 1986 432 278937 silent 4230 5225 4230 152 348 90 269 278939 silent 7167 7167 7167 633 649 462 482 275801 silent 8354 8354 8354 432 833 162 561 275798 silent 11364 11364 11364 1440 1456 663 679 276013 silent 11659 11659 11659 1002 1507 442 945 281915 whisking 7002 7002 7002 671 579 517 352 278288 whisking 9314 9314 9314 1149 987 819 611 278759 whisking 9187 9187 9187 913 893 427 392 Neurons per mouse (table size): mean 8126.3, s.d. 2435.6 (paper 8,126 +/- 2,436; n = 16) Raw pre-ablation count (variant): mean 8188.5, s.d. 2340.3 Per-mouse counts equal to Extended Data Table 1: 16 of 16
Result: reproduced. The 16 per-neuron tables hold 8,126.3 ± 2,435.6 neurons per mouse, and every per-mouse count equals the Cell count column of Extended Data Table 1. In an278937 the pre-ablation files hold 995 more neurons (a sixth subvolume) than the post-ablation files, and the table, like the paper, counts only the neurons in both.
representation-sizes¶
Across 16 mice, 901 ± 539 of the imaged neurons encoded touch (fraction 0.108 ± 0.051) and 865 ± 364 encoded whisking (fraction 0.106 ± 0.028).
Readings of the criterion: (a) score above 0.1 alone in the first pre-ablation data (ablation_summ_stats.m); (b) the Methods membership rule in that period.
for lab, tc, wc in [("(a) score > 0.1", "touch_a", "whisking_a"), ("(b) Methods membership", "touch_b", "whisking_b")]:
ft, fw = first[tc] / first.cells_table, first[wc] / first.cells_table
print(f"{lab:24s} touch {first[tc].mean():6.1f} +/- {first[tc].std():5.1f} (fraction {ft.mean():.3f} +/- {ft.std():.3f}); "
f"whisking {first[wc].mean():6.1f} +/- {first[wc].std():5.1f} (fraction {fw.mean():.3f} +/- {fw.std():.3f})")
print("Paper: touch 901 +/- 539 (0.108 +/- 0.051), whisking 865 +/- 364 (0.106 +/- 0.028)")
(a) score > 0.1 touch 900.6 +/- 538.8 (fraction 0.108 +/- 0.051); whisking 864.6 +/- 364.4 (fraction 0.106 +/- 0.028) (b) Methods membership touch 578.1 +/- 445.9 (fraction 0.069 +/- 0.044); whisking 453.8 +/- 184.1 (fraction 0.056 +/- 0.014) Paper: touch 901 +/- 539 (0.108 +/- 0.051), whisking 865 +/- 364 (0.106 +/- 0.028)
Result: reproduced. Under reading (a) the mean counts are 900.6 touch and 864.6 whisking neurons, fractions 0.108 and 0.106, all four within tolerance (and the spreads, 538.8 and 364.4, as printed in the paper). Reading (b) gives 578.1 and 453.8, outside tolerance, so the paper's text counts by score alone.
touch-ablation-size, whisking-ablation-size, silent-ablation-size¶
Touch ablations removed 16.8 ± 12.8 strong touch neurons per mouse (about 6% of the touch neurons of the barrel column, 9 mice), whose touch scores were at the 70th ± 35th percentile. Whisking ablations removed 12.7 ± 5.7 strong whisking neurons per mouse (about 4%, 7 mice), at the 66th ± 37th percentile of whisking score. Silent-neuron ablations (event rate below 0.025 Hz) removed 16.3 ± 2.6 neurons per mouse in 8 mice.
Two percentile rules, pooled over ablated neurons. The criterion's rule is a rank: the fraction of included neurons whose score is at or below the ablated neuron's (1 when none exceeds it; ablated neurons with no score are left out). The code's rule (ablation_summ_stats.m) is the position of the first included neuron whose score exceeds the ablated neuron's, over the number of included neurons; when none exceeds it, or the ablated neuron has no score, the position is the first, so the value is 1/N (the synthetic check below gives 0.01 for a score above all 100).
def pct(d, rank_r, own_r):
"""The code's rule (ablation_summ_stats.m): position of the first included neuron whose
score exceeds the ablated neuron's, over the number included. When none exceeds it, or
the ablated neuron's score is NaN, the position is the first one, so the value is 1/N."""
ss = np.sort(d[f"{rank_r}_pre"][P.members(d, rank_r)].values)
q = []
for v in d[d.is_ablated == 1][f"{own_r}_pre"].values:
ii = np.where(ss > v)[0]
q.append((ii[0] + 1 if len(ii) else 1) / len(ss))
return q
def pct_rank(d, rank_r, own_r):
"""The criterion's rule: rank of the ablated neuron's score among the included neurons'
scores, as the fraction of them at or below it (1 when none exceeds it); NaN scores have
no rank and are left out."""
ss = np.sort(d[f"{rank_r}_pre"][P.members(d, rank_r)].values)
v = d[d.is_ablated == 1][f"{own_r}_pre"].values
v = v[~np.isnan(v)]
return list(np.searchsorted(ss, v, side="right") / len(ss))
def above_all(d, rank_r, own_r):
ss = d[f"{rank_r}_pre"][P.members(d, rank_r)].values
v = d[d.is_ablated == 1][f"{own_r}_pre"].values
return int((v > np.nanmax(ss)).sum()), int(np.isnan(v).sum()), len(v)
size = {}
for abl in ["touch", "whisking", "silent"]:
n = np.array([T[(a, abl)].is_ablated.sum() for a in P.ANIMS[abl]])
size[abl] = n
print(f"{abl:8s} ablated per mouse {n.tolist()}: mean {n.mean():.2f}, s.d. {n.std(ddof=1):.2f}, mean/287 = {100 * n.mean() / 287:.2f}%")
# a synthetic check of the two rules: 100 included scores 1..100, ablated scores 50.5 and 101
_d = pd.DataFrame({"t_pre": np.r_[np.arange(1, 101), 50.5, 101.0], "is_ablated": np.r_[np.zeros(100), 1, 1]})
_m = P.members
P.members = lambda d, r, thresh=0.1: d.is_ablated == 0
print("synthetic: code rule", pct(_d, "t", "t"), "rank rule", pct_rank(_d, "t", "t"))
P.members = _m
for lab, abl, rr, ro in [("touch", "touch", "t", "t"), ("whisking, Methods (Rwhisking among whisking neurons)", "whisking", "w", "w"),
("whisking, code (Rwhisking among touch neurons' Rtouch)", "whisking", "t", "w")]:
q_r = sum([pct_rank(T[(a, abl)], rr, ro) for a in P.ANIMS[abl]], [])
q_c = sum([pct(T[(a, abl)], rr, ro) for a in P.ANIMS[abl]], [])
aa = np.array([above_all(T[(a, abl)], rr, ro) for a in P.ANIMS[abl]]).sum(0)
print(f"{lab} percentile: rank rule (criterion) mean {100 * np.mean(q_r):.1f}, s.d. {100 * np.std(q_r, ddof=1):.1f} (n = {len(q_r)}); "
f"code rule mean {100 * np.mean(q_c):.1f}, s.d. {100 * np.std(q_c, ddof=1):.1f} (n = {len(q_c)}); "
f"ablated neurons scoring above every included neuron {aa[0]}, with a NaN score {aa[1]}, of {aa[2]}")
for abl, mice in P.ANIMS.items():
print(abl, "per mouse percentile (rank rule):", {a: round(100 * np.mean(pct_rank(T[(a, abl)], 't' if abl == 'touch' else 'w', 't' if abl == 'touch' else 'w')), 1) for a in mice} if abl != "silent" else "")
er = np.concatenate([T[(a, "silent")].er_pre[T[(a, "silent")].is_ablated == 1].values for a in P.ANIMS["silent"]])
print(f"silent: pre-ablation event rate of the {len(er)} ablated neurons: median {np.median(er):.4f} Hz, max {er.max():.4f} Hz; "
f"{(er < 0.025).sum()} below 0.025 Hz")
print("Ablated counts per ablation equal to Extended Data Table 1:",
int(sum(T[(r.mouse, r.ablation)].is_ablated.sum() == r.ablated for r in EDT1.itertuples())), "of 24")
touch ablated per mouse [50, 9, 15, 15, 11, 17, 14, 11, 9]: mean 16.78, s.d. 12.77, mean/287 = 5.85% whisking ablated per mouse [12, 13, 8, 11, 25, 9, 11]: mean 12.71, s.d. 5.68, mean/287 = 4.43% silent ablated per mouse [20, 16, 16, 15, 20, 14, 13, 16]: mean 16.25, s.d. 2.55, mean/287 = 5.66% synthetic: code rule [np.float64(0.51), 0.01] rank rule [np.float64(0.5), np.float64(1.0)]
touch percentile: rank rule (criterion) mean 79.3, s.d. 27.1 (n = 145); code rule mean 70.3, s.d. 35.0 (n = 151); ablated neurons scoring above every included neuron 9, with a NaN score 6, of 151
whisking, Methods (Rwhisking among whisking neurons) percentile: rank rule (criterion) mean 75.4, s.d. 31.8 (n = 89); code rule mean 68.8, s.d. 36.2 (n = 89); ablated neurons scoring above every included neuron 6, with a NaN score 0, of 89
whisking, code (Rwhisking among touch neurons' Rtouch) percentile: rank rule (criterion) mean 75.8, s.d. 30.2 (n = 89); code rule mean 65.9, s.d. 36.5 (n = 89); ablated neurons scoring above every included neuron 9, with a NaN score 0, of 89
touch per mouse percentile (rank rule): {'250220': np.float64(71.5), '257220': np.float64(92.8), '258836': np.float64(72.8), '271211': np.float64(89.0), '281915': np.float64(79.6), '274424': np.float64(75.3), '272761': np.float64(84.3), '274577': np.float64(88.5), '275801': np.float64(86.2)}
whisking per mouse percentile (rank rule): {'278937': np.float64(58.2), '278939': np.float64(72.9), '281915': np.float64(94.6), '275798': np.float64(97.1), '278288': np.float64(77.8), '276013': np.float64(56.3), '278759': np.float64(71.5)}
silent per mouse percentile (rank rule):
silent: pre-ablation event rate of the 130 ablated neurons: median 0.0122 Hz, max 0.0791 Hz; 118 below 0.025 Hz
Ablated counts per ablation equal to Extended Data Table 1: 24 of 24
Result: touch-ablation-size partially reproduced. 16.78 ± 12.77 neurons per mouse and 5.85% of 287 are within tolerance. The percentile under the criterion's rule (the rank of each ablated neuron's score among the included touch neurons) is 79.3 ± 27.1 over the 145 ablated neurons with a score, outside 70 ± 7 and 35 ± 3.5. The code's rule gives 70.3 ± 35.0, the paper's values: it puts the 9 ablated neurons that score above every included neuron, and the 6 with no score, at 1/N in place of the top (the synthetic check gives 0.01 for a score above all 100). The paper's percentile is therefore that rule's, and the gap is asked of a reader.
Result: whisking-ablation-size partially reproduced. 12.71 ± 5.68 neurons are within tolerance; 4.43% of 287 is outside 4 ± 0.4. Under the criterion's rank rule the percentile is 75.4 ± 31.8 (Rwhisking among whisking neurons) or 75.8 ± 30.2 (among the touch neurons' Rtouch), both outside 66 ± 6.6; the code's rule gives 68.8 ± 36.2 and 65.9 ± 36.5, within tolerance.
Result: silent-ablation-size reproduced. 16.25 ± 2.55 neurons per mouse. Of the 130 ablated neurons, 118 have a pre-ablation event rate below 0.025 Hz in these data (the highest is 0.079 Hz). The paper gives the 0.025 Hz rule for choosing targets; 12 of the 130 ablated neurons are above it in these pre-ablation data.
Score changes by ablation type¶
The common method of the claims file: per mouse, the median pre and post score of the members of a representation; grand median across mice; Wilcoxon signed-rank test on paired mouse medians. Counts of members per period follow touch-ablation-touch-count. The Methods cylinder is the main reading and the code's rule a variant.
def type_summary(abl, r, cyl="methods"):
rows = []
for a in P.ANIMS[abl]:
d = P.with_cyl(T[(a, abl)], cyl)
pre, post, n = P.mouse_medians(d, r)
ca = P.class_counts(d, r, "a")
cad = P.class_counts(d, r, "a", keep_ablated=False)
cb = P.class_counts(d, r, "b")
rows.append({"mouse": a, "pre": pre, "post": post, "change": post - pre, "n": n, "n_a_pre": ca[0], "n_a_post": ca[1],
"n_adrop_pre": cad[0], "n_adrop_post": cad[1], "n_b_pre": cb[0], "n_b_post": cb[1],
"score_ablated": float(np.nansum(d.t_pre[d.is_ablated == 1]))})
return pd.DataFrame(rows)
def show(abl, r):
out = {}
for cyl in ["methods", "code"]:
s = type_summary(abl, r, cyl)
p = stats.wilcoxon(s.pre, s.post).pvalue
out[cyl] = (s, p)
print(f"[{cyl} cylinder] {abl} ablation, {'Rtouch' if r == 't' else 'Rwhisking'}: grand median {s.pre.median():.3f} -> {s.post.median():.3f} "
f"(adjusted MAD {P.adj_mad(s.pre):.3f}, {P.adj_mad(s.post):.3f}); neurons {s.n.sum()}; signed-rank p = {p:.3f}; "
f"median change {s.change.median():+.4f}, mice with a decline {(s.change < 0).sum()} of {len(s)}")
s = out["methods"][0]
print(s.round(4).to_string(index=False))
print(f"Counts, mean over mice: (a) score > 0.1, ablated kept {s.n_a_pre.mean():.1f} -> {s.n_a_post.mean():.1f}; "
f"(a) ablated left out {s.n_adrop_pre.mean():.1f} -> {s.n_adrop_post.mean():.1f}; (b) Methods rule {s.n_b_pre.mean():.1f} -> {s.n_b_post.mean():.1f}")
print(f"Sum over mice of the (a) pre-ablation count: {s.n_a_pre.sum()}")
return out
R = {}
touch-ablation-reduces-touch, touch-ablation-touch-count¶
Ablating touch neurons reduced the touch-encoding score of the spared touch neurons, from 0.123 to 0.100 (grand median across 9 mice, 8,392 neurons). After touch ablation the number of touch neurons fell, from 932 ± 634 to 716 ± 469 (mean ± s.d. over 9 mice), ablated neurons excluded.
R[("touch", "t")] = show("touch", "t")
[methods cylinder] touch ablation, Rtouch: grand median 0.123 -> 0.100 (adjusted MAD 0.011, 0.016); neurons 7121; signed-rank p = 0.004; median change -0.0287, mice with a decline 9 of 9 [code cylinder] touch ablation, Rtouch: grand median 0.123 -> 0.100 (adjusted MAD 0.011, 0.016); neurons 7089; signed-rank p = 0.004; median change -0.0285, mice with a decline 9 of 9 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 250220 0.1501 0.0283 -0.1218 881 1244 824 1208 818 749 450 12.1935 257220 0.1158 0.1107 -0.0051 390 613 532 604 527 316 266 3.6882 258836 0.1232 0.0680 -0.0552 488 485 377 473 376 342 248 3.5612 271211 0.1606 0.0997 -0.0610 1957 2322 1755 2307 1745 1704 1115 6.2440 281915 0.1368 0.1139 -0.0229 604 649 481 640 478 448 371 3.3776 274424 0.1202 0.0914 -0.0287 708 779 606 764 605 527 425 4.1114 272761 0.1071 0.1062 -0.0009 511 486 449 474 447 331 317 3.7941 274577 0.1236 0.1103 -0.0133 1382 1445 1145 1434 1144 1009 958 3.2823 275801 0.1177 0.0470 -0.0707 200 369 273 361 273 187 103 2.6351 Counts, mean over mice: (a) score > 0.1, ablated kept 932.4 -> 715.8; (a) ablated left out 918.3 -> 712.6; (b) Methods rule 623.7 -> 472.6 Sum over mice of the (a) pre-ablation count: 8392
Result: touch-ablation-reduces-touch reproduced. Grand median Rtouch 0.123 -> 0.100, signed-rank p = 0.004 (all 9 mice decline), within tolerance under both cylinders. The criterion's members number 7,121 neurons (7,089 with the code's cylinder), against the paper's 8,392; 8,392 is the sum over the 9 mice of the pre-ablation count of neurons with score above 0.1 (reading (a) of the counts), which is 8,392 here, so the paper's neuron count is that sum, not the number of neurons entering the medians.
Result: touch-ablation-touch-count reproduced. Under reading (a) the mean count goes from 932.4 to 715.8 with ablated neurons kept (the code), and 918.3 to 712.6 with them left out (the text); both within tolerance. Reading (b) gives 623.7 -> 472.6.
touch-ablation-whisking-unchanged¶
Touch ablation did not change the whisking-encoding score of whisking neurons (0.116 to 0.115, 6,975 neurons, P = 0.820); the whisking neuron count went from 775 ± 267 to 721 ± 241.
R[("touch", "w")] = show("touch", "w")
[methods cylinder] touch ablation, Rwhisking: grand median 0.116 -> 0.115 (adjusted MAD 0.004, 0.020); neurons 5389; signed-rank p = 0.820; median change +0.0008, mice with a decline 4 of 9
[code cylinder] touch ablation, Rwhisking: grand median 0.116 -> 0.115 (adjusted MAD 0.003, 0.020); neurons 5380; signed-rank p = 0.820; median change +0.0008, mice with a decline 4 of 9 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 250220 0.1414 0.0653 -0.0762 426 1064 846 1038 839 388 207 12.1935 257220 0.1046 0.1293 0.0247 455 591 733 584 729 259 393 3.6882 258836 0.1360 0.1368 0.0008 655 720 683 715 682 476 386 3.5612 271211 0.1146 0.1359 0.0213 692 1304 1286 1292 1283 445 630 6.2440 281915 0.1181 0.1252 0.0070 676 590 663 584 662 427 500 3.3776 274424 0.1155 0.1017 -0.0138 719 768 612 761 612 533 432 4.1114 272761 0.1156 0.1152 -0.0005 410 426 408 422 407 289 272 3.7941 274577 0.1054 0.1098 0.0044 657 841 643 830 643 415 463 3.2823 275801 0.1143 0.1078 -0.0065 699 671 617 665 615 493 442 2.6351 Counts, mean over mice: (a) score > 0.1, ablated kept 775.0 -> 721.2; (a) ablated left out 765.7 -> 719.1; (b) Methods rule 413.9 -> 413.9 Sum over mice of the (a) pre-ablation count: 6975
Result: reproduced. Rwhisking 0.116 -> 0.115, signed-rank p = 0.820 (no change at the 0.05 level); mean counts 775.0 -> 721.2 (reading (a)); 5,389 member neurons (the sum of the (a) pre counts is 6,975, the paper's neuron count).
whisking-ablation-no-effect-touch, whisking-ablation-no-effect-whisking¶
Ablating whisking neurons had no effect on the touch representation (Rtouch 0.112 to 0.095, 7 mice, 5,866 neurons, P = 0.109; count 838 ± 401 to 899 ± 548). Ablating whisking neurons did not degrade the whisking representation (Rwhisking 0.108 to 0.107, 6,161 neurons, P = 0.812; count 880 ± 387 to 974 ± 558).
R[("whisking", "t")] = show("whisking", "t")
[methods cylinder] whisking ablation, Rtouch: grand median 0.113 -> 0.106 (adjusted MAD 0.008, 0.009); neurons 4605; signed-rank p = 0.109; median change -0.0080, mice with a decline 6 of 7 [code cylinder] whisking ablation, Rtouch: grand median 0.113 -> 0.106 (adjusted MAD 0.008, 0.008); neurons 4590; signed-rank p = 0.109; median change -0.0079, mice with a decline 6 of 7 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 278937 0.1050 0.1018 -0.0033 151 211 163 209 160 101 101 0.3110 278939 0.1182 0.1007 -0.0175 528 536 459 535 458 387 306 0.0978 281915 0.1366 0.1265 -0.0102 725 671 649 669 647 517 457 0.7961 275798 0.1052 0.1134 0.0083 972 1417 1829 1412 1826 699 697 0.7742 278288 0.1144 0.1065 -0.0080 973 1149 1192 1144 1186 819 590 0.6956 276013 0.1128 0.1007 -0.0121 635 969 1127 969 1126 477 451 -0.1477 278759 0.1112 0.1080 -0.0032 621 913 873 913 873 427 469 -0.0487 Counts, mean over mice: (a) score > 0.1, ablated kept 838.0 -> 898.9; (a) ablated left out 835.9 -> 896.6; (b) Methods rule 489.6 -> 438.7 Sum over mice of the (a) pre-ablation count: 5866
R[("whisking", "w")] = show("whisking", "w")
[methods cylinder] whisking ablation, Rwhisking: grand median 0.114 -> 0.110 (adjusted MAD 0.012, 0.004); neurons 4960; signed-rank p = 0.938; median change -0.0044, mice with a decline 4 of 7 [code cylinder] whisking ablation, Rwhisking: grand median 0.114 -> 0.110 (adjusted MAD 0.012, 0.005); neurons 4936; signed-rank p = 0.812; median change -0.0042, mice with a decline 4 of 7 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 278937 0.1027 0.1141 0.0115 394 357 358 351 356 225 278 0.3110 278939 0.1224 0.1070 -0.0155 649 636 571 626 570 465 410 0.0978 281915 0.1228 0.1278 0.0051 558 579 590 571 590 352 426 0.7961 275798 0.1011 0.1121 0.0110 1038 1436 1890 1425 1887 692 766 0.7742 278288 0.1117 0.1056 -0.0061 823 987 1113 967 1111 611 516 0.6956 276013 0.1168 0.1091 -0.0077 968 1273 1506 1267 1503 756 829 -0.1477 278759 0.1144 0.1100 -0.0044 530 893 788 884 787 392 386 -0.0487 Counts, mean over mice: (a) score > 0.1, ablated kept 880.1 -> 973.7; (a) ablated left out 870.1 -> 972.0; (b) Methods rule 499.0 -> 515.9 Sum over mice of the (a) pre-ablation count: 6161
silent-ablation-no-effect-touch, silent-ablation-no-effect-whisking¶
Ablating silent neurons did not change the touch representation (Rtouch 0.115 to 0.107, 8 mice, 7,110 neurons, P = 0.383; count 889 ± 713 to 926 ± 681). Ablating silent neurons did not change the whisking representation (Rwhisking 0.115 to 0.114, 7,684 neurons, P = 0.844; count 961 ± 464 to 904 ± 384).
R[("silent", "t")] = show("silent", "t")
[methods cylinder] silent ablation, Rtouch: grand median 0.111 -> 0.113 (adjusted MAD 0.019, 0.012); neurons 6339; signed-rank p = 0.383; median change +0.0021, mice with a decline 3 of 8
[code cylinder] silent ablation, Rtouch: grand median 0.110 -> 0.113 (adjusted MAD 0.019, 0.011); neurons 6313; signed-rank p = 0.383; median change +0.0029, mice with a decline 3 of 8 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 257218 0.1134 0.1306 0.0172 751 780 985 777 976 507 585 -0.3197 258836 0.0654 0.1316 0.0661 484 333 485 332 484 243 356 -0.4507 271211 0.1518 0.1398 -0.0119 2481 2338 2322 2333 2314 1986 1707 1.0323 278937 0.1032 0.1056 0.0025 148 152 211 151 210 90 100 -0.6200 278939 0.1288 0.1046 -0.0243 642 633 536 632 534 462 381 -0.4758 275801 0.1097 0.1091 -0.0007 221 432 481 432 480 162 168 -0.2920 275798 0.1114 0.1132 0.0017 959 1440 1417 1440 1416 663 695 -0.1004 276013 0.0847 0.1128 0.0281 653 1002 969 1002 968 442 475 -0.2079 Counts, mean over mice: (a) score > 0.1, ablated kept 888.8 -> 925.8; (a) ablated left out 887.4 -> 922.8; (b) Methods rule 569.4 -> 558.4 Sum over mice of the (a) pre-ablation count: 7110
R[("silent", "w")] = show("silent", "w")
[methods cylinder] silent ablation, Rwhisking: grand median 0.114 -> 0.115 (adjusted MAD 0.003, 0.005); neurons 5436; signed-rank p = 0.844; median change -0.0000, mice with a decline 4 of 8
[code cylinder] silent ablation, Rwhisking: grand median 0.114 -> 0.115 (adjusted MAD 0.003, 0.005); neurons 5428; signed-rank p = 0.844; median change -0.0001, mice with a decline 4 of 8 mouse pre post change n n_a_pre n_a_post n_adrop_pre n_adrop_post n_b_pre n_b_post score_ablated 257218 0.0842 0.1154 0.0311 367 603 716 602 713 224 327 -0.3197 258836 0.1468 0.1346 -0.0122 667 772 720 772 720 429 478 -0.4507 271211 0.1419 0.1334 -0.0084 554 1516 1304 1515 1301 432 445 1.0323 278937 0.1118 0.1127 0.0009 379 348 357 347 356 269 228 -0.6200 278939 0.1151 0.1159 0.0007 700 649 636 648 636 482 477 -0.4758 275801 0.1161 0.1094 -0.0067 738 833 793 833 790 561 475 -0.2920 275798 0.1128 0.1150 0.0022 958 1456 1436 1456 1435 679 718 -0.1004 276013 0.1119 0.1112 -0.0007 1073 1507 1273 1507 1270 945 762 -0.2079 Counts, mean over mice: (a) score > 0.1, ablated kept 960.5 -> 904.4; (a) ablated left out 960.0 -> 902.6; (b) Methods rule 502.6 -> 488.8 Sum over mice of the (a) pre-ablation count: 7684
Where the paper's grand medians for whisking and silent ablations come from: ablation_summ_stats.m fills one matrix of mouse medians, indexed by the ablation's position in the list of all 24 ablations (touch 1 to 9, silent 10 to 17, whisking 18 to 24), and takes the median over the whole matrix. It prints the whisking block before the silent rows are filled (they are zeros then), and the silent block when all 24 rows are filled. The cell below recomputes both, from this attempt's mouse medians.
order = [("touch", a) for a in P.ANIMS["touch"]] + [("silent", a) for a in P.ANIMS["silent"]] + [("whisking", a) for a in P.ANIMS["whisking"]]
for r, lab in [("t", "Rtouch"), ("w", "Rwhisking")]:
M = np.array([P.mouse_medians(T[(a, abl)], r)[:2] for abl, a in order])
Mz = M.copy(); Mz[9:17] = 0
print(f"{lab}: median over all 24 ablations {np.median(M[:, 0]):.3f} -> {np.median(M[:, 1]):.3f} "
f"median with the 8 silent rows zero (whisking block) {np.median(Mz[:, 0]):.3f} -> {np.median(Mz[:, 1]):.3f}")
print("Paper: silent Rtouch 0.115 -> 0.107, Rwhisking 0.115 -> 0.114; whisking Rtouch 0.112 -> 0.095, Rwhisking 0.108 -> 0.107")
Rtouch: median over all 24 ablations 0.115 -> 0.107 median with the 8 silent rows zero (whisking block) 0.112 -> 0.096
Rwhisking: median over all 24 ablations 0.115 -> 0.113 median with the 8 silent rows zero (whisking block) 0.109 -> 0.107 Paper: silent Rtouch 0.115 -> 0.107, Rwhisking 0.115 -> 0.114; whisking Rtouch 0.112 -> 0.095, Rwhisking 0.108 -> 0.107
# the paper's +/- values against two definitions of the adjusted MAD: 1.4826 x median absolute
# deviation (used above), and 1.4826 x MATLAB's default mad (mean absolute deviation)
mean_mad = lambda x: 1.4826 * np.mean(np.abs(np.asarray(x) - np.mean(x)))
paper_pm = {("touch", "t"): (0.021, 0.037), ("touch", "w"): (0.013, 0.024), ("whisking", "t"): (0.081, 0.069),
("whisking", "w"): (0.076, 0.076), ("silent", "t"): (0.021, 0.023), ("silent", "w"): (0.014, 0.015)}
for (abl, r), (pp, pq) in paper_pm.items():
s = R[(abl, r)]["methods"][0]
print(f"{abl:8s} {'Rtouch' if r == 't' else 'Rwhisking':9s}: median-based {P.adj_mad(s.pre):.3f} / {P.adj_mad(s.post):.3f}; "
f"mean-based {mean_mad(s.pre):.3f} / {mean_mad(s.post):.3f}; s.d. {s.pre.std(ddof=1):.3f} / {s.post.std(ddof=1):.3f}; paper {pp} / {pq}")
# the whisking and silent medians of the paper come from the 24-row matrix (cell above); the same matrix for the spread
for r in ["t", "w"]:
M = np.array([P.mouse_medians(T[(a, abl)], r)[:2] for abl, a in order])
Mz = M.copy(); Mz[9:17] = 0
for lab, X in [("whisking block, 8 zero rows", Mz), ("all 24 rows", M)]:
print(f"{'Rtouch' if r == 't' else 'Rwhisking'} {lab}: median-based {P.adj_mad(X[:, 0]):.3f} / {P.adj_mad(X[:, 1]):.3f}; "
f"mean-based {mean_mad(X[:, 0]):.3f} / {mean_mad(X[:, 1]):.3f}")
touch Rtouch : median-based 0.011 / 0.016; mean-based 0.021 / 0.038; s.d. 0.017 / 0.031; paper 0.021 / 0.037 touch Rwhisking: median-based 0.004 / 0.020; mean-based 0.013 / 0.024; s.d. 0.012 / 0.022; paper 0.013 / 0.024 whisking Rtouch : median-based 0.008 / 0.009; mean-based 0.011 / 0.010; s.d. 0.011 / 0.009; paper 0.081 / 0.069 whisking Rwhisking: median-based 0.012 / 0.004; mean-based 0.010 / 0.007; s.d. 0.009 / 0.007; paper 0.076 / 0.076 silent Rtouch : median-based 0.019 / 0.012; mean-based 0.027 / 0.017; s.d. 0.026 / 0.014; paper 0.021 / 0.023 silent Rwhisking: median-based 0.003 / 0.005; mean-based 0.020 / 0.012; s.d. 0.019 / 0.010; paper 0.014 / 0.015 Rtouch whisking block, 8 zero rows: median-based 0.027 / 0.034; mean-based 0.081 / 0.070 Rtouch all 24 rows: median-based 0.012 / 0.009; mean-based 0.021 / 0.023
Rwhisking whisking block, 8 zero rows: median-based 0.017 / 0.031; mean-based 0.076 / 0.076 Rwhisking all 24 rows: median-based 0.005 / 0.007; mean-based 0.014 / 0.015
The paper's ± values are reproduced by 1.4826 times the mean absolute deviation (MATLAB's mad
with its default flag), not by the median absolute deviation the text names: touch ablation
Rtouch 0.021 / 0.038 against 0.021 / 0.037, and Rwhisking 0.013 / 0.024, equal to the paper. For
the whisking and silent ablations they match only on the same matrices as the paper's medians
(whisking block with eight zero rows 0.081 / 0.070 and 0.076 / 0.076; all 24 rows 0.021 / 0.023
and 0.014 / 0.015). The ± values above (median-based) are therefore about half the paper's for the touch
ablations (0.011 / 0.016 against 0.021 / 0.037), and about a tenth for the whisking ablations
(Rtouch 0.008 / 0.009 against 0.081 / 0.069), whose paper values come from the zero-padded
matrix.
Result: whisking-ablation-no-effect-touch reproduced. Signed-rank p = 0.109 (Rtouch 0.113 -> 0.106 over the 7 whisking ablation mice; 4,605 member neurons), no change at the 0.05 level. The paper's 0.112 -> 0.095 are reproduced by the code's median over a matrix with eight zero rows (0.112 -> 0.096), not by the median over the 7 mice; the post value 0.106 is outside the claim's tolerance (0.085 to 0.105), but the criterion of this claim of absence is the test. Counts 838.0 -> 898.9 (reading (a)), and the (a) pre counts sum to 5,866, the paper's neuron count.
Result: whisking-ablation-no-effect-whisking reproduced. Signed-rank p = 0.938 with the Methods cylinder and 0.812 with the code's (the paper's value). Rwhisking 0.114 -> 0.110 over the 7 mice; the paper's 0.108 -> 0.107 is again the zero-padded median (0.109 -> 0.107 here). Counts 880.1 -> 973.7; the (a) pre counts sum to 6,161.
Result: silent-ablation-no-effect-touch reproduced. Signed-rank p = 0.383; Rtouch 0.111 -> 0.113 over the 8 mice. The paper's 0.115 -> 0.107 equal the median over all 24 ablations. Counts 888.8 -> 925.8; the (a) pre counts sum to 7,110.
Result: silent-ablation-no-effect-whisking reproduced. Signed-rank p = 0.844; Rwhisking 0.114 -> 0.115 over the 8 mice (the paper's 0.115 -> 0.114 are close to the 24-ablation median, 0.115 -> 0.113). Counts 960.5 -> 904.4; the (a) pre counts sum to 7,684.
ablation-type-specificity¶
Touch ablations produced significantly different changes in Rtouch from whisking or silent ablations, while whisking and silent ablations did not differ; for Rwhisking no pair of ablation types differed.
Wilcoxon rank-sum test on the per-mouse changes. With 9, 8 and 7 mice MATLAB's ranksum uses
its exact method; scipy's mannwhitneyu with method="exact" is the same test.
for cyl in ["methods", "code"]:
for r, lab in [("t", "Rtouch"), ("w", "Rwhisking")]:
ch = {abl: R[(abl, r)][cyl][0].change.values for abl in ["touch", "silent", "whisking"]}
p = lambda x, y: stats.mannwhitneyu(ch[x], ch[y], method="exact").pvalue
print(f"[{cyl}] change in {lab}: touch-silent p = {p('touch', 'silent'):.3f}, touch-whisking p = {p('touch', 'whisking'):.3f}, "
f"whisking-silent p = {p('whisking', 'silent'):.3f}; median changes touch {np.median(ch['touch']):+.4f}, "
f"silent {np.median(ch['silent']):+.4f}, whisking {np.median(ch['whisking']):+.4f}")
print("Paper: Rtouch 0.002, 0.042, 0.152; Rwhisking 0.743, 0.758, 1")
# where 0.031 and the paper's 0.042 part: the same test on the table's own per-mouse changes
ch_t = {abl: R[(abl, "t")]["code"][0].set_index("mouse").change for abl in ["touch", "whisking"]}
for abl in ["touch", "whisking"]:
e = EDT1[EDT1.ablation == abl].set_index("mouse").dRtouch
print(f"{abl}: change in Rtouch here (code cylinder) and in Extended Data Table 1, by mouse:",
{a: (round(ch_t[abl][a], 3), e[a]) for a in e.index})
et, ew = EDT1[EDT1.ablation == "touch"].dRtouch.values, EDT1[EDT1.ablation == "whisking"].dRtouch.values
print(f"rank-sum on the table's values, touch against whisking: p = {stats.mannwhitneyu(et, ew, method='exact').pvalue:.3f}; "
f"with ties (asymptotic, as MATLAB ranksum uses for ties): p = {stats.mannwhitneyu(et, ew, method='asymptotic').pvalue:.3f}")
allv = np.r_[ch_t["touch"].values, ch_t["whisking"].values]
rk = stats.rankdata(allv)
print("ranks here, touch:", rk[:9].astype(int).tolist(), "whisking:", rk[9:].astype(int).tolist())
rk_e = stats.rankdata(np.r_[et, ew])
print("ranks in the table, touch:", rk_e[:9].tolist(), "whisking:", rk_e[9:].tolist())
[methods] change in Rtouch: touch-silent p = 0.002, touch-whisking p = 0.031, whisking-silent p = 0.152; median changes touch -0.0287, silent +0.0021, whisking -0.0080
[methods] change in Rwhisking: touch-silent p = 0.743, touch-whisking p = 0.837, whisking-silent p = 0.955; median changes touch +0.0008, silent -0.0000, whisking -0.0044
[code] change in Rtouch: touch-silent p = 0.002, touch-whisking p = 0.031, whisking-silent p = 0.152; median changes touch -0.0285, silent +0.0029, whisking -0.0079
[code] change in Rwhisking: touch-silent p = 0.743, touch-whisking p = 0.758, whisking-silent p = 1.000; median changes touch +0.0008, silent -0.0001, whisking -0.0042
Paper: Rtouch 0.002, 0.042, 0.152; Rwhisking 0.743, 0.758, 1
touch: change in Rtouch here (code cylinder) and in Extended Data Table 1, by mouse: {'250220': (np.float64(-0.122), np.float64(-0.122)), '257220': (np.float64(-0.005), np.float64(-0.004)), '258836': (np.float64(-0.055), np.float64(-0.055)), '271211': (np.float64(-0.061), np.float64(-0.061)), '281915': (np.float64(-0.023), np.float64(-0.022)), '274424': (np.float64(-0.029), np.float64(-0.029)), '272761': (np.float64(-0.001), np.float64(-0.001)), '274577': (np.float64(-0.013), np.float64(-0.013)), '275801': (np.float64(-0.065), np.float64(-0.065))}
whisking: change in Rtouch here (code cylinder) and in Extended Data Table 1, by mouse: {'278937': (np.float64(-0.003), np.float64(-0.006)), '278939': (np.float64(-0.017), np.float64(-0.017)), '281915': (np.float64(-0.01), np.float64(-0.01)), '275798': (np.float64(0.008), np.float64(0.008)), '278288': (np.float64(-0.008), np.float64(-0.008)), '276013': (np.float64(-0.012), np.float64(-0.012)), '278759': (np.float64(-0.003), np.float64(-0.003))}
rank-sum on the table's values, touch against whisking: p = 0.042; with ties (asymptotic, as MATLAB ranksum uses for ties): p = 0.044
ranks here, touch: [1, 12, 4, 3, 6, 5, 15, 8, 2] whisking: [13, 7, 10, 16, 11, 9, 14]
ranks in the table, touch: [1.0, 13.0, 4.0, 3.0, 6.0, 5.0, 15.0, 8.0, 2.0] whisking: [12.0, 7.0, 10.0, 16.0, 11.0, 9.0, 14.0]
Result: reproduced. For Rtouch, touch-silent p = 0.002 and touch-whisking p = 0.031, while whisking-silent p = 0.152; for Rwhisking all three are above 0.05 (0.743, 0.837, 0.955 with the Methods cylinder; 0.743, 0.758, 1.000 with the code's, the paper's values). Only the touch-whisking value differs from the paper's (0.031 against 0.042). The same test on the table's own per-mouse changes gives 0.042: an278937's whisking-ablation change is -0.003 here and -0.006 in the table, which swaps its rank (13 here, 12 in the table) with an257220's touch ablation (12 here, 13 in the table).
ablation-size-correlation¶
The decline in the touch representation grew with the touch representation ablated, the change in Rtouch correlating with the net Rtouch ablated (R = -0.794 over all 24 ablations; R = -0.779 over the 9 touch ablations).
for cyl in ["methods", "code"]:
allc = pd.concat([R[(abl, "t")][cyl][0].assign(ablation=abl) for abl in ["touch", "silent", "whisking"]])
r_all = stats.pearsonr(allc.score_ablated, allc.change)
tt = allc[allc.ablation == "touch"]
r_t = stats.pearsonr(tt.score_ablated, tt.change)
print(f"[{cyl}] all 24: R = {r_all.statistic:.3f}, p = {r_all.pvalue:.2g}; touch 9: R = {r_t.statistic:.3f}, p = {r_t.pvalue:.3f}")
if cyl == "methods":
print(allc[["ablation", "mouse", "score_ablated", "change"]].round(3).to_string(index=False))
fig, ax = plt.subplots(figsize=(4, 3))
for abl, c in [("touch", "C0"), ("silent", "k"), ("whisking", "C2")]:
s = allc[allc.ablation == abl]
ax.scatter(s.score_ablated, s.change, c=c, label=abl)
ax.set_xlabel("net Rtouch ablated"); ax.set_ylabel("change in median Rtouch"); ax.legend()
print("Plotted ranges: x", np.round([allc.score_ablated.min(), allc.score_ablated.max()], 2), "y", np.round([allc.change.min(), allc.change.max()], 3))
[methods] all 24: R = -0.790, p = 4.4e-06; touch 9: R = -0.761, p = 0.017 ablation mouse score_ablated change touch 250220 12.194 -0.122 touch 257220 3.688 -0.005 touch 258836 3.561 -0.055 touch 271211 6.244 -0.061 touch 281915 3.378 -0.023 touch 274424 4.111 -0.029 touch 272761 3.794 -0.001 touch 274577 3.282 -0.013 touch 275801 2.635 -0.071 silent 257218 -0.320 0.017 silent 258836 -0.451 0.066 silent 271211 1.032 -0.012 silent 278937 -0.620 0.002 silent 278939 -0.476 -0.024 silent 275801 -0.292 -0.001 silent 275798 -0.100 0.002 silent 276013 -0.208 0.028 whisking 278937 0.311 -0.003 whisking 278939 0.098 -0.018 whisking 281915 0.796 -0.010 whisking 275798 0.774 0.008 whisking 278288 0.696 -0.008 whisking 276013 -0.148 -0.012 whisking 278759 -0.049 -0.003 Plotted ranges: x [-0.62 12.19] y [-0.122 0.066] [code] all 24: R = -0.797, p = 3.1e-06; touch 9: R = -0.781, p = 0.013
Result: reproduced. R = -0.790 over the 24 ablations (p = 4.4e-06) and R = -0.761 over the 9 touch ablations (p = 0.017), both within tolerance and significant (-0.797 and -0.781 with the code's cylinder). One mouse (an250220, 50 neurons ablated) carries much of the touch-ablation correlation.
distance-dependence-touch, distance-dependence-whisking-absent¶
After touch ablation, touch neurons 15-35 um from the nearest ablated neuron lost more Rtouch than those 115-135 um away (-0.132 against -0.056), and the effect decayed with distance with a length constant of 87 um. Touch ablation produced no distance-dependent change in the whisking representation (proximal 0.000, distal -0.023).
Readings: (a) the code's (per-mouse means for the paired test; median over all neurons pooled for the values); (b) per-mouse medians, grand median as the value. Length constant: fit of a exp(b d) to the cross-mouse mean of per-mouse mean changes in 25-um bins from 0 to 150 um.
def distance(r, cyl):
pm, dm, pmed, dmed, allp, alld, byb = [], [], [], [], [], [], []
bins = np.arange(0, 151, 25)
for a in P.ANIMS["touch"]:
d = P.with_cyl(T[(a, "touch")], cyl)
m = P.members(d, r)
dd = d.d_ablated_um[m].values
ds = (d[f"{r}_post"] - d[f"{r}_pre"])[m].values
px, di = (dd > 15) & (dd < 35), (dd > 115) & (dd < 135)
pm.append(np.nanmean(ds[px])); dm.append(np.nanmean(ds[di]))
pmed.append(np.nanmedian(ds[px])); dmed.append(np.nanmedian(ds[di]))
allp += list(ds[px]); alld += list(ds[di])
byb.append([np.nanmean(ds[(dd >= bins[i]) & (dd < bins[i + 1])]) for i in range(len(bins) - 1)])
x = bins[:-1] + 12.5
y = np.nanmean(np.array(byb), 0)
popt, _ = optimize.curve_fit(lambda x, a, b: a * np.exp(b * x), x, y, p0=(y[0], -0.01), maxfev=20000)
return dict(pm=pm, dm=dm, pmed=pmed, dmed=dmed, allp=allp, alld=alld, x=x, y=y, lam=abs(1 / popt[1]), byb=np.array(byb))
DIST = {}
for r in ["t", "w"]:
for cyl in ["methods", "code"]:
o = distance(r, cyl); DIST[(r, cyl)] = o
print(f"{'touch' if r == 't' else 'whisking'} neurons [{cyl}]: (a) pooled median proximal {np.nanmedian(o['allp']):+.3f} (n {len(o['allp'])}), "
f"distal {np.nanmedian(o['alld']):+.3f} (n {len(o['alld'])}), signed-rank on mouse means p = {stats.wilcoxon(o['pm'], o['dm']).pvalue:.3f}; "
f"(b) grand median of mouse medians {np.median(o['pmed']):+.3f} vs {np.median(o['dmed']):+.3f}, p = {stats.wilcoxon(o['pmed'], o['dmed']).pvalue:.3f}; "
f"lambda {o['lam']:.1f} um; bin means {np.round(o['y'], 3).tolist()}")
o = DIST[("t", "methods")]
print("Per mouse, touch neurons, mean change proximal and distal:")
print(pd.DataFrame({"mouse": P.ANIMS["touch"], "proximal": np.round(o["pm"], 3), "distal": np.round(o["dm"], 3)}).to_string(index=False))
fig, ax = plt.subplots(figsize=(4, 3))
for r, c in [("t", "C0"), ("w", "C2")]:
ax.plot(DIST[(r, "methods")]["x"], DIST[(r, "methods")]["y"], "o-", c=c, label=r)
ax.axhline(0, c="k", lw=0.5); ax.set_xlabel("distance to closest ablated neuron (um)"); ax.set_ylabel("mean score change"); ax.legend()
touch neurons [methods]: (a) pooled median proximal -0.133 (n 439), distal -0.056 (n 764), signed-rank on mouse means p = 0.012; (b) grand median of mouse medians -0.103 vs -0.019, p = 0.359; lambda 87.3 um; bin means [-0.089, -0.069, -0.046, -0.042, -0.028, -0.02] touch neurons [code]: (a) pooled median proximal -0.132 (n 422), distal -0.056 (n 764), signed-rank on mouse means p = 0.020; (b) grand median of mouse medians -0.108 vs -0.019, p = 0.359; lambda 87.6 um; bin means [-0.089, -0.066, -0.046, -0.042, -0.028, -0.02] whisking neurons [methods]: (a) pooled median proximal -0.004 (n 245), distal -0.023 (n 659), signed-rank on mouse means p = 0.164; (b) grand median of mouse medians -0.007 vs -0.019, p = 0.652; lambda 17.5 um; bin means [0.022, 0.008, -0.001, -0.006, -0.005, -0.005]
whisking neurons [code]: (a) pooled median proximal +0.000 (n 239), distal -0.023 (n 659), signed-rank on mouse means p = 0.129; (b) grand median of mouse medians +0.000 vs -0.019, p = 0.496; lambda 18.3 um; bin means [0.023, 0.009, -0.001, -0.006, -0.005, -0.005] Per mouse, touch neurons, mean change proximal and distal: mouse proximal distal 250220 -0.155 -0.081 257220 0.007 -0.000 258836 -0.143 0.018 271211 -0.077 -0.060 281915 -0.019 -0.013 274424 -0.036 0.005 272761 -0.038 -0.030 274577 -0.082 -0.003 275801 -0.203 -0.044
<matplotlib.legend.Legend at 0x79747d1ae710>
Result: distance-dependence-touch reproduced. Under reading (a), proximal -0.133 and distal -0.056 (-0.132 and -0.056 with the code's cylinder, the paper's values), signed-rank p = 0.012 (0.020), and the length constant is 87.3 um (87.6), all within tolerance. Under reading (b) the values are -0.103 and -0.019 with p = 0.359, which do not match; the claim holds under (a).
Result: distance-dependence-whisking-absent reproduced. Under the code's reading the proximal and distal whisking changes are -0.004 and -0.023 (0.000 and -0.023 with the code's cylinder) and the paired test gives p = 0.164 (0.129; the paper reads 0.098 from its figure), so no distance dependence at the 0.05 level. Per-mouse medians (variant) give p = 0.652.
behaviour-unchanged¶
Ablations did not change whisker movement or behaviour, so behaviour does not account for the decline of the touch representation; no mouse showed a significant change in whisker angle, angle at touch or curvature change at touch.
Per mouse and ablation, over all pre and all post session files: fraction correct (hits over hits and errors; trials without a lick are not scored, as the code sums the first four trial types) and touch bursts per trial. Touches are merged into bursts at a 50 ms interval; the toolbox method the code calls is not public, so a touch starting less than 50 ms after the previous touch of the trial ended is taken to join its burst (an assumption; it bears only on touches per trial). Kolmogorov-Smirnov tests per mouse on the samples (Methods), and on normalized histograms as the code does (variant).
brow = []
for (a, abl) in P.ABLATIONS:
b = P.behaviour(data[a], a, abl)
row = {"mouse": a, "ablation": abl, "fc_pre": b["pre"]["frac_correct"], "fc_post": b["post"]["frac_correct"],
"tpt_pre": b["pre"]["touches_per_trial"], "tpt_post": b["post"]["touches_per_trial"],
"trials_pre": b["pre"]["n_trials"], "trials_post": b["post"]["n_trials"]}
for v, edges in [("theta", np.arange(-45.5, 91, 1)), ("theta_at_touch", np.arange(-45.5, 91, 1)), ("kappa_at_touch", np.arange(-0.0255, 0.026, 0.001))]:
x, y = b["pre"][v], b["post"][v]
x, y = x[~np.isnan(x)], y[~np.isnan(y)]
k = stats.ks_2samp(x, y)
row[f"KS_{v}_p"], row[f"KS_{v}_D"], row[f"n_{v}"] = k.pvalue, k.statistic, min(len(x), len(y))
hx, hy = np.histogram(x, edges)[0], np.histogram(y, edges)[0]
row[f"KShist_{v}_p"] = stats.ks_2samp(hx / hx.sum(), hy / hy.sum()).pvalue
row[f"median_shift_{v}"] = np.median(y) - np.median(x)
brow.append(row)
beh = pd.DataFrame(brow)
print(beh[["mouse", "ablation", "trials_pre", "trials_post", "fc_pre", "fc_post", "tpt_pre", "tpt_post"]].round(3).to_string(index=False))
print()
paper = {("touch", "fc"): 0.863, ("touch", "tpt"): 0.666, ("silent", "fc"): 0.065, ("silent", "tpt"): 0.721, ("whisking", "fc"): 0.710, ("whisking", "tpt"): 0.620}
for abl in ["touch", "silent", "whisking"]:
s = beh[beh.ablation == abl]
for v in ["fc", "tpt"]:
print(f"{abl:8s} {'fraction correct' if v == 'fc' else 'touches/trial':16s}: mean {s[v + '_pre'].mean():.3f} -> {s[v + '_post'].mean():.3f}; "
f"signed-rank (paired, legend) p = {stats.wilcoxon(s[v + '_pre'], s[v + '_post']).pvalue:.3f}; "
f"rank-sum (code) p = {stats.mannwhitneyu(s[v + '_pre'], s[v + '_post'], method='exact').pvalue:.3f}; paper {paper[(abl, v)]}")
print()
cols = [c for c in beh.columns if c.startswith("KS_") or c.startswith("KShist_") or c.startswith("median_shift") or c.startswith("n_")]
print(beh[["mouse", "ablation"] + cols].round(4).to_string(index=False))
for v in ["theta", "theta_at_touch", "kappa_at_touch"]:
print(f"{v}: KS on samples p < 0.05 in {(beh[f'KS_{v}_p'] < 0.05).sum()} of 24 ablations (median D {beh[f'KS_{v}_D'].median():.3f}); "
f"KS on histograms p < 0.05 in {(beh[f'KShist_{v}_p'] < 0.05).sum()} of 24")
mouse ablation trials_pre trials_post fc_pre fc_post tpt_pre tpt_post 274424 touch 502 574 0.687 0.699 2.440 1.871 272761 touch 451 595 0.807 0.765 1.532 1.375 274577 touch 915 588 0.681 0.639 1.666 2.044 275798 silent 1056 581 0.725 0.795 1.920 2.153 275798 whisking 581 812 0.795 0.860 2.153 3.235 275801 silent 1039 781 0.573 0.592 1.129 1.314 275801 touch 691 991 0.590 0.591 1.117 1.210 276013 silent 630 347 0.648 0.723 2.030 2.484 276013 whisking 347 683 0.723 0.671 2.484 2.406 278288 whisking 1133 958 0.621 0.653 2.430 3.520 278759 whisking 719 520 0.662 0.629 1.682 1.833 250220 touch 919 833 0.852 0.878 1.376 1.845 257218 silent 743 1170 0.833 0.901 0.501 0.751 257220 touch 890 949 0.840 0.896 1.552 1.222 258836 silent 807 741 0.704 0.740 1.051 0.888 258836 touch 741 593 0.740 0.754 0.888 1.091 271211 silent 1018 1016 0.610 0.788 1.239 1.138 271211 touch 1016 982 0.788 0.818 1.138 1.497 278937 silent 1019 897 0.704 0.854 0.824 1.146 278937 whisking 897 665 0.854 0.737 1.146 1.331 278939 silent 1191 930 0.783 0.892 1.077 0.999 278939 whisking 930 996 0.892 0.898 0.999 1.033 281915 whisking 612 813 0.588 0.727 0.686 0.862 281915 touch 813 568 0.727 0.695 0.862 0.871 touch fraction correct: mean 0.746 -> 0.748; signed-rank (paired, legend) p = 0.910; rank-sum (code) p = 0.863; paper 0.863 touch touches/trial : mean 1.397 -> 1.447; signed-rank (paired, legend) p = 0.570; rank-sum (code) p = 0.796; paper 0.666 silent fraction correct: mean 0.697 -> 0.786; signed-rank (paired, legend) p = 0.008; rank-sum (code) p = 0.065; paper 0.065 silent touches/trial : mean 1.221 -> 1.359; signed-rank (paired, legend) p = 0.109; rank-sum (code) p = 0.645; paper 0.721 whisking fraction correct: mean 0.734 -> 0.739; signed-rank (paired, legend) p = 0.938; rank-sum (code) p = 0.710; paper 0.71 whisking touches/trial : mean 1.654 -> 2.031; signed-rank (paired, legend) p = 0.047; rank-sum (code) p = 0.620; paper 0.62 mouse ablation KS_theta_p KS_theta_D n_theta KShist_theta_p median_shift_theta KS_theta_at_touch_p KS_theta_at_touch_D n_theta_at_touch KShist_theta_at_touch_p median_shift_theta_at_touch KS_kappa_at_touch_p KS_kappa_at_touch_D n_kappa_at_touch KShist_kappa_at_touch_p median_shift_kappa_at_touch 274424 touch 0.0 0.0343 1815564 0.0780 0.2895 0.0000 0.1084 1697 0.9994 0.2314 0.0541 0.0442 1697 1.0000 -0.0000 272761 touch 0.0 0.4288 1447344 0.1849 3.2298 0.0000 0.3746 964 0.9736 3.5253 0.0000 0.3008 910 0.9980 -0.0002 274577 touch 0.0 0.0841 1926537 0.1056 -0.7109 0.0000 0.2418 3566 0.9941 -3.0764 0.0113 0.0377 3566 0.9696 -0.0001 275798 silent 0.0 0.0266 2091521 0.7673 -0.3744 0.0000 0.0644 2764 0.9285 -0.6173 0.0000 0.0789 2764 1.0000 0.0001 275798 whisking 0.0 0.0669 2091521 0.4685 -1.0295 0.0000 0.0869 2764 0.9941 -0.4326 0.0000 0.1113 2764 1.0000 -0.0001 275801 silent 0.0 0.1848 2790981 0.9285 -2.0870 0.0000 0.0832 2158 0.4685 0.3601 0.0000 0.0745 2158 0.8768 -0.0002 275801 touch 0.0 0.2980 2475696 0.9285 -3.2318 0.0000 0.1267 1704 0.5651 -1.3932 0.0003 0.0656 1704 0.8768 0.0001 276013 silent 0.0 0.0681 1266390 0.9994 -0.6566 0.0000 0.1771 2087 0.8576 1.7772 0.0000 0.1403 2087 0.9696 -0.0004 276013 whisking 0.0 0.0622 1266390 0.9941 -0.3758 0.0000 0.0930 2087 0.0780 -0.6298 0.0001 0.0619 2087 0.9980 0.0000 278288 whisking 0.0 0.0787 3394426 0.3042 -0.7667 0.0000 0.1470 4459 0.3042 2.4952 0.0000 0.0612 4456 0.9980 -0.0000 278759 whisking 0.0 0.0755 1871715 0.9941 0.7757 0.0000 0.1097 1676 0.3042 0.2916 0.0000 0.1385 1676 1.0000 -0.0002 250220 touch 0.0 0.1150 2019043 0.9285 -2.9223 0.0000 0.3632 2743 0.9994 -3.3783 0.0000 0.1636 2667 0.8768 0.0006 257218 silent 0.0 0.0620 1244789 0.3809 0.8049 0.0000 0.2608 2632 1.0000 2.8362 0.0000 0.0745 2620 0.9696 0.0008 257220 touch 0.0 0.0461 2157017 0.9941 1.2235 0.0000 0.0533 4724 0.3809 -0.2476 0.0000 0.1855 4624 0.1190 -0.0012 258836 silent 0.0 0.2694 2220171 0.3809 -5.4414 0.0000 0.1608 1705 0.6668 1.9757 0.0000 0.2009 1681 1.0000 -0.0004 258836 touch 0.0 0.0865 1802812 0.9941 -0.1965 0.0000 0.1582 1705 1.0000 -2.5246 0.0000 0.0987 1681 1.0000 0.0004 271211 silent 0.0 0.0927 2483916 0.6668 -4.0947 0.0000 0.0535 3759 1.0000 -0.5281 0.0000 0.1265 3744 0.5616 0.0002 271211 touch 0.0 0.0872 2483916 0.9285 -3.0924 0.0000 0.0843 3991 1.0000 -0.7004 0.0000 0.0966 3991 1.0000 -0.0003 278937 silent 0.0 0.0960 2330979 0.9285 -1.5954 0.0000 0.1300 1106 0.2390 -1.2379 0.0000 0.2092 1106 0.9980 0.0002 278937 whisking 0.0 0.1344 2143901 0.0568 -2.3265 0.3852 0.0374 1016 1.0000 0.0886 0.0000 0.1887 991 1.0000 -0.0002 278939 silent 0.0 0.0517 2653779 0.9736 -0.5534 0.0000 0.3003 2575 0.6668 4.4808 0.0000 0.1799 2443 1.0000 0.0002 278939 whisking 0.0 0.0549 2653779 0.3042 -0.6595 0.0053 0.0448 2575 0.8576 0.1149 0.0000 0.0944 2443 1.0000 -0.0003 281915 whisking 0.0 0.1834 1448495 0.4685 -3.1468 0.0000 0.1575 1247 0.9736 -2.1729 0.0024 0.0687 1232 0.5616 -0.0001 281915 touch 0.0 0.1601 1885930 1.0000 -2.5869 0.0000 0.1459 1008 0.9994 -2.0900 0.0000 0.1117 1008 0.9980 -0.0001 theta: KS on samples p < 0.05 in 24 of 24 ablations (median D 0.085); KS on histograms p < 0.05 in 0 of 24 theta_at_touch: KS on samples p < 0.05 in 23 of 24 ablations (median D 0.128); KS on histograms p < 0.05 in 0 of 24 kappa_at_touch: KS on samples p < 0.05 in 23 of 24 ablations (median D 0.105); KS on histograms p < 0.05 in 0 of 24
# trial-type order, by file format (fraction correct takes the first two of the first four types)
for fmt in ["v5", "v7.3"]:
seen = {}
for a in sorted(data):
for dname, fl in data[a]["sess"].items():
for fn, r in fl.items():
if r["format"] == fmt:
seen.setdefault(tuple(r["trial_type_str"][:6]), []).append(f"an{a}")
for k, v in seen.items():
print(f"{fmt}: trialTypeStr[:6] = {list(k)} in {len(v)} files")
# touch properties: keys and lengths against the event edges (the [0::2] rule assumes one value per edge)
lens = []
for a in sorted(data):
for dname, fl in data[a]["sess"].items():
for fn, r in fl.items():
pl = r["touch_prop_lens"]
lens.append({"mouse": a, "file": fn, "edges": r["n_touch_edges"], "keys": tuple(sorted(pl)),
"theta_len": pl.get("thetaAtTouchOnset", -1), "kappa_len": pl.get("kappaMaxAbsOverTouch", -1)})
lens = pd.DataFrame(lens)
print("touch property keys:", lens["keys"].value_counts().to_dict())
print(f"files: {len(lens)}; thetaAtTouchOnset length equal to the number of event edges in {(lens.theta_len == lens.edges).sum()}, "
f"to half of it in {(lens.theta_len * 2 == lens.edges).sum()}; kappaMaxAbsOverTouch equal to edges in {(lens.kappa_len == lens.edges).sum()}, "
f"to half in {(lens.kappa_len * 2 == lens.edges).sum()}")
odd = lens[(lens.theta_len != lens.edges) | (lens.kappa_len != lens.edges)]
print(odd.drop(columns="keys").to_string(index=False) if len(odd) else "no file differs")
v5: trialTypeStr[:6] = ['HitL', 'HitR', 'ErrL', 'ErrR', 'NoLickL', 'NoLickR'] in 72 files
v5: trialTypeStr[:6] = ['HitL', 'HitR', 'ErrL', 'ErrR', 'IgnoreL', 'IgnoreR'] in 22 files
v7.3: trialTypeStr[:6] = ['HitL', 'HitR', 'ErrL', 'ErrR', 'IgnoreL', 'IgnoreR'] in 58 files
v7.3: trialTypeStr[:6] = ['HitL', 'HitR', 'ErrL', 'ErrR', 'NoLickL', 'NoLickR'] in 49 files
touch property keys: {('kappaMaxAbsOverTouch', 'thetaAtTouchOnset', 'thetaMeanOverTouch', 'touchBoutNumber', 'touchNumberWithinBout', 'touchNumberWithinTrial', 'whTSACorrespondingIndex'): 173, ('caTSACorrespondingIndex', 'kappaMaxAbsOverTouch', 'thetaAtTouchOnset', 'thetaMeanOverTouch', 'touchBoutNumber', 'touchNumberWithinBout', 'touchNumberWithinTrial', 'whTSACorrespondingIndex'): 24, ('derTSACorrespondingIndex', 'kappaMaxAbsOverTouch', 'thetaAtTouchOnset', 'thetaMeanOverTouch', 'touchBoutNumber', 'touchNumberWithinBout', 'touchNumberWithinTrial', 'whTSACorrespondingIndex'): 4}
files: 201; thetaAtTouchOnset length equal to the number of event edges in 201, to half of it in 0; kappaMaxAbsOverTouch equal to edges in 201, to half in 0
no file differs
Result: not reproduced. With the paired signed-rank test the legend names, fraction correct rises after silent ablations (mean 0.697 -> 0.786, p = 0.008) and touches per trial rise after whisking ablations (p = 0.047); for touch ablations neither changes (p = 0.910 and 0.570). The KS tests on the samples find a difference in all 24 ablations for whisker angle and in 23 of 24 for angle and curvature at touch, with small effects (median D 0.085, 0.128 and 0.105), as the large samples make the test sensitive. The code's tests find nothing: the rank-sum tests give no p below 0.05, and equal the figure's values for fraction correct (0.863, 0.065, 0.710) and for whisking-ablation touches (0.620); for touches per trial after touch and silent ablations they give 0.796 and 0.645 against 0.666 and 0.721, as the burst rule here is assumed. The KS tests on normalized histograms give no p below 0.05. So the paper's statistics come from unpaired tests, not the paired ones its legend names. The part of the statement about touch ablations (no change in behaviour that could explain the touch decline) holds under every test run here. The trial types begin HitL, HitR, ErrL, ErrR in every file of both formats, so fraction correct is hits over hits and errors; the touch properties have one value per event edge in all 201 files, so taking every other value gives one per touch.
response-similarity-touch-ablation, response-similarity-example, response-similarity-whisking-ablation¶
After touch ablation, the change in Rtouch depended on response similarity to the ablated neurons; similar neurons declined and neurons with negative similarity increased, while the whisking representation showed no such dependence. In an example touch ablation mouse (272761), the slope is -0.44. Ablation of whisking neurons had no similarity-dependent effect on either representation.
Members with score above 0.25. Main reading: trial averages of correct left and right trials concatenated (Methods), Methods cylinder, a line fitted to the neurons' points per mouse, sign test on the slopes. Variants: the code's trial average (right trials only), the code's cylinder, and the code's fit to bin means.
SIM = {}
for abl in ["touch", "whisking"]:
for ta in ["both", "right"]:
for a in P.ANIMS[abl]:
SIM[(abl, ta, a)] = P.similarity(data[a], T[(a, abl)], a, abl, ta)
def sim_summary(abl, r, ta, cyl):
rows, bms = [], []
for a in P.ANIMS[abl]:
d = P.with_cyl(T[(a, abl)], cyl)
c = SIM[(abl, ta, a)]
m = P.members(d, r, 0.25) & ~np.isnan(c)
ds = (d[f"{r}_post"] - d[f"{r}_pre"]).values
s_pts, s_bin, bm, n, n_in = P.similarity_slopes(c[m], ds[m])
rows.append({"mouse": a, "slope_points": s_pts, "slope_bins": s_bin, "n": n, "n_in_bins": n_in})
bms.append(bm)
return pd.DataFrame(rows), np.array(bms)
SS = {}
for abl in ["touch", "whisking"]:
for r in ["t", "w"]:
for ta in ["both", "right"]:
for cyl in ["methods", "code"]:
s, bms = sim_summary(abl, r, ta, cyl)
SS[(abl, r, ta, cyl)] = (s, bms)
print(f"{abl} ablation, {'touch' if r == 't' else 'whisking'} neurons, trial avg {ta:5s}, {cyl:7s} cylinder: n {s.n.sum():5d} (in bins {s.n_in_bins.sum():5d}); "
f"point fit: {(s.slope_points < 0).sum()}/{len(s)} negative, median slope {s.slope_points.median():+.3f}, sign p = {P.sign_test(s.slope_points):.3f}; "
f"bin fit: {(s.slope_bins < 0).sum()}/{len(s)} negative, sign p = {P.sign_test(s.slope_bins):.3f}")
print("Paper: touch ablation, touch 2,768 neurons p = 0.039; whisking 1,085 neurons p = 0.508; whisking ablation, touch 1,692 p = 0.453; whisking 935 p = 1")
touch ablation, touch neurons, trial avg both , methods cylinder: n 2845 (in bins 2788); point fit: 7/9 negative, median slope -0.204, sign p = 0.180; bin fit: 9/9 negative, sign p = 0.004 touch ablation, touch neurons, trial avg both , code cylinder: n 2824 (in bins 2767); point fit: 7/9 negative, median slope -0.193, sign p = 0.180; bin fit: 9/9 negative, sign p = 0.004 touch ablation, touch neurons, trial avg right, methods cylinder: n 2845 (in bins 2792); point fit: 8/9 negative, median slope -0.168, sign p = 0.039; bin fit: 8/9 negative, sign p = 0.039 touch ablation, touch neurons, trial avg right, code cylinder: n 2824 (in bins 2768); point fit: 8/9 negative, median slope -0.165, sign p = 0.039; bin fit: 8/9 negative, sign p = 0.039 touch ablation, whisking neurons, trial avg both , methods cylinder: n 1174 (in bins 1104); point fit: 1/9 negative, median slope +0.035, sign p = 0.039; bin fit: 2/9 negative, sign p = 0.180 touch ablation, whisking neurons, trial avg both , code cylinder: n 1168 (in bins 1100); point fit: 1/9 negative, median slope +0.031, sign p = 0.039; bin fit: 2/9 negative, sign p = 0.180 touch ablation, whisking neurons, trial avg right, methods cylinder: n 1174 (in bins 1088); point fit: 3/9 negative, median slope +0.020, sign p = 0.508; bin fit: 3/9 negative, sign p = 0.508 touch ablation, whisking neurons, trial avg right, code cylinder: n 1168 (in bins 1085); point fit: 4/9 negative, median slope +0.029, sign p = 1.000; bin fit: 3/9 negative, sign p = 0.508 whisking ablation, touch neurons, trial avg both , methods cylinder: n 1624 (in bins 1586); point fit: 3/7 negative, median slope +0.018, sign p = 1.000; bin fit: 6/7 negative, sign p = 0.031 whisking ablation, touch neurons, trial avg both , code cylinder: n 1614 (in bins 1576); point fit: 3/7 negative, median slope +0.018, sign p = 1.000; bin fit: 6/7 negative, sign p = 0.031 whisking ablation, touch neurons, trial avg right, methods cylinder: n 1624 (in bins 1586); point fit: 6/7 negative, median slope -0.081, sign p = 0.031; bin fit: 6/7 negative, sign p = 0.031 whisking ablation, touch neurons, trial avg right, code cylinder: n 1614 (in bins 1576); point fit: 6/7 negative, median slope -0.079, sign p = 0.031; bin fit: 5/7 negative, sign p = 0.219 whisking ablation, whisking neurons, trial avg both , methods cylinder: n 889 (in bins 828); point fit: 4/7 negative, median slope -0.033, sign p = 0.688; bin fit: 3/7 negative, sign p = 1.000 whisking ablation, whisking neurons, trial avg both , code cylinder: n 885 (in bins 824); point fit: 4/7 negative, median slope -0.031, sign p = 0.688; bin fit: 3/7 negative, sign p = 1.000 whisking ablation, whisking neurons, trial avg right, methods cylinder: n 889 (in bins 842); point fit: 3/7 negative, median slope -0.006, sign p = 1.000; bin fit: 2/7 negative, sign p = 0.688 whisking ablation, whisking neurons, trial avg right, code cylinder: n 885 (in bins 839); point fit: 3/7 negative, median slope -0.004, sign p = 1.000; bin fit: 2/7 negative, sign p = 0.688 Paper: touch ablation, touch 2,768 neurons p = 0.039; whisking 1,085 neurons p = 0.508; whisking ablation, touch 1,692 p = 0.453; whisking 935 p = 1
# trial averages: files without them, and files whose averages are longer than the 70 frames kept
for a in sorted(data):
for dname, fl in data[a]["sess"].items():
for fn, r in sorted(fl.items()):
if r["hitL"] is None or r["hitR"] is None:
ks = [k for k in r["feature_keys"] if "TrialAvg" in k or "dffBased" in k or "Hit" in k]
print(f"an{a} {dname} {fn}: hitL {'none' if r['hitL'] is None else r['hitL'].shape}, hitR {'none' if r['hitR'] is None else r['hitR'].shape}; "
f"{len(r['feature_keys'])} feature keys, of which trial-average or dF/F keys: {ks}")
long_ = sorted({(f"an{a}", dname.replace("session_neuropilone_", "").replace("_merged", ""), fn[-19:-16], r["hitL"].shape[0])
for a in sorted(data) for dname, fl in data[a]["sess"].items() for fn, r in fl.items()
if r["hitL"] is not None and r["hitL"].shape[0] != 70})
print(f"files whose trial averages are not 70 frames long ({len(long_)}), cut to 70:", long_)
print("whisking ablation mice entering the similarity analysis:",
{a: int(np.isfinite(SIM[("whisking", "both", a)]).sum()) for a in P.ANIMS["whisking"]})
an278939 session_neuropilone_postablate_silent_merged an278939_vol_01_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
an278939 session_neuropilone_postablate_silent_merged an278939_vol_02_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
an278939 session_neuropilone_postablate_silent_merged an278939_vol_03_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
an278939 session_neuropilone_postablate_silent_merged an278939_vol_04_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
an278939 session_neuropilone_postablate_silent_merged an278939_vol_05_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
an278939 session_neuropilone_postablate_silent_merged an278939_vol_06_sess_struct.mat: hitL none, hitR none; 27 feature keys, of which trial-average or dF/F keys: ['psthHitLeftTrialsMatrix', 'psthHitRightTrialsMatrix']
files whose trial averages are not 70 frames long (80), cut to 70: [('an272761', 'postablate', '_01', 75), ('an272761', 'postablate', '_02', 75), ('an272761', 'postablate', '_03', 75), ('an272761', 'postablate', '_04', 75), ('an272761', 'preablate', '_01', 75), ('an272761', 'preablate', '_02', 75), ('an272761', 'preablate', '_03', 75), ('an272761', 'preablate', '_04', 75), ('an274424', 'postablate', '_01', 75), ('an274424', 'postablate', '_02', 75), ('an274424', 'postablate', '_03', 75), ('an274424', 'postablate', '_04', 75), ('an274424', 'preablate', '_01', 75), ('an274424', 'preablate', '_02', 75), ('an274424', 'preablate', '_03', 75), ('an274424', 'preablate', '_04', 75), ('an274577', 'postablate', '_11', 75), ('an274577', 'postablate', '_12', 75), ('an274577', 'postablate', '_13', 75), ('an274577', 'postablate', '_14', 75), ('an274577', 'preablate', '_11', 75), ('an274577', 'preablate', '_12', 75), ('an274577', 'preablate', '_13', 75), ('an274577', 'preablate', '_14', 75), ('an275798', 'postablate_silent', '_01', 75), ('an275798', 'postablate_silent', '_02', 75), ('an275798', 'postablate_silent', '_03', 75), ('an275798', 'postablate_silent', '_04', 75), ('an275798', 'postablate_whisking', '_01', 75), ('an275798', 'postablate_whisking', '_02', 75), ('an275798', 'postablate_whisking', '_03', 75), ('an275798', 'postablate_whisking', '_04', 75), ('an275798', 'preablate', '_01', 75), ('an275798', 'preablate', '_02', 75), ('an275798', 'preablate', '_03', 75), ('an275798', 'preablate', '_04', 75), ('an275801', 'postablate_silent', '_01', 75), ('an275801', 'postablate_silent', '_02', 75), ('an275801', 'postablate_silent', '_03', 75), ('an275801', 'postablate_silent', '_04', 75), ('an275801', 'postablate_touch', '_01', 75), ('an275801', 'postablate_touch', '_02', 75), ('an275801', 'postablate_touch', '_03', 75), ('an275801', 'postablate_touch', '_04', 75), ('an275801', 'postablate_whisking', '_01', 75), ('an275801', 'postablate_whisking', '_02', 75), ('an275801', 'postablate_whisking', '_03', 75), ('an275801', 'postablate_whisking', '_04', 75), ('an275801', 'preablate', '_01', 75), ('an275801', 'preablate', '_02', 75), ('an275801', 'preablate', '_03', 75), ('an275801', 'preablate', '_04', 75), ('an276013', 'postablate_silent', '_21', 75), ('an276013', 'postablate_silent', '_22', 75), ('an276013', 'postablate_silent', '_23', 75), ('an276013', 'postablate_silent', '_24', 75), ('an276013', 'postablate_whisking', '_21', 75), ('an276013', 'postablate_whisking', '_22', 75), ('an276013', 'postablate_whisking', '_23', 75), ('an276013', 'postablate_whisking', '_24', 75), ('an276013', 'preablate', '_21', 75), ('an276013', 'preablate', '_22', 75), ('an276013', 'preablate', '_23', 75), ('an276013', 'preablate', '_24', 75), ('an278288', 'postablate', '_01', 75), ('an278288', 'postablate', '_02', 75), ('an278288', 'postablate', '_03', 75), ('an278288', 'postablate', '_04', 75), ('an278288', 'preablate', '_01', 75), ('an278288', 'preablate', '_02', 75), ('an278288', 'preablate', '_03', 75), ('an278288', 'preablate', '_04', 75), ('an278759', 'postablate', '_01', 75), ('an278759', 'postablate', '_02', 75), ('an278759', 'postablate', '_03', 75), ('an278759', 'postablate', '_04', 75), ('an278759', 'preablate', '_01', 75), ('an278759', 'preablate', '_02', 75), ('an278759', 'preablate', '_03', 75), ('an278759', 'preablate', '_04', 75)]
whisking ablation mice entering the similarity analysis: {'278937': 4230, '278939': 0, '281915': 7002, '275798': 11364, '278288': 9313, '276013': 11658, '278759': 9187}
xc = np.arange(-1, 1, 0.1) + 0.05
for ta in ["both", "right"]:
s, bms = SS[("touch", "t", ta, "methods")]
print(f"touch ablation, touch neurons, trial avg {ta}: mean over mice of bin means, by similarity bin:")
print(pd.Series(np.nanmean(bms, 0), index=np.round(xc, 2)).dropna().round(3).to_string())
print(f" bins with negative similarity and a mean: {int(np.sum(~np.isnan(np.nanmean(bms, 0)[xc < 0])))}; above 0 in {int(np.sum(np.nanmean(bms, 0)[xc < 0] > 0))}")
s, _ = SS[("touch", "t", "both", "methods")]
print(s.round(3).to_string(index=False))
fig, axs = plt.subplots(1, 2, figsize=(8, 3))
for ax, ta in zip(axs, ["both", "right"]):
_, bms = SS[("touch", "t", ta, "methods")]
for b in bms:
ax.plot(xc, b, c="0.7", lw=0.8)
ax.plot(xc, np.nanmean(bms, 0), c="C0", lw=2); ax.axhline(0, c="k", lw=0.5)
ax.set_title(f"trial average: {ta}"); ax.set_xlabel("response similarity"); ax.set_ylabel("change in Rtouch")
print(ta, "plotted range", np.round([np.nanmin(bms), np.nanmax(bms)], 3))
touch ablation, touch neurons, trial avg both: mean over mice of bin means, by similarity bin: -0.25 0.085 -0.15 0.129 -0.05 0.070 0.05 0.183 0.15 0.009 0.25 0.081 0.35 -0.113 0.45 -0.067 0.55 -0.080 0.65 -0.103 0.75 -0.096 0.85 -0.069 0.95 -0.082 bins with negative similarity and a mean: 3; above 0 in 3 touch ablation, touch neurons, trial avg right: mean over mice of bin means, by similarity bin: -0.55 0.119 -0.45 -0.141 -0.35 0.273 -0.25 0.213 -0.15 0.098 -0.05 0.019 0.05 0.056 0.15 0.089 0.25 0.031 0.35 -0.025 0.45 -0.049 0.55 -0.059 0.65 -0.093 0.75 -0.114 0.85 -0.061 0.95 -0.088 bins with negative similarity and a mean: 6; above 0 in 5 mouse slope_points slope_bins n n_in_bins 250220 -0.279 -0.293 355 352 257220 -0.206 -0.314 158 153 258836 -0.322 -0.325 145 141 271211 -0.093 -0.166 1053 1048 281915 0.006 -0.148 218 210 274424 -0.204 -0.382 228 221 272761 -0.393 -0.508 134 127 274577 -0.153 -0.129 470 458 275801 0.377 -0.132 84 78 both plotted range [-0.267 0.356] right plotted range [-0.279 0.373]
Result: response-similarity-touch-ablation not reproduced. Under the claims file's method (both trial averages concatenated, a line through each mouse's neurons), 7 of 9 touch slopes are negative (sign test p = 0.180, not below 0.05), and the whisking slopes are positive in 8 of 9 (p = 0.039), a dependence the claim says is absent; the mean bin change is above 0 at negative similarity, as stated. The paper's numbers are reproduced only with the code's trial average, which keeps the right-trial average alone: then 8 of 9 touch slopes are negative (p = 0.039) with 2,768 neurons in bins (code cylinder, bin-mean fit), and the whisking slopes give p = 0.508 with 1,085 neurons, both exactly the paper's values.
for ta in ["both", "right"]:
for cyl in ["methods", "code"]:
s, _ = SS[("touch", "t", ta, cyl)]
e = s[s.mouse == "272761"].iloc[0]
print(f"an272761, trial avg {ta:5s}, {cyl:7s} cylinder: slope of the point fit {e.slope_points:+.3f}; slope of the bin-mean fit {e.slope_bins:+.3f}; n {e.n}")
d = P.with_cyl(T[("272761", "touch")], "methods")
c = SIM[("touch", "both", "272761")]
m = P.members(d, "t", 0.25) & ~np.isnan(c)
fig, ax = plt.subplots(figsize=(4, 3))
ax.scatter(c[m], (d.t_post - d.t_pre).values[m], s=6)
ax.set_xlabel("response similarity"); ax.set_ylabel("change in Rtouch"); ax.set_title("an272761")
print("plotted ranges: x", np.round([np.nanmin(c[m]), np.nanmax(c[m])], 2), "y", np.round([np.nanmin((d.t_post - d.t_pre).values[m]), np.nanmax((d.t_post - d.t_pre).values[m])], 2))
an272761, trial avg both , methods cylinder: slope of the point fit -0.393; slope of the bin-mean fit -0.508; n 134 an272761, trial avg both , code cylinder: slope of the point fit -0.389; slope of the bin-mean fit -0.502; n 132 an272761, trial avg right, methods cylinder: slope of the point fit -0.433; slope of the bin-mean fit -0.617; n 134 an272761, trial avg right, code cylinder: slope of the point fit -0.426; slope of the bin-mean fit -0.608; n 132 plotted ranges: x [-0.43 0.99] y [-0.59 0.43]
Result: response-similarity-example not reproduced. With the claim's method the slope of the point fit in an272761 is -0.393, just outside the tolerance (-0.484 to -0.396). With the code's right-trial average the point-fit slope is -0.433 (Methods cylinder) or -0.426 (code cylinder), within tolerance; the code's bin-mean fit gives -0.617 and -0.608.
for r in ["t", "w"]:
s, _ = SS[("whisking", r, "both", "methods")]
print(f"whisking ablation, {'touch' if r == 't' else 'whisking'} neurons:")
print(s.round(3).to_string(index=False))
whisking ablation, touch neurons: mouse slope_points slope_bins n n_in_bins 278937 -0.055 -0.938 21 9 278939 NaN NaN 0 0 281915 -0.056 -0.152 277 269 275798 0.058 -0.012 502 500 278288 0.067 -0.037 368 364 276013 0.036 -0.105 177 172 278759 -0.000 -0.141 279 272 whisking ablation, whisking neurons: mouse slope_points slope_bins n n_in_bins 278937 -0.031 0.123 62 50 278939 NaN NaN 0 0 281915 -0.105 -0.079 186 174 275798 -0.035 -0.039 237 229 278288 0.032 0.013 109 101 276013 0.019 0.007 198 192 278759 -0.056 -0.062 97 82
Result: response-similarity-whisking-ablation reproduced. With the claim's method the sign tests give p = 1.000 for touch neurons (3 of 6 slopes negative) and p = 0.688 for whisking neurons (4 of 6), so no similarity dependence at the 0.05 level, with 1,624 and 889 neurons (within tolerance of 1,692 and 935). Only 6 of the 7 mice enter: the six pre-ablation files of an278939's whisking ablation (its post-silent directory) hold no trial-averaged dF/F, so no similarity can be computed there (they hold 27 features, of which psthHitLeftTrialsMatrix and psthHitRightTrialsMatrix, which no other file uses for this analysis; an278939 enters with 0 neurons). The code's bin-mean fit (variant) gives p = 0.031 for touch neurons with both trial averages, and the right-trial point fit also gives 0.031.
ablation-no-off-target-event-rate¶
Ablation of silent neurons did not change the calcium event rate of neurons adjacent (10-25 um) to the ablated cells (0.014 Hz before and after).
As ablation_figure_distance.m (event_rate_plot): neurons more than 10 and less than 25 um from the closest ablated neuron, leaving out ablated and cylinder-excluded neurons, all representations; per-mouse median event rate; signed-rank test.
for cyl in ["methods", "code"]:
pre, post, n, per = [], [], 0, []
for a in P.ANIMS["silent"]:
d = T[(a, "silent")]
ex = (d[f"prox_{cyl}"] == 1) | (d.is_ablated == 1)
adj = (d.d_ablated_um > 10) & (d.d_ablated_um < 25) & ~ex
pre.append(np.nanmedian(d.er_pre[adj])); post.append(np.nanmedian(d.er_post[adj])); n += int(adj.sum())
per.append((a, int(adj.sum()), round(pre[-1], 4), round(post[-1], 4)))
print(f"[{cyl}] grand median {np.median(pre):.4f} -> {np.median(post):.4f} Hz (adjusted MAD {P.adj_mad(pre):.4f}, {P.adj_mad(post):.4f}); "
f"{n} neurons; signed-rank p = {stats.wilcoxon(pre, post).pvalue:.4f}; mice with a lower rate after: {int(np.sum(np.array(post) < np.array(pre)))} of 8")
print(" per mouse (mouse, n, pre, post):", per)
[methods] grand median 0.0141 -> 0.0140 Hz (adjusted MAD 0.0051, 0.0045); 1035 neurons; signed-rank p = 0.0547; mice with a lower rate after: 7 of 8
per mouse (mouse, n, pre, post): [('257218', 100, np.float64(0.0149), np.float64(0.0131)), ('258836', 133, np.float64(0.0133), np.float64(0.0149)), ('271211', 109, np.float64(0.0334), np.float64(0.0266)), ('278937', 88, np.float64(0.0195), np.float64(0.0183)), ('278939', 96, np.float64(0.0172), np.float64(0.0157)), ('275801', 149, np.float64(0.0075), np.float64(0.0059)), ('275798', 151, np.float64(0.0104), np.float64(0.0084)), ('276013', 209, np.float64(0.0125), np.float64(0.0122))]
[code] grand median 0.0141 -> 0.0140 Hz (adjusted MAD 0.0051, 0.0045); 1028 neurons; signed-rank p = 0.0547; mice with a lower rate after: 7 of 8
per mouse (mouse, n, pre, post): [('257218', 100, np.float64(0.0149), np.float64(0.0131)), ('258836', 130, np.float64(0.0133), np.float64(0.0149)), ('271211', 107, np.float64(0.0335), np.float64(0.0266)), ('278937', 88, np.float64(0.0195), np.float64(0.0183)), ('278939', 95, np.float64(0.0172), np.float64(0.0151)), ('275801', 148, np.float64(0.0075), np.float64(0.0059)), ('275798', 151, np.float64(0.0104), np.float64(0.0084)), ('276013', 209, np.float64(0.0125), np.float64(0.0122))]
Result: reproduced. Grand median event rate 0.0141 -> 0.0140 Hz with 1,035 adjacent neurons (1,028 with the code's cylinder, the paper's count), signed-rank p = 0.055, no change at the 0.05 level (7 of 8 mice have a slightly lower rate after).
ablation-success-rate¶
About two thirds of ablation attempts succeeded; 293 cells were ablated successfully in 22 sessions in 14 mice with complete logs.
Targets and successes from the curation files (NYU: per-attempt targets and success flags; JRC:
attempted_ids and ablated_ids). The JRC ablation logs' target ids (la.ablatedId, as
ablation_figure_energy.m reads them) are compared with attempted_ids.
srow = []
for (a, abl) in P.ABLATIONS:
tg, sc, logs = P.targets_and_successes(data[a], a, abl)
srow.append({"mouse": a, "ablation": abl, "targets": len(tg), "successes": len(sc), "successes_not_targets": len(sc - tg),
"log_targets": len(logs) if a not in P.NYU else None, "logs_eq_attempted": (logs == tg) if a not in P.NYU else None})
sr = pd.DataFrame(srow)
print(sr.to_string(index=False))
ok = sr[sr.targets > 0]
print(f"\nAblations with a list of targets: {len(ok)} of 24 (an250220's curation file lists only the ablated ids, and its logs are under dates its curation file does not name)")
print(f"Fraction successful over those: {ok.successes.sum()} / {ok.targets.sum()} = {ok.successes.sum() / ok.targets.sum():.3f}; "
f"per ablation: median {np.median(ok.successes / ok.targets):.3f}, range {np.min(ok.successes / ok.targets):.2f} to {np.max(ok.successes / ok.targets):.2f}")
rest = sr[~sr.mouse.isin(["250220", "257218"])]
print(f"Successes leaving out an250220 and an257218: {rest.successes.sum()} in {len(rest)} ablations of {rest.mouse.nunique()} mice; all 24 ablations: {sr.successes.sum()}")
print("\nNYU mice: per-attempt log files in the archive against the curation file's targets and attempts")
for (a, abl) in P.ABLATIONS:
if a not in P.NYU:
continue
cur = P.ABLATIONS[(a, abl)][2]
att = [n for n in data[a]["nyu_attempts"]]
tg_ids = set()
n_att = 0
for c in cur:
dcur = data[a]["small"][c]
if "ablationTargetIds" in dcur:
ids = np.atleast_1d(dcur["ablationTargetIds"])
n_att += len(ids)
tg_ids |= set(ids.tolist())
import re as _re
log_ids = [int(m.group(1)) for n in att for m in [_re.search(r"_target_(\d+)_attempt_", n)] if m]
in_tg = sum(i in tg_ids for i in set(log_ids))
print(f"an{a} {abl:8s}: curation attempts {n_att}, distinct targets {len(tg_ids)}; attempt logs in the archive (all ablations of the mouse) {len(att)}, "
f"distinct target ids in their names {len(set(log_ids))}, of which in this ablation's targets {in_tg}")
print("NYU totals: attempt logs", sum(len(data[a]["nyu_attempts"]) for a in sorted(P.NYU)))
mouse ablation targets successes successes_not_targets log_targets logs_eq_attempted 274424 touch 23 17 0 NaN None 272761 touch 22 14 0 NaN None 274577 touch 26 11 0 NaN None 275798 silent 20 13 0 NaN None 275798 whisking 22 11 0 NaN None 275801 silent 26 14 0 NaN None 275801 touch 24 9 0 NaN None 276013 silent 24 16 0 NaN None 276013 whisking 22 9 0 NaN None 278288 whisking 37 25 0 NaN None 278759 whisking 33 11 0 NaN None 250220 touch 0 50 50 0.0 True 257218 silent 24 20 0 0.0 False 257220 touch 12 9 0 12.0 True 258836 silent 20 16 0 20.0 True 258836 touch 16 15 0 16.0 True 271211 silent 19 16 0 19.0 True 271211 touch 16 15 0 16.0 True 278937 silent 16 15 0 16.0 True 278937 whisking 15 12 0 15.0 True 278939 silent 21 20 0 21.0 True 278939 whisking 15 13 0 15.0 True 281915 whisking 9 8 0 9.0 True 281915 touch 12 11 0 12.0 True Ablations with a list of targets: 23 of 24 (an250220's curation file lists only the ablated ids, and its logs are under dates its curation file does not name) Fraction successful over those: 320 / 474 = 0.675; per ablation: median 0.750, range 0.33 to 0.95 Successes leaving out an250220 and an257218: 300 in 22 ablations of 14 mice; all 24 ablations: 370 NYU mice: per-attempt log files in the archive against the curation file's targets and attempts an274424 touch : curation attempts 25, distinct targets 23; attempt logs in the archive (all ablations of the mouse) 25, distinct target ids in their names 23, of which in this ablation's targets 23 an272761 touch : curation attempts 35, distinct targets 22; attempt logs in the archive (all ablations of the mouse) 35, distinct target ids in their names 22, of which in this ablation's targets 22 an274577 touch : curation attempts 57, distinct targets 26; attempt logs in the archive (all ablations of the mouse) 57, distinct target ids in their names 26, of which in this ablation's targets 26 an275798 silent : curation attempts 30, distinct targets 20; attempt logs in the archive (all ablations of the mouse) 91, distinct target ids in their names 42, of which in this ablation's targets 20 an275798 whisking: curation attempts 61, distinct targets 22; attempt logs in the archive (all ablations of the mouse) 91, distinct target ids in their names 42, of which in this ablation's targets 22 an275801 silent : curation attempts 38, distinct targets 26; attempt logs in the archive (all ablations of the mouse) 90, distinct target ids in their names 50, of which in this ablation's targets 26 an275801 touch : curation attempts 52, distinct targets 24; attempt logs in the archive (all ablations of the mouse) 90, distinct target ids in their names 50, of which in this ablation's targets 24 an276013 silent : curation attempts 42, distinct targets 24; attempt logs in the archive (all ablations of the mouse) 88, distinct target ids in their names 46, of which in this ablation's targets 24 an276013 whisking: curation attempts 46, distinct targets 22; attempt logs in the archive (all ablations of the mouse) 88, distinct target ids in their names 46, of which in this ablation's targets 22 an278288 whisking: curation attempts 65, distinct targets 37; attempt logs in the archive (all ablations of the mouse) 65, distinct target ids in their names 37, of which in this ablation's targets 37 an278759 whisking: curation attempts 59, distinct targets 33; attempt logs in the archive (all ablations of the mouse) 59, distinct target ids in their names 33, of which in this ablation's targets 33 NYU totals: attempt logs 510
Result: reproduced. Over the 23 ablations with a list of targets, 320 of 474 targeted neurons were ablated (0.675, within 0.667 ± 0.067). Leaving out the two mice the legend names, 300 neurons were ablated successfully in 22 ablations of 14 mice, within tolerance of 293; the legend also leaves out 7 other ablations it does not name, so this count cannot be matched exactly. In the NYU mice the 510 per-attempt logs are the attempts of the curation files: each mouse has as many logs as curation-file attempts over its ablations (for example 30 + 61 = 91 in an275798), and their target ids are the curation files' targets (the 279 NYU targets are distinct neurons, several attempted more than once).
per-mouse-table¶
Extended Data Table 1 lists, for each of the 24 ablations, the mouse's neuron count, the ablation type, the number ablated, the touch and whisking neuron counts and the change in median Rtouch and Rwhisking.
Counts match within 10%, changes within 0.005. The touch and whisking counts are compared under reading (a) of representation-sizes (score above 0.1, first pre-ablation data of the ablation), reading (b), and the members entering the medians (the union of the pre and post periods, as in get_restricted_neurons.m), with each cylinder. The cell count of a second ablation is the mouse's (the table gives it once).
prow = []
for e in EDT1.itertuples():
for cyl in ["methods", "code"]:
d = P.with_cyl(T[(e.mouse, e.ablation)], cyl)
tpre, tpost, nt = P.mouse_medians(d, "t")
wpre, wpost, nw = P.mouse_medians(d, "w")
cells = e.cells if not pd.isna(e.cells) else None
fa = next(k for k in T if k[0] == e.mouse and k[1] in FIRST and e.mouse in FIRST[k[1]])
prow.append({"mouse": e.mouse, "ablation": e.ablation, "cyl": cyl, "cells": len(T[fa]), "EDT1_cells": cells,
"ablated": int(d.is_ablated.sum()), "EDT1_ablated": e.ablated,
"touch_members": nt, "touch_a": P.class_counts(d, "t", "a")[0], "touch_b": P.class_counts(d, "t", "b")[0], "EDT1_touch": e.touch,
"whisk_members": nw, "whisk_a": P.class_counts(d, "w", "a")[0], "whisk_b": P.class_counts(d, "w", "b")[0], "EDT1_whisk": e.whisking,
"dRt": tpost - tpre, "EDT1_dRt": e.dRtouch, "dRw": wpost - wpre, "EDT1_dRw": e.dRwhisking})
pt = pd.DataFrame(prow)
within = lambda x, y: (np.abs(x - y) <= 0.1 * np.abs(y))
for cyl in ["methods", "code"]:
s = pt[pt.cyl == cyl]
cm = (s.EDT1_cells.isna() | (s.cells == s.EDT1_cells))
am = s.ablated == s.EDT1_ablated
dt, dw = np.abs(s.dRt - s.EDT1_dRt) <= 0.005, np.abs(s.dRw - s.EDT1_dRw) <= 0.005
allm = cm & am & dt & dw
print(f"[{cyl}] cell count {cm.sum()}/24, ablated {am.sum()}/24, dRtouch {dt.sum()}/24, dRwhisking {dw.sum()}/24, all four {allm.sum()}/24; "
f"touch count within 10%: members {within(s.touch_members, s.EDT1_touch).sum()}, (a) {within(s.touch_a, s.EDT1_touch).sum()}, (b) {within(s.touch_b, s.EDT1_touch).sum()}; "
f"equal: members {(s.touch_members == s.EDT1_touch).sum()}; whisking within 10%: members {within(s.whisk_members, s.EDT1_whisk).sum()}, "
f"(a) {within(s.whisk_a, s.EDT1_whisk).sum()}, (b) {within(s.whisk_b, s.EDT1_whisk).sum()}; equal: members {(s.whisk_members == s.EDT1_whisk).sum()}")
s = pt[pt.cyl == "methods"].copy()
print(s.drop(columns="cyl").round(3).to_string(index=False))
print("\nRows where a change differs by more than 0.005 (Methods cylinder):")
print(s[(np.abs(s.dRt - s.EDT1_dRt) > 0.005) | (np.abs(s.dRw - s.EDT1_dRw) > 0.005)][["mouse", "ablation", "dRt", "EDT1_dRt", "dRw", "EDT1_dRw"]].round(3).to_string(index=False))
[methods] cell count 24/24, ablated 24/24, dRtouch 23/24, dRwhisking 24/24, all four 23/24; touch count within 10%: members 24, (a) 10, (b) 1; equal: members 3; whisking within 10%: members 24, (a) 9, (b) 1; equal: members 10 [code] cell count 24/24, ablated 24/24, dRtouch 24/24, dRwhisking 24/24, all four 24/24; touch count within 10%: members 24, (a) 10, (b) 1; equal: members 21; whisking within 10%: members 24, (a) 9, (b) 1; equal: members 22
mouse ablation cells EDT1_cells ablated EDT1_ablated touch_members touch_a touch_b EDT1_touch whisk_members whisk_a whisk_b EDT1_whisk dRt EDT1_dRt dRw EDT1_dRw 250220 touch 8844 8844.0 50 50 881 1244 749 867 426 1064 388 422 -0.122 -0.122 -0.076 -0.076 257218 silent 6215 6215.0 20 20 751 780 507 743 367 603 224 366 0.017 0.018 0.031 0.032 257220 touch 3663 3663.0 9 9 390 613 316 389 455 591 259 455 -0.005 -0.004 0.025 0.025 258836 silent 7290 7290.0 16 16 484 333 243 481 667 772 429 666 0.066 0.066 -0.012 -0.012 258836 touch 7290 NaN 15 15 488 485 342 488 655 720 476 655 -0.055 -0.055 0.001 0.001 271211 silent 9415 9415.0 16 16 2481 2338 1986 2476 554 1516 432 551 -0.012 -0.012 -0.008 -0.007 271211 touch 9415 NaN 15 15 1957 2322 1704 1951 692 1304 445 692 -0.061 -0.061 0.021 0.021 278937 silent 4230 4230.0 15 15 148 152 90 146 379 348 269 379 0.002 0.004 0.001 0.001 278937 whisking 4230 NaN 12 12 151 211 101 150 394 357 225 392 -0.003 -0.006 0.011 0.011 278939 silent 7167 7167.0 20 20 642 633 462 636 700 649 482 698 -0.024 -0.024 0.001 0.001 278939 whisking 7167 NaN 13 13 528 536 387 523 649 636 465 649 -0.018 -0.017 -0.015 -0.015 281915 whisking 7002 7002.0 8 8 725 671 517 723 558 579 352 550 -0.010 -0.010 0.005 0.004 281915 touch 7002 NaN 11 11 604 649 448 601 676 590 427 672 -0.023 -0.022 0.007 0.008 274424 touch 7785 7785.0 17 17 708 779 527 706 719 768 533 718 -0.029 -0.029 -0.014 -0.014 272761 touch 6359 6359.0 14 14 511 486 331 509 410 426 289 410 -0.001 -0.001 -0.000 0.000 274577 touch 12173 12173.0 11 11 1382 1445 1009 1380 657 841 415 657 -0.013 -0.013 0.004 0.004 275801 silent 8354 8354.0 14 14 221 432 162 220 738 833 561 738 -0.001 0.000 -0.007 -0.007 275801 touch 8354 NaN 9 9 200 369 187 197 699 671 493 698 -0.071 -0.065 -0.007 -0.006 275798 silent 11364 11364.0 13 13 959 1440 663 959 958 1456 679 958 0.002 0.002 0.002 0.002 275798 whisking 11364 NaN 11 11 972 1417 699 972 1038 1436 692 1037 0.008 0.008 0.011 0.011 278288 whisking 9314 9314.0 25 25 973 1149 819 969 823 987 611 813 -0.008 -0.008 -0.006 -0.006 276013 silent 11659 11659.0 16 16 653 1002 442 652 1073 1507 945 1072 0.028 0.028 -0.001 -0.001 276013 whisking 11659 NaN 9 9 635 969 477 634 968 1273 756 968 -0.012 -0.012 -0.008 -0.008 278759 whisking 9187 9187.0 11 11 621 913 427 617 530 893 392 526 -0.003 -0.003 -0.004 -0.004 Rows where a change differs by more than 0.005 (Methods cylinder): mouse ablation dRt EDT1_dRt dRw EDT1_dRw 275801 touch -0.071 -0.065 -0.007 -0.006
Result: partially reproduced. Under the main reading (the Methods cylinder) 23 of 24 rows match in cell count, ablated count and both changes; in an275801's touch ablation the change in Rtouch is -0.071 against the table's -0.065. With the code's cylinder (variant) all 24 rows match. The table's touch and whisking counts are the members that enter the medians under the code's cylinder (21 and 22 of 24 rows equal, all within 10%), not the counts of reading (a) or (b) (10 and 1 rows within 10% for touch), so the table was made with the code's rule.
Network model claims¶
The model outputs were not deposited (claims file, data: elsewhere), so the network of the
Methods ("Network model") is rebuilt here in numpy and numba (helper peron2020_model.py, whose
docstring gives the source of every parameter). The paper used Brian2; this is a
reimplementation of the same equations and parameters, not the paper's code.
What the Methods leave open, and the choice made for each (each an assumption, recorded in the attempt):
- The size of the background PSP. The Methods give its frequencies (5,000 and 2,000 Hz) and say they were "selected so that the tonic firing rate of these populations were approximately 0.5 Hz for excitatory neurons and 10 Hz for inhibitory neurons". One PSP per population is set here to give those rates at Pconn 0.2 without stimulus (first cell below).
- The sign of inhibitory PSPs: -1 mV ("All connections had the same strength, which was chosen so that the resulting post-synaptic potential (PSP) is 1 mV").
- The stimulus amplitude is its peak current; its value comes from the readings of the claims file's opening comment, (a) fraction of excitatory neurons with score above 0.1 equal to 0.108, (b) smallest Kolmogorov-Smirnov distance to the pooled pre-ablation Rtouch of the touch ablation mice, (c) fraction equal to 0.17. Reading (b) sets a strength only where its smallest distance lies at a positive strength inside the sweep, which reaches down to no input.
- Which neurons enter "all neurons that met the 0.1 encoding score criteria": excitatory neurons only (main) and all neurons of the network, inhibitory ones included (variant). The Methods match the input on the "distributions of excitatory neuron encoding scores", ablate "the 20 excitatory neurons with the highest encoding score", and the in vivo data the model stands for are of excitatory neurons (Ai162 x Slc17a7-IRES2-cre mice; Emx1-IRES-cre mice, whose mCherry marks "only ... nuclei of excitatory neurons"; Methods, Mice). The paper's counts for Fig. 3b (3,466 and 3,779 neurons above 0.25 over 30 networks) are also nearer the excitatory counts here than those of all neurons (model-response-similarity cell). An earlier revision of this notebook counted all neurons; the two outcomes that the change moves were reviewed in a third verification round, which agreed with both.
- The repeated run after ablation uses the same background and initial state as the run before (Brian2's store and restore); the 0-ablation networks of Extended Data Fig. 4 therefore show no change.
Every network is seeded by its index (0 to 29), so each claim's numbers do not depend on the order of the cells.
import peron2020_model as PM
t_model = time.time()
bg_grid = [(be, bi) for be in [0.37, 0.39, 0.41] for bi in [1.3, 1.4, 1.5]]
bgr = PM.run_jobs([dict(kind="pre_only", seeds=[800], pconn=0.2, strength=0.0, bg=g, duration=4000.0) for g in bg_grid])
print("Background PSP (mV, excitatory and inhibitory targets) and tonic rates at Pconn 0.2 without stimulus, one network, 4 s:")
for g, d in zip(bg_grid, bgr):
print(f" {g}: excitatory {d['rate_pre'][:PM.NEXC].mean():.2f} Hz, inhibitory {d['rate_pre'][PM.NEXC:].mean():.2f} Hz")
print("Used:", PM.BG_PSP, "(Methods: about 0.5 Hz and 10 Hz)")
stim10, n10 = PM.stimulus(10.0)
stim50, n50 = PM.stimulus(50.0)
on = np.nonzero(np.diff(np.r_[0, (stim10 > 0).astype(int)]) == 1)[0]
w10 = np.sum(stim10[on[0]:on[0] + 400] > 0) * PM.DT
half = stim10[on[0]:on[0] + 400] >= 0.5
print(f"Stimulus: {n10} presentations in 20 s, first onset {on[0] * PM.DT:.0f} ms, every {np.diff(on).mean() * PM.DT:.0f} ms; touch waveform "
f"{w10:.1f} ms long, peak at {np.argmax(stim10[on[0]:on[0] + 400]) * PM.DT:.1f} ms, full width at half maximum {half.sum() * PM.DT:.1f} ms (Methods 12.8 ms); "
f"slow waveform peak at {np.argmax(stim50[on[0]:on[0] + 2000]) * PM.DT:.1f} ms ({n50} presentations)")
print(f"Kick sizes (equation 7) for a 1 mV PSP: E->E {PM.psp_to_kick(1, 30, 2):.3f}, E->I {PM.psp_to_kick(1, 10, 2):.3f}, "
f"I->E {PM.psp_to_kick(1, 30, 3):.3f}, I->I {PM.psp_to_kick(1, 10, 3):.3f}")
_b = PM.Batch([0], 0.4)
_g = _b.groups
_pre_g, _post_g = _g[_b.pre], _g[_b.post]
print("Connection probability by block (pre -> post), network 0 at Pconn 0.4:",
{f"{'SEI'[i]}->{'SEI'[j]}": round(float(((_pre_g == i) & (_post_g == j)).sum() / ((_g == i).sum() * ((_g == j).sum() - (i == j)))), 3)
for i in range(3) for j in range(3)})
print(f"Delays {(_b.delay.min() * PM.DT):.1f} to {(_b.delay.max() * PM.DT):.1f} ms; Vth - Vr {_b.theta.min():.1f} to {_b.theta.max():.1f} mV")
del _b
Background PSP (mV, excitatory and inhibitory targets) and tonic rates at Pconn 0.2 without stimulus, one network, 4 s:
(0.37, 1.3): excitatory 0.59 Hz, inhibitory 9.79 Hz
(0.37, 1.4): excitatory 0.34 Hz, inhibitory 9.62 Hz
(0.37, 1.5): excitatory 0.15 Hz, inhibitory 9.73 Hz
(0.39, 1.3): excitatory 0.77 Hz, inhibitory 10.59 Hz
(0.39, 1.4): excitatory 0.51 Hz, inhibitory 10.35 Hz
(0.39, 1.5): excitatory 0.27 Hz, inhibitory 10.24 Hz
(0.41, 1.3): excitatory 0.96 Hz, inhibitory 11.42 Hz
(0.41, 1.4): excitatory 0.68 Hz, inhibitory 11.09 Hz
(0.41, 1.5): excitatory 0.42 Hz, inhibitory 10.91 Hz
Used: (0.39, 1.4) (Methods: about 0.5 Hz and 10 Hz)
Stimulus: 66 presentations in 20 s, first onset 300 ms, every 300 ms; touch waveform 29.8 ms long, peak at 9.9 ms, full width at half maximum 12.9 ms (Methods 12.8 ms); slow waveform peak at 49.9 ms (66 presentations)
Kick sizes (equation 7) for a 1 mV PSP: E->E 18.201, E->I 7.477, I->E 12.915, I->I 5.584
Connection probability by block (pre -> post), network 0 at Pconn 0.4: {'S->S': 0.404, 'S->E': 0.201, 'S->I': 0.601, 'E->S': 0.199, 'E->E': 0.2, 'E->I': 0.599, 'I->S': 0.601, 'I->E': 0.599, 'I->I': 0.603}
Delays 0.3 to 0.9 ms; Vth - Vr 17.5 to 52.5 mV
Calibration of the input strength¶
Sweeps of the peak input current, two networks per strength (seeds 900 and 901), for the touch input (peak 10 ms) and the slow input (peak 50 ms), at Pconn 0.2 and 0.4. For each strength, the fraction of excitatory neurons with score above 0.1 and the Kolmogorov-Smirnov distance between the excitatory scores and the in vivo distribution (pre-ablation Rtouch of every neuron of the 9 touch ablation mice). Reading (a) interpolates linearly to the fraction 0.108, reading (c) to 0.17, and reading (b) takes the strength of the grid with the smallest distance, set only when that strength is positive and inside the grid. Each sweep starts at no input (strength 0), so that a minimum at the weakest strength tried can be told from one at no input.
SW = {(0.2, 10.0): [0, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 300, 400], (0.4, 10.0): [0, 3, 6, 9, 12, 15, 20, 25, 30, 35, 40, 50],
(0.2, 50.0): [0, 25, 50, 70, 90, 110, 140, 200], (0.4, 50.0): [0, 1, 2, 3, 5, 7, 9, 12, 15]}
sw_jobs = [dict(kind="pre_only", seeds=[900 + k], pconn=pc, strength=float(s), peak_ms=pk) for (pc, pk), ss in SW.items() for s in ss for k in range(2)]
sw = PM.run_jobs(sw_jobs)
invivo = np.concatenate([T[(a, "touch")].t_pre.dropna().values for a in P.ANIMS["touch"]])
print(f"In vivo reference: {len(invivo)} neurons, fraction above 0.1 {np.mean(invivo > 0.1):.3f}, median {np.median(invivo):.3f}, "
f"range {invivo.min():.3f} to {invivo.max():.3f}, fraction exactly 0 {np.mean(invivo == 0):.3f}")
cal = []
for (pc, pk), ss in SW.items():
for s in ss:
ds = [d for d in sw if d["pconn"] == pc and d["peak"] == pk and d["strength"] == s]
e = np.concatenate([d["pre"][:PM.NEXC] for d in ds])
cal.append({"pconn": pc, "peak_ms": pk, "strength": s, "frac_exc_0.1": np.mean(e > 0.1), "frac_exc_zero": np.mean(e == 0), "frac_S_0.1": np.mean(np.concatenate([d["pre"][:PM.NS] for d in ds]) > 0.1),
"median_exc_above_0.1": np.median(e[e > 0.1]) if (e > 0.1).any() else np.nan, "KS": stats.ks_2samp(e, invivo).statistic,
"rate_exc_Hz": np.mean([d["rate_pre"][:PM.NEXC].mean() for d in ds]), "rate_inh_Hz": np.mean([d["rate_pre"][PM.NEXC:].mean() for d in ds])})
cal = pd.DataFrame(cal)
print(cal.round(3).to_string(index=False))
def cross(x, f, target):
"""First crossing of ``target`` by f(x), linear interpolation between grid points."""
for i in range(1, len(x)):
if f[i - 1] < target <= f[i]:
return float(x[i - 1] + (target - f[i - 1]) * (x[i] - x[i - 1]) / (f[i] - f[i - 1]))
return np.nan
STR = {}
for (pc, pk), g in cal.groupby(["pconn", "peak_ms"]):
x, f = g.strength.values, g["frac_exc_0.1"].values
STR[("a", pc, pk)] = cross(x, f, 0.108)
STR[("c", pc, pk)] = cross(x, f, 0.17)
k = int(np.argmin(g.KS.values))
STR[("b", pc, pk)] = float(x[k]) if 0 < k < len(x) - 1 else np.nan # a minimum at no input or at the strongest input sets none
print(f"Pconn {pc}, peak {pk:.0f} ms: (a) {STR[('a', pc, pk)]:.1f}; (b) {STR[('b', pc, pk)]:.1f} (smallest KS {g.KS.min():.3f} at strength {x[k]:g}; "
f"next smallest {np.sort(g.KS.values)[1]:.3f}); "
f"(c) {STR[('c', pc, pk)]:.1f} (largest fraction reached {f.max():.3f})")
print("\nAmplification (inverse of the matched input strength, normalized to Pconn 0.2), touch input:")
AMP = {}
for rd in ["a", "b", "c"]:
s2, s4 = STR[(rd, 0.2, 10.0)], STR[(rd, 0.4, 10.0)]
AMP[rd] = s2 / s4
print(f" reading ({rd}): strength {s2:.1f} at Pconn 0.2 and {s4:.1f} at 0.4; amplification at 0.4 = {AMP[rd]:.2f}; "
f"strength at 0.4 below that at 0.2: {s4 < s2 if not np.isnan(s2 + s4) else 'not set'}")
for p in [0.25, 0.3, 0.35, 0.44]:
sp = s2 + (p - 0.2) / 0.2 * (s4 - s2)
print(f" interpolated strength at Pconn {p}: {sp:.1f}" + (f", amplification {s2 / sp:.2f}" if sp > 0 else ", not positive"))
In vivo reference: 69291 neurons, fraction above 0.1 0.121, median -0.020, range -0.360 to 0.779, fraction exactly 0 0.000
pconn peak_ms strength frac_exc_0.1 frac_exc_zero frac_S_0.1 median_exc_above_0.1 KS rate_exc_Hz rate_inh_Hz
0.2 10.0 0 0.001 0.724 0.000 0.104 0.516 0.503 10.266
0.2 10.0 25 0.026 0.720 0.220 0.150 0.507 0.512 10.304
0.2 10.0 50 0.044 0.715 0.368 0.262 0.483 0.530 10.380
0.2 10.0 75 0.054 0.704 0.462 0.354 0.468 0.553 10.486
0.2 10.0 100 0.067 0.693 0.565 0.410 0.469 0.578 10.613
0.2 10.0 125 0.077 0.683 0.648 0.458 0.470 0.608 10.760
0.2 10.0 150 0.091 0.676 0.768 0.498 0.476 0.641 10.961
0.2 10.0 175 0.101 0.670 0.855 0.522 0.480 0.675 11.196
0.2 10.0 200 0.106 0.663 0.892 0.553 0.483 0.708 11.419
0.2 10.0 225 0.109 0.661 0.925 0.578 0.488 0.748 11.715
0.2 10.0 250 0.114 0.659 0.960 0.594 0.490 0.781 11.960
0.2 10.0 300 0.116 0.662 0.980 0.614 0.500 0.848 12.393
0.2 10.0 400 0.119 0.655 1.000 0.629 0.505 0.959 13.074
0.4 10.0 0 0.000 0.724 0.000 NaN 0.514 0.448 10.156
0.4 10.0 3 0.001 0.730 0.005 0.112 0.523 0.454 10.184
0.4 10.0 6 0.001 0.698 0.012 0.107 0.525 0.531 10.534
0.4 10.0 9 0.009 0.705 0.072 0.124 0.522 0.729 11.432
0.4 10.0 12 0.068 0.715 0.575 0.115 0.538 1.362 14.307
0.4 10.0 15 0.079 0.729 0.668 0.176 0.547 2.007 17.231
0.4 10.0 20 0.088 0.730 0.740 0.251 0.549 2.210 18.162
0.4 10.0 25 0.104 0.726 0.858 0.319 0.561 2.426 19.138
0.4 10.0 30 0.111 0.733 0.920 0.387 0.570 2.575 19.830
0.4 10.0 35 0.113 0.731 0.938 0.401 0.570 2.745 20.606
0.4 10.0 40 0.116 0.729 0.955 0.451 0.582 2.752 20.644
0.4 10.0 50 0.115 0.731 0.965 0.498 0.579 3.087 22.168
0.2 50.0 0 0.016 0.724 0.020 0.106 0.524 0.503 10.266
0.2 50.0 25 0.064 0.709 0.520 0.482 0.455 0.572 10.565
0.2 50.0 50 0.090 0.689 0.760 0.684 0.444 0.707 11.176
0.2 50.0 70 0.103 0.679 0.870 0.777 0.442 0.833 11.773
0.2 50.0 90 0.109 0.680 0.925 0.843 0.448 0.959 12.431
0.2 50.0 110 0.111 0.675 0.945 0.884 0.445 1.074 13.160
0.2 50.0 140 0.115 0.671 0.978 0.907 0.449 1.235 14.294
0.2 50.0 200 0.117 0.676 0.998 0.941 0.453 1.553 16.531
0.4 50.0 0 0.016 0.724 0.032 0.105 0.510 0.448 10.156
0.4 50.0 1 0.017 0.705 0.030 0.110 0.525 0.477 10.288
0.4 50.0 2 0.021 0.702 0.075 0.109 0.519 0.558 10.660
0.4 50.0 3 0.081 0.717 0.612 0.227 0.536 1.443 14.673
0.4 50.0 5 0.093 0.749 0.718 0.481 0.556 2.680 20.302
0.4 50.0 7 0.112 0.745 0.872 0.614 0.565 3.031 21.902
0.4 50.0 9 0.116 0.743 0.940 0.724 0.563 3.292 23.102
0.4 50.0 12 0.116 0.754 0.962 0.817 0.569 3.916 25.942
0.4 50.0 15 0.118 0.751 0.970 0.853 0.564 4.376 28.041
Pconn 0.2, peak 10 ms: (a) 218.0; (b) 75.0 (smallest KS 0.468 at strength 75; next smallest 0.469); (c) nan (largest fraction reached 0.119)
Pconn 0.2, peak 50 ms: (a) 87.3; (b) 70.0 (smallest KS 0.442 at strength 70; next smallest 0.444); (c) nan (largest fraction reached 0.117)
Pconn 0.4, peak 10 ms: (a) 28.2; (b) nan (smallest KS 0.514 at strength 0; next smallest 0.522); (c) nan (largest fraction reached 0.116)
Pconn 0.4, peak 50 ms: (a) 6.6; (b) nan (smallest KS 0.510 at strength 0; next smallest 0.519); (c) nan (largest fraction reached 0.118)
Amplification (inverse of the matched input strength, normalized to Pconn 0.2), touch input:
reading (a): strength 218.0 at Pconn 0.2 and 28.2 at 0.4; amplification at 0.4 = 7.74; strength at 0.4 below that at 0.2: True
interpolated strength at Pconn 0.25: 170.5, amplification 1.28
interpolated strength at Pconn 0.3: 123.1, amplification 1.77
interpolated strength at Pconn 0.35: 75.6, amplification 2.88
interpolated strength at Pconn 0.44: -9.8, not positive
reading (b): strength 75.0 at Pconn 0.2 and nan at 0.4; amplification at 0.4 = nan; strength at 0.4 below that at 0.2: not set
interpolated strength at Pconn 0.25: nan, not positive
interpolated strength at Pconn 0.3: nan, not positive
interpolated strength at Pconn 0.35: nan, not positive
interpolated strength at Pconn 0.44: nan, not positive
reading (c): strength nan at Pconn 0.2 and nan at 0.4; amplification at 0.4 = nan; strength at 0.4 below that at 0.2: not set
interpolated strength at Pconn 0.25: nan, not positive
interpolated strength at Pconn 0.3: nan, not positive
interpolated strength at Pconn 0.35: nan, not positive
interpolated strength at Pconn 0.44: nan, not positive
Ablation runs¶
For each reading whose strengths could be set, 30 networks (seeds 0 to 29) at Pconn 0.2 (the 20 strongest excitatory encoders ablated) and at Pconn 0.4 (0, 10, 20 and 50 ablated, Extended Data Fig. 4), with the touch input; and with the slow input at both Pconn, under (a) the touch input strength and (b) a strength set anew by the same rule from the slow-input sweep.
RUNS = {}
def ckey(pc, s, pk, sizes):
return (pc, round(float(s), 3), pk, tuple(sizes))
conds = []
for rd in ["a", "b", "c"]:
if np.isnan(STR[(rd, 0.2, 10.0)]) or np.isnan(STR[(rd, 0.4, 10.0)]):
print(f"reading ({rd}): no strength, not run")
continue
conds += [ckey(0.2, STR[(rd, 0.2, 10.0)], 10.0, (20,)), ckey(0.4, STR[(rd, 0.4, 10.0)], 10.0, (0, 10, 20, 50))]
for pc in [0.2, 0.4]:
conds += [ckey(pc, STR[(rd, pc, 10.0)], 50.0, (20,))]
if not np.isnan(STR[(rd, pc, 50.0)]):
conds += [ckey(pc, STR[(rd, pc, 50.0)], 50.0, (20,))]
conds = list(dict.fromkeys(conds))
NNET = 30
jobs = [dict(kind="condition", seeds=[sd], pconn=c[0], strength=c[1], peak_ms=c[2], sizes=c[3], run_seed=sd,
with_similarity=(c[2] == 10.0)) for c in conds for sd in range(NNET)]
t0 = time.time()
out = PM.run_jobs(jobs)
for i, c in enumerate(conds):
RUNS[c] = out[NNET * i:NNET * (i + 1)]
print(f"{len(conds)} conditions, {len(jobs)} networks, {sum(1 + sum(s > 0 for s in c[3]) for c in conds) * NNET} runs of 20 s, {time.time() - t0:.0f} s")
for c in conds:
rs = RUNS[c]
print(f" Pconn {c[0]}, strength {c[1]}, peak {c[2]:.0f} ms, sizes {c[3]}: rates before ablation, excitatory {np.mean([d['rate_pre'][:PM.NEXC].mean() for d in rs]):.2f} Hz, "
f"inhibitory {np.mean([d['rate_pre'][PM.NEXC:].mean() for d in rs]):.2f} Hz; fraction of excitatory neurons above 0.1 "
f"{np.mean([np.mean(d['pre'][:PM.NEXC] > 0.1) for d in rs]):.3f}")
def summarize(c, size=20, pop="exc", thresh=0.1):
e = pd.DataFrame(PM.effect(RUNS[c], size, thresh, pop))
e["change"] = e.post - e.pre
p = stats.wilcoxon(e.pre, e.post).pvalue if (e.change != 0).any() else np.nan
return e, p
def report(c, label, size=20):
res = {}
for pop in ["exc", "all"]:
e, p = summarize(c, size, pop)
res[pop] = (e, p)
print(f"{label}, {'all neurons (variant)' if pop == 'all' else 'excitatory only (main)'}: grand median {e.pre.median():.3f} -> {e.post.median():.3f} "
f"(adjusted MAD {P.adj_mad(e.pre):.3f}, {P.adj_mad(e.post):.3f}); signed-rank p = {p:.2g}; networks with an increase "
f"{(e.change > 0).sum()} of {len(e)}; neurons per network {e.n.median():.0f} (range {e.n.min()} to {e.n.max()})")
return res
reading (b): no strength, not run reading (c): no strength, not run
6 conditions, 180 networks, 420 runs of 20 s, 900 s Pconn 0.2, strength 218.0, peak 10 ms, sizes (20,): rates before ablation, excitatory 0.69 Hz, inhibitory 11.46 Hz; fraction of excitatory neurons above 0.1 0.106 Pconn 0.4, strength 28.167, peak 10 ms, sizes (0, 10, 20, 50): rates before ablation, excitatory 2.78 Hz, inhibitory 20.65 Hz; fraction of excitatory neurons above 0.1 0.105 Pconn 0.2, strength 218.0, peak 50 ms, sizes (20,): rates before ablation, excitatory 1.62 Hz, inhibitory 17.05 Hz; fraction of excitatory neurons above 0.1 0.118 Pconn 0.2, strength 87.333, peak 50 ms, sizes (20,): rates before ablation, excitatory 0.89 Hz, inhibitory 12.23 Hz; fraction of excitatory neurons above 0.1 0.106 Pconn 0.4, strength 28.167, peak 50 ms, sizes (20,): rates before ablation, excitatory 6.34 Hz, inhibitory 36.87 Hz; fraction of excitatory neurons above 0.1 0.117 Pconn 0.4, strength 6.606, peak 50 ms, sizes (20,): rates before ablation, excitatory 3.05 Hz, inhibitory 21.89 Hz; fraction of excitatory neurons above 0.1 0.106
model-amplification-increases¶
In the L2/3 network model, the sensory input needed to match in vivo responses declines as subnetwork connectivity rises, so amplification (network output over input, normalized to Pconn 0.2) increases with subnetwork connectivity.
The matched strengths and amplification under each reading are printed in the calibration cell above.
Result: reproduced, resting on assumptions. Under calibration (a) the matched strength is 218.0 at Pconn 0.2 and 28.2 at 0.4, so normalized amplification at 0.4 is 7.74, and the strength at 0.4 is below that at 0.2. Reading (a) is weakly set at Pconn 0.2: the fraction above 0.1 moves only from 0.106 to 0.109 between strengths 200 and 225, with two networks per strength, which bears on how large the amplification is, not on its direction. Reading (b) sets no strength at Pconn 0.4: with the sweep extended down to no input, the smallest KS distance for the touch input is at strength 0 (0.514), and the distance hardly depends on the input (over the whole sweep, 0.514 to 0.582), because 0.66 to 0.75 of the model's excitatory neurons score exactly 0 at every strength while almost no in vivo neuron does (fraction 0.000 to three decimals). At Pconn 0.2 its minimum is at 75 (0.468, with 0.469 and 0.470 at 100 and 125). Reading (c), the fraction 0.17, cannot be met: the largest fraction of excitatory neurons above 0.1 in any sweep is 0.119, as nearly only the 200 input-recipient neurons (11.8% of the excitatory population) reach it. The claim holds under the one reading that sets both strengths. Amplification here is far larger than the paper's Fig. 1c.
model-equal-connectivity-ablation-increases, model-increased-connectivity-ablation-decreases¶
In networks with equal subnetwork connectivity (Pconn 0.2), ablating the strongest encoders raises the encoding scores of spared neurons, from 0.237 to 0.274, owing to reduced feedback inhibition. In networks with increased subnetwork connectivity (Pconn 0.4), ablation lowers the encoding scores of spared neurons, from 0.243 to 0.143, because amplification is reduced.
MODEL = {}
for rd in ["a", "b", "c"]:
if np.isnan(STR[(rd, 0.2, 10.0)]) or np.isnan(STR[(rd, 0.4, 10.0)]):
continue
for pc, sizes in [(0.2, (20,)), (0.4, (0, 10, 20, 50))]:
c = ckey(pc, STR[(rd, pc, 10.0)], 10.0, sizes)
MODEL[(rd, pc)] = report(c, f"reading ({rd}), Pconn {pc}, touch input, 20 ablated")
print("Paper: Pconn 0.2, 0.237 -> 0.274 (P < 0.001); Pconn 0.4, 0.243 -> 0.143 (P < 0.001); n = 30 networks")
e, _ = MODEL[("a", 0.2)]["exc"]
print("\nReading (a), Pconn 0.2, excitatory neurons, per network:")
print(e.round(3).to_string(index=False))
reading (a), Pconn 0.2, touch input, 20 ablated, excitatory only (main): grand median 0.546 -> 0.562 (adjusted MAD 0.012, 0.011); signed-rank p = 1.9e-09; networks with an increase 30 of 30; neurons per network 166 (range 156 to 170)
reading (a), Pconn 0.2, touch input, 20 ablated, all neurons (variant): grand median 0.287 -> 0.279 (adjusted MAD 0.016, 0.015); signed-rank p = 6.3e-05; networks with an increase 4 of 30; neurons per network 415 (range 399 to 446)
reading (a), Pconn 0.4, touch input, 20 ablated, excitatory only (main): grand median 0.356 -> 0.231 (adjusted MAD 0.065, 0.177); signed-rank p = 3.9e-07; networks with an increase 4 of 30; neurons per network 166 (range 105 to 187)
reading (a), Pconn 0.4, touch input, 20 ablated, all neurons (variant): grand median 0.282 -> 0.096 (adjusted MAD 0.080, 0.084); signed-rank p = 1.9e-08; networks with an increase 2 of 30; neurons per network 382 (range 139 to 454)
Paper: Pconn 0.2, 0.237 -> 0.274 (P < 0.001); Pconn 0.4, 0.243 -> 0.143 (P < 0.001); n = 30 networks
Reading (a), Pconn 0.2, excitatory neurons, per network:
seed n pre post net_ablated change
0 164 0.555 0.570 12.941 0.015
1 168 0.540 0.572 12.819 0.032
2 164 0.509 0.555 12.818 0.046
3 165 0.543 0.568 12.929 0.025
4 165 0.563 0.579 12.882 0.015
5 169 0.547 0.556 12.829 0.009
6 166 0.556 0.575 12.948 0.019
7 169 0.543 0.559 12.714 0.016
8 165 0.560 0.570 12.837 0.010
9 166 0.514 0.555 12.933 0.041
10 169 0.561 0.576 12.881 0.015
11 163 0.542 0.552 12.958 0.010
12 163 0.554 0.560 12.914 0.006
13 167 0.562 0.573 12.969 0.012
14 162 0.538 0.553 12.907 0.015
15 163 0.548 0.564 12.945 0.015
16 166 0.540 0.558 12.846 0.018
17 163 0.549 0.569 13.001 0.019
18 170 0.546 0.558 12.852 0.012
19 162 0.573 0.580 12.885 0.008
20 169 0.546 0.574 12.698 0.028
21 168 0.531 0.548 12.958 0.017
22 165 0.533 0.559 12.815 0.025
23 168 0.539 0.562 12.886 0.023
24 169 0.547 0.572 12.876 0.024
25 156 0.552 0.562 13.021 0.011
26 167 0.541 0.560 12.828 0.020
27 168 0.564 0.586 12.864 0.022
28 160 0.538 0.562 12.812 0.025
29 168 0.538 0.561 12.915 0.022
Result: model-equal-connectivity-ablation-increases partially reproduced, resting on assumptions. At Pconn 0.2 under calibration (a), the spared excitatory neurons (above 0.1 before or after, ablated ones left out) go from a grand median of 0.546 to 0.562 (signed-rank p = 1.9e-09, 30 of 30 networks increase), the claimed increase at p < 0.001, with both values far outside 0.237 ± 0.024 and 0.274 ± 0.027. Counting all neurons (variant), the scores fall, 0.287 to 0.279 (p = 6.3e-05, 4 of 30 increase), and 0.287 is outside tolerance. With excitatory neurons the effect is present and the values are not, which is partially reproduced, as for the Pconn 0.4 claim. The scores here run about 2.3 times the paper's, and the rise (+0.016, about 3%) is smaller than the paper's (+0.037, about 16%).
Result: model-increased-connectivity-ablation-decreases partially reproduced, resting on assumptions. At Pconn 0.4 ablation lowers the spared neurons' scores under both populations: 0.356 to 0.231 (excitatory, p = 3.9e-07, 4 of 30 increase) and 0.282 to 0.096 (all neurons, p = 1.9e-08). Neither gives both grand medians within 0.243 ± 0.024 and 0.143 ± 0.014.
model-all-or-none-robust¶
Subnetwork connectivity above 0.4 gives all-or-none responses, a transient input driving the subnetwork into persistent activity, and such networks keep their all-or-none response after ablation of 10% of the subnetwork.
The criterion sets the input at Pconn 0.44 to twice the strength extrapolated from the two matched ones (Methods). The extrapolated strengths are printed in the calibration cell above.
Result: not tested (blocked, methods underspecified). Linear extrapolation of the two matched strengths to Pconn 0.44 gives -9.8 under calibration (a), and readings (b) and (c) set no strength at Pconn 0.4, so twice the extrapolated strength, the input the Methods use in this regime, is not a positive current here. The negative value follows from this attempt's calibration, whose amplification at Pconn 0.4 (7.7) is far above the paper's Fig. 1c. The Methods also give neither the matched strengths nor the strength and length of the reset pulse to the inhibitory population, and the pulse they place 300 ms after each onset falls on the next onset at the 300 ms interval of the claims file. No run was made.
model-more-ablation-larger-decline¶
In the model with Pconn 0.4, ablating more neurons (top 10, 20 or 50 encoders) gives larger declines in encoding score, the change correlating with the net encoding score ablated (R = -0.65).
for rd in ["a", "b", "c"]:
if (rd, 0.4) not in MODEL:
continue
c = ckey(0.4, STR[(rd, 0.4, 10.0)], 10.0, (0, 10, 20, 50))
for pop in ["exc", "all"]:
rows = []
for size in (0, 10, 20, 50):
e, _ = summarize(c, size, pop)
rows.append(e.assign(size=size))
a_ = pd.concat(rows)
med = a_.groupby("size").change.median()
for lab, sub in [("with the 0-ablation networks", a_), ("without them", a_[a_["size"] > 0])]:
sub = sub.dropna(subset=["change"]) # networks with no spared neuron above 0.1 have no median
r_ = stats.pearsonr(sub.net_ablated, sub.change)
print(f"reading ({rd}), {'all neurons (variant)' if pop == 'all' else 'excitatory only (main)'}, {lab}: R = {r_.statistic:+.3f}, p = {r_.pvalue:.2g}, n = {len(sub)}")
print(f" median change by size {med.round(4).to_dict()}; more negative at each larger size: {bool(np.all(np.diff(med.values) < 0))}; "
f"median net score ablated by size {a_.groupby('size').net_ablated.median().round(2).to_dict()}")
print("Paper: R = -0.65, P < 0.01")
reading (a), excitatory only (main), with the 0-ablation networks: R = -0.590, p = 1.3e-12, n = 120
reading (a), excitatory only (main), without them: R = -0.456, p = 6.3e-06, n = 90
median change by size {0: 0.0, 10: -0.0263, 20: -0.1225, 50: -0.2088}; more negative at each larger size: True; median net score ablated by size {0: 0.0, 10: 4.54, 20: 8.81, 50: 20.53}
reading (a), all neurons (variant), with the 0-ablation networks: R = -0.726, p = 6.8e-21, n = 120
reading (a), all neurons (variant), without them: R = -0.558, p = 1.1e-08, n = 90
median change by size {0: 0.0, 10: -0.0778, 20: -0.1242, 50: -0.1854}; more negative at each larger size: True; median net score ablated by size {0: 0.0, 10: 4.54, 20: 8.81, 50: 20.53}
Paper: R = -0.65, P < 0.01
Result: model-more-ablation-larger-decline reproduced, resting on assumptions. Under calibration (a), with excitatory neurons, the median change falls with each larger ablation (0, -0.026, -0.123 and -0.209 for 0, 10, 20 and 50 ablated), and the change correlates with the net score ablated, R = -0.590 with the 0-ablation networks (p = 1.3e-12, n = 120), within -0.65 ± 0.065, and -0.456 without them (p = 6.3e-06). The criterion asks for R within tolerance under one of the two readings and a larger decline at each size, so it is met. With all neurons (variant) R is -0.726 and -0.558, both outside the tolerance. The margin is small: -0.590 is 0.005 inside the bound of -0.585, with fixed seeds. The outcome rests on two choices, the counted population and the inclusion of the 0-ablation networks, which the criterion leaves open; their 30 points sit at (0, 0), as the run after ablation repeats the same noise, and anchor the correlation. Calibration (b) gave the runs of the earlier revision (R = -0.774 and -0.678 with all neurons); with its sweep extended to no input it sets no strength at Pconn 0.4 (calibration cell), so it is not run.
model-slow-input-sensitive¶
Networks with Pconn 0.4 given slower, whisking-like input (peak at 50 ms) are also sensitive to ablation, encoding scores falling from 0.143 to 0.104; with equal subnetwork connectivity (Pconn 0.2) the slow-input representation is not degraded.
for rd in ["a", "b", "c"]:
if np.isnan(STR[(rd, 0.2, 10.0)]) or np.isnan(STR[(rd, 0.4, 10.0)]):
continue
for sl, pkey in [("(a) touch strength", 10.0), ("(b) strength set anew", 50.0)]:
for pc in [0.2, 0.4]:
s = STR[(rd, pc, pkey)]
if np.isnan(s):
print(f"calibration ({rd}), slow input {sl}, Pconn {pc}: no strength")
continue
report(ckey(pc, s, 50.0, (20,)), f"calibration ({rd}), slow input {sl}, Pconn {pc}, strength {s:.1f}")
print("Paper: Pconn 0.4, 0.143 -> 0.104 (P < 0.001, n = 30); Pconn 0.2, not degraded (no number given)")
calibration (a), slow input (a) touch strength, Pconn 0.2, strength 218.0, excitatory only (main): grand median 0.948 -> 0.954 (adjusted MAD 0.001, 0.001); signed-rank p = 1.9e-09; networks with an increase 30 of 30; neurons per network 180 (range 179 to 180) calibration (a), slow input (a) touch strength, Pconn 0.2, strength 218.0, all neurons (variant): grand median 0.873 -> 0.858 (adjusted MAD 0.008, 0.010); signed-rank p = 1.9e-09; networks with an increase 0 of 30; neurons per network 479 (range 476 to 480) calibration (a), slow input (a) touch strength, Pconn 0.4, strength 28.2, excitatory only (main): grand median 0.952 -> 0.947 (adjusted MAD 0.032, 0.027); signed-rank p = 0.16; networks with an increase 12 of 30; neurons per network 180 (range 175 to 191) calibration (a), slow input (a) touch strength, Pconn 0.4, strength 28.2, all neurons (variant): grand median 0.926 -> 0.891 (adjusted MAD 0.027, 0.020); signed-rank p = 6.1e-08; networks with an increase 3 of 30; neurons per network 458 (range 437 to 475) calibration (a), slow input (b) strength set anew, Pconn 0.2, strength 87.3, excitatory only (main): grand median 0.803 -> 0.850 (adjusted MAD 0.018, 0.007); signed-rank p = 1.9e-09; networks with an increase 30 of 30; neurons per network 168 (range 161 to 173) calibration (a), slow input (b) strength set anew, Pconn 0.2, strength 87.3, all neurons (variant): grand median 0.424 -> 0.424 (adjusted MAD 0.012, 0.014); signed-rank p = 0.21; networks with an increase 11 of 30; neurons per network 410 (range 389 to 434) calibration (a), slow input (b) strength set anew, Pconn 0.4, strength 6.6, excitatory only (main): grand median 0.314 -> 0.104 (adjusted MAD 0.231, 0.154); signed-rank p = 3.9e-07; networks with an increase 3 of 30; neurons per network 185 (range 88 to 247) calibration (a), slow input (b) strength set anew, Pconn 0.4, strength 6.6, all neurons (variant): grand median 0.269 -> 0.088 (adjusted MAD 0.205, 0.116); signed-rank p = 3.7e-09; networks with an increase 1 of 30; neurons per network 416 (range 119 to 515) Paper: Pconn 0.4, 0.143 -> 0.104 (P < 0.001, n = 30); Pconn 0.2, not degraded (no number given)
Result: model-slow-input-sensitive partially reproduced, resting on assumptions. With the slow-input strength set anew under calibration (a) (6.6 at Pconn 0.4, 87.3 at 0.2), the score of the excitatory neurons at Pconn 0.4 falls from 0.314 to 0.104 (p = 3.9e-07, 3 of 30 networks increase); the post value is within 0.104 ± 0.010 and the pre value is outside 0.143 ± 0.014. At Pconn 0.2 it rises, 0.803 to 0.850 (p = 1.9e-09, 30 of 30), so it is not degraded, as the claim says. With the touch-input strength (slow reading (a)) the score does not fall at Pconn 0.4 (0.952 to 0.947, p = 0.16). All neurons (variant) give 0.269 to 0.088 at Pconn 0.4 and no change at 0.2 (0.424 to 0.424, p = 0.21) with the strength set anew. No reading gives both grand medians within tolerance, so the effect is present and the values are not. Calibration (b) sets no strength for the slow input at Pconn 0.4 (calibration cell).
model-response-similarity¶
In networks with increased subnetwork connectivity, neurons whose activity is more similar to the mean activity of the ablated neurons lose the most encoding score after ablation; with equal connectivity the relationship is absent.
Neurons with score above 0.25 before or after ablation (ablated neurons left out); per network,
a line through the neurons' change in score against their similarity to the mean rate of the 20
ablated neurons in the run before ablation (Methods), and a line through the means of 0.1-wide
similarity bins as a variant (similarity_slopes of the data analysis).
for rd in ["a", "b", "c"]:
if np.isnan(STR[(rd, 0.2, 10.0)]) or np.isnan(STR[(rd, 0.4, 10.0)]):
continue
for pc, sizes in [(0.2, (20,)), (0.4, (0, 10, 20, 50))]:
rs = RUNS[ckey(pc, STR[(rd, pc, 10.0)], 10.0, sizes)]
for pop in ["exc", "all"]:
sp, sb, n_ = [], [], 0
for d in rs:
m = PM.spared(d, 20, 0.25, pop)
x, y = d["sim"][20][m], (d["post"][20] - d["pre"])[m]
a1, a2, _, n1, _ = P.similarity_slopes(x, y)
sp.append(a1); sb.append(a2); n_ += n1
sp, sb = np.array(sp), np.array(sb)
print(f"reading ({rd}), Pconn {pc}, {'all neurons (variant)' if pop == 'all' else 'excitatory only (main)'}: {n_} neurons; point fit {np.sum(sp < 0)}/{np.sum(~np.isnan(sp))} "
f"negative, median slope {np.nanmedian(sp):+.3f}, sign p = {P.sign_test(sp):.2g}; bin-mean fit {np.sum(sb < 0)}/{np.sum(~np.isnan(sb))} negative, "
f"sign p = {P.sign_test(sb):.2g}")
print("Paper: Pconn 0.4, P < 0.001 (3,466 neurons); Pconn 0.2, P = 0.2 (3,779 neurons); 30 networks each")
print(f"Model section: {(time.time() - t_model) / 60:.1f} min")
reading (a), Pconn 0.2, excitatory only (main): 4327 neurons; point fit 30/30 negative, median slope -0.107, sign p = 1.9e-09; bin-mean fit 30/30 negative, sign p = 1.9e-09 reading (a), Pconn 0.2, all neurons (variant): 7815 neurons; point fit 8/30 negative, median slope +0.014, sign p = 0.016; bin-mean fit 10/30 negative, sign p = 0.099 reading (a), Pconn 0.4, excitatory only (main): 4058 neurons; point fit 11/30 negative, median slope +0.079, sign p = 0.2; bin-mean fit 11/29 negative, sign p = 0.26 reading (a), Pconn 0.4, all neurons (variant): 7078 neurons; point fit 6/30 negative, median slope +0.136, sign p = 0.0014; bin-mean fit 6/30 negative, sign p = 0.0014 Paper: Pconn 0.4, P < 0.001 (3,466 neurons); Pconn 0.2, P = 0.2 (3,779 neurons); 30 networks each Model section: 18.0 min
Result: model-response-similarity not reproduced, resting on assumptions. Under calibration (a), with excitatory neurons, the per-network slopes of the change in score against response similarity are negative at Pconn 0.2 (30 of 30, sign test p = 1.9e-09) and show no dependence at Pconn 0.4 (11 of 30 negative, p = 0.2), the reverse of the claim, which needs negative slopes at 0.4 and none at 0.2. All neurons (variant) give positive slopes at Pconn 0.4 (6 of 30 negative, p = 0.0014) and mostly positive ones at 0.2 (8 of 30 negative, p = 0.016). The bin-mean fit leans the same way. The excitatory counts (4,327 at Pconn 0.2 and 4,058 at 0.4) are nearer the paper's 3,779 and 3,466 than the counts of all neurons (7,815 and 7,078).
What the model section shows¶
The rebuilt network reproduces the direction of the paper's results at increased connectivity (amplification grows with Pconn; ablation lowers scores at Pconn 0.4, more for larger ablations, for touch and for slow input) and, with excitatory neurons counted, the rise in scores at equal connectivity, but not the paper's numbers, nor the response-similarity result. The choices the outcomes rest on are those listed at the top of the section (background PSP, inhibitory PSP, stimulus amplitude, which neurons are counted) and the calibration: (a) is the only reading that sets both matched strengths, as (b)'s smallest distance lies at no input at Pconn 0.4 and (c) cannot be met. Under the calibration the background gives 0.51 Hz and 10.35 Hz without stimulus, as the Methods ask, but at Pconn 0.4 the stimulus raises the excitatory rate to 2.78 Hz. The median score of the excitatory neurons above 0.1 is 0.553 at strength 200 and 0.578 at 225 (calibration sweep, Pconn 0.2), and the grand median of the spared excitatory neurons is 0.546, about 2.3 times the paper's 0.237. A failure here may be a failure of this reimplementation, not of the paper's model.
Summary¶
| Claim | Outcome | Note |
|---|---|---|
| model-amplification-increases | Reproduced (assumed) | Matched strength 218 at Pconn 0.2, 28.2 at 0.4 (calibration a); readings (b) and (c) set no strength at 0.4 |
| model-equal-connectivity-ablation-increases | Partially reproduced (assumed) | Excitatory neurons rise, 0.546 -> 0.562, p = 1.9e-09; values outside tolerance; all neurons fall, 0.287 -> 0.279 |
| model-increased-connectivity-ablation-decreases | Partially reproduced (assumed) | 0.356 -> 0.231 (excitatory), p < 0.001; values outside tolerance |
| model-all-or-none-robust | Blocked | Extrapolated input strength at Pconn 0.44 is negative; reset pulse not specified |
| model-more-ablation-larger-decline | Reproduced (assumed) | Decline grows with size; R = -0.590 with the 0-ablation networks (excitatory), 0.005 inside -0.65 ± 0.065; -0.456 without them; all neurons -0.726 / -0.558 |
| model-slow-input-sensitive | Partially reproduced (assumed) | 0.314 -> 0.104 at Pconn 0.4 (excitatory), no decline at 0.2; pre value outside tolerance |
| model-response-similarity | Not reproduced (assumed) | Excitatory: slopes negative at Pconn 0.2 (p = 1.9e-09), none at 0.4 (p = 0.2); all neurons: positive at 0.4 |
| neurons-per-mouse | Reproduced | 8,126 ± 2,436; all 16 counts equal Extended Data Table 1 |
| representation-sizes | Reproduced | Reading (a), score above 0.1 |
| touch-ablation-size | Partially reproduced | 16.8 ± 12.8 and 5.85%; percentile 79.3 ± 27.1 by the criterion's rank rule (70.3 ± 35.0 by the code's) |
| touch-ablation-reduces-touch | Reproduced | 0.123 -> 0.100, p = 0.004 |
| touch-ablation-touch-count | Reproduced | 932 -> 716, reading (a) |
| touch-ablation-whisking-unchanged | Reproduced | p = 0.820 |
| ablation-size-correlation | Reproduced | R = -0.790 and -0.761 |
| distance-dependence-touch | Reproduced | -0.133 / -0.056, lambda 87 um, reading (a) |
| distance-dependence-whisking-absent | Reproduced | p = 0.164 |
| behaviour-unchanged | Not reproduced | Paired tests find changes after silent and whisking ablations; the paper's P values are rank-sum tests |
| whisking-ablation-size | Partially reproduced | 12.7 ± 5.7; 4.43% against 4 ± 0.4; percentile 75.4 ± 31.8 by the rank rule |
| whisking-ablation-no-effect-touch | Reproduced | p = 0.109 |
| whisking-ablation-no-effect-whisking | Reproduced | p = 0.938 (0.812 with the code's cylinder) |
| silent-ablation-size | Reproduced | 16.3 ± 2.6 |
| silent-ablation-no-effect-touch | Reproduced | p = 0.383 |
| silent-ablation-no-effect-whisking | Reproduced | p = 0.844 |
| ablation-type-specificity | Reproduced | Rank-sum tests |
| response-similarity-example | Not reproduced | Slope -0.393 against -0.44 ± 0.044; -0.433 with the code's trial average |
| response-similarity-touch-ablation | Not reproduced | Sign test p = 0.180 (touch) and 0.039 (whisking) with the Methods trial average; the paper's values come from the code's right-trial average |
| response-similarity-whisking-ablation | Reproduced | p = 1.000 and 0.688 |
| ablation-no-off-target-event-rate | Reproduced | 0.014 Hz before and after, p = 0.055 |
| ablation-success-rate | Reproduced | 0.675 of targets; 300 cells |
| glial-reaction-local | Blocked | Histology not in the data set |
| per-mouse-table | Partially reproduced | 23 of 24 rows with the Methods cylinder; all 24 with the code's |
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 encoding scores, shuffle scores, event rates and trial averages are the authors' own, read from the session files; nothing is recomputed from fluorescence. The Methods cylinder (|dz| < 30 um) is the main reading and the code's signed rule a variant; outcomes are the same under both except per-mouse-table (23 of 24 rows match under the Methods cylinder, 24 of 24 under the code's rule). Touch bursts are merged by an assumed rule (the toolbox method is not public). The paper's ± values are 1.4826 times the mean absolute deviation, not the median absolute deviation the text names. The network model is a reimplementation of the Methods in numpy and numba, with the background PSP, the sign of inhibitory PSPs, the stimulus amplitude and the counted population (excitatory neurons) chosen as stated in its section; its outcomes rest on those choices. The counted population was revised after the second verification round, and the two model outcomes it moves were agreed in a third.
What was found about the data set. All 16 archives (24 ablations) are there and readable; neuron counts and ablated counts equal Extended Data Table 1 in all 24 rows, and the per-ablation score changes match it within 0.005 in 23 of 24 rows under the Methods cylinder (several differ by 0.001 to 0.002; all 24 match with the code's cylinder). The session files come in two MATLAB formats (v5 and v7.3) with no note of it. The data descriptor names no file other than the session structs and the ablation logs; the curation files that say which neurons were ablated, and their two layouts (NYU per-attempt flags, JRC id lists), can only be found through the paper's code, and an250220's curation file lists no attempted neurons. an278937's pre-ablation directory has a sixth subvolume (995 neurons) with no post-ablation counterpart, and an278939's post-silent files lack the trial-averaged dF/F. No file in the archives holds histology. The paper's grand medians for whisking and silent ablations and its behaviour P values follow its code, which differs from what the text and legends describe.