Patel, Kim et al. (2026) from dandiset 001454: calcium imaging in the cued two-bottle choice¶
Paper. Patel RR, Kim KN, Patarino M, et al. (2026). Social isolation recruits amygdala–medial prefrontal cortex projections to escalate alcohol drinking in male mice. Nature Neuroscience. doi:10.1038/s41593-026-02413-x. The claims file was written from the version of record (PMC13633117), its legends, Methods and reporting summary.
Dandiset. DANDI:001454, version 0.260911.2319, the only published version (the paper cites the dandiset without a version; the release notes say this version holds all data used in the publication; the draft has the same assets but can change).
This notebook tests the imaging claims of the cued two-bottle choice (Figs. 3, 5 and 6, Extended
Data Figs. 5, 6 and 8). The patch-clamp claims are in ephys_patel_2026.ipynb, with the full
table of blocked claims. Each claim's section seeds its own generator.
| Claim | Status |
|---|---|
| ed5d-cue-response-modest | tested |
| fig3f-blampfc-distinct-clusters | tested |
| ed5ef-alcohol-water-nonoverlapping | tested |
| fig3h-nonspecific-decoding-85, fig3h-blampfc-decodes-better, ed6b-decoding-above-chance | blocked: too few bouts under the decoding rule (counts below) |
| fig3k-blampfc-response-predicts-bouts | tested |
| fig3ijl-no-other-correlations | tested |
| ed6ij-cue-responses-no-correlation | tested |
| ed6k-bout-duration-not-number | tested |
| fig5b, fig5c, fig5d (housing) | tested |
| fig6c, fig6de, fig6f, fig6gj, fig6k, fig6lm, fig6n, ed8n, ed8op (stimulation) | tested |
| ed9c-coregistered-fraction | blocked: CellReg cannot be run here; the footprints are every ROI (cell before the summary) |
Which population is which. The BLA files do not say whether GCaMP was expressed in all BLA neurons or only in BLA-mPFC projectors (the virus field is empty). Cohorts 9 and 10 hold 10 mice and cohort 16 holds 11, the paper's N for nonspecific BLA (10) and BLA-mPFC (11) imaging; cohort 16 also has fewer ROIs per mouse, as projection-restricted expression would give. Cohorts 9 and 10 are taken as nonspecific BLA and cohort 16 as BLA-mPFC: an assumption, marked on every claim that uses it. The mPFC files (cohort 13b, location "PrL") are the stimulation sessions.
Neurons. The files hold every CNMF-E ROI. The paper's neurons were "visually curated by experimenters blinded to experimental condition; neurons with abnormal morphology or calcium traces were excluded" (Methods), and the curation is not in the dandiset. All ROIs are used.
The z-score. Cohort 9 traces are nonnegative and smooth between transients, so the Methods' z against a 3-s baseline is undefined or biased on them (data check). The BLA claims are judged with cohort 9 left out of that z (reading A, an assumption), and shown with it kept (B) and with a z against the session s.d. (C).
import time
import warnings
import numpy as np
import pandas as pd
from scipy import stats
from scipy.cluster.hierarchy import fcluster, linkage
import patel2026 as P
warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 200, "display.max_columns", 40, "display.max_rows", 200)
t_start = time.time()
print("dandiset", P.DANDISET_ID, "version", P.DANDISET_VERSION)
A = P.assets()
op = A[A.path.str.endswith("behavior+image+ophys.nwb")].reset_index(drop=True)
t0 = time.time()
S = P.parallel(P.load_session, list(op.asset_id), workers=26)
for s, p in zip(S, op.path):
s["path"] = p
s["cohort"] = s["subject"].split("-")[0]
print(f"loaded {len(S)} sessions in {time.time() - t0:.0f} s")
dandiset 001454 version 0.260911.2319
loaded 53 sessions in 58 s
Data check¶
rows = []
for s in S:
L = s["licks"]
rows.append(dict(cohort=s["cohort"], subject=s["subject"], description=s["description"], location=s["location"],
t0=s["t0"], frames=s["n_frames"], minutes=round(s["n_frames"] / s["rate"] / 60, 1), rate=s["rate"], rois=s["n_rois"],
reward_licks=len(L["reward"]), water_licks=len(L["water"]),
last_lick_s=round(max(np.r_[L["reward"], L["water"], 0]), 0), cues=len(s["cue_t"]),
types="".join(map(str, s["cue_type"]))))
T = pd.DataFrame(rows)
print(T.drop(columns="types").to_string())
print("\nimaging rate (Hz):", T.rate.unique(), "; ROI trace unit a.u.; trace start time t0 (s):", T.t0.unique())
print("lick onsets before offsets in every session:",
all(np.all(s["licks"]["reward_end"] >= s["licks"]["reward"]) and np.all(s["licks"]["water_end"] >= s["licks"]["water"]) for s in S))
print("distinct cue time vectors:", len({tuple(s["cue_t"]) for s in S}), "; distinct trial-type sequences:", T.types.nunique())
print(T.groupby("types").subject.apply(lambda x: sorted(set(x))).to_dict())
cohort subject description location t0 frames minutes rate rois reward_licks water_licks last_lick_s cues
0 Cohort10 Cohort10-M2-1 Pre-social isolation - 15% alcohol//water BLA 0.0 39365 65.6 10.0 51 111 38 3688.0 30
1 Cohort10 Cohort10-M2-2 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 31 597 44 3717.0 30
2 Cohort10 Cohort10-M5-1 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 116 267 109 3927.0 30
3 Cohort10 Cohort10-M5-2 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 130 287 17 3848.0 30
4 Cohort13b Cohort13b-M1-1 Pre-social isolation - 15% alcohol//water PrL 0.0 39603 66.0 10.0 15 2 5 2863.0 30
5 Cohort13b Cohort13b-M1-1 Social isolation - 15% alcohol//water PrL 0.0 65535 109.2 10.0 44 1 9 3741.0 30
6 Cohort13b Cohort13b-M1-1 Social isolation - 10% sucrose//water PrL 0.0 43847 73.1 10.0 65 929 13 3629.0 30
7 Cohort13b Cohort13b-M1-2 Pre-social isolation - 15% alcohol//water PrL 0.0 39902 66.5 10.0 77 231 23 3503.0 30
8 Cohort13b Cohort13b-M1-2 Pre-social isolation - 10% sucrose//water PrL 0.0 40717 67.9 10.0 75 1975 35 3838.0 30
9 Cohort13b Cohort13b-M1-2 Social isolation - 15% alcohol//water PrL 0.0 39513 65.9 10.0 56 247 28 3684.0 30
10 Cohort13b Cohort13b-M1-2 Social isolation - 10% sucrose//water PrL 0.0 65535 109.2 10.0 53 2135 3 3840.0 30
11 Cohort13b Cohort13b-M1-3 Pre-social isolation - 15% alcohol//water PrL 0.0 39556 65.9 10.0 126 185 142 3862.0 30
12 Cohort13b Cohort13b-M1-3 Pre-social isolation - 10% sucrose//water PrL 0.0 40505 67.5 10.0 68 1257 175 3852.0 30
13 Cohort13b Cohort13b-M1-3 Social isolation - 15% alcohol//water PrL 0.0 40480 67.5 10.0 59 192 299 3853.0 30
14 Cohort13b Cohort13b-M1-3 Social isolation - 10% sucrose//water PrL 0.0 40597 67.7 10.0 70 1518 59 3865.0 30
15 Cohort13b Cohort13b-M2-1 Pre-social isolation - 15% alcohol//water PrL 0.0 39671 66.1 10.0 62 10 43 3716.0 30
16 Cohort13b Cohort13b-M2-1 Pre-social isolation - 10% sucrose//water PrL 0.0 39570 66.0 10.0 79 993 11 3863.0 30
17 Cohort13b Cohort13b-M2-1 Social isolation - 15% alcohol//water PrL 0.0 41251 68.8 10.0 59 4 187 3856.0 30
18 Cohort13b Cohort13b-M2-1 Social isolation - 10% sucrose//water PrL 0.0 40888 68.1 10.0 72 1891 72 3697.0 30
19 Cohort13b Cohort13b-M2-2 Pre-social isolation - 15% alcohol//water PrL 0.0 39731 66.2 10.0 143 53 115 3812.0 30
20 Cohort13b Cohort13b-M2-2 Pre-social isolation - 10% sucrose//water PrL 0.0 40685 67.8 10.0 147 808 60 3862.0 30
21 Cohort13b Cohort13b-M2-2 Social isolation - 15% alcohol//water PrL 0.0 40121 66.9 10.0 127 14 249 3693.0 30
22 Cohort13b Cohort13b-M2-2 Social isolation - 10% sucrose//water PrL 0.0 40570 67.6 10.0 109 997 48 3865.0 30
23 Cohort13b Cohort13b-M2-3 Pre-social isolation - 15% alcohol//water PrL 0.0 39711 66.2 10.0 124 297 47 3734.0 30
24 Cohort13b Cohort13b-M2-3 Pre-social isolation - 10% sucrose//water PrL 0.0 40121 66.9 10.0 135 1010 53 3845.0 30
25 Cohort13b Cohort13b-M2-3 Social isolation - 15% alcohol//water PrL 0.0 40179 67.0 10.0 66 84 242 3736.0 30
26 Cohort13b Cohort13b-M3-1 Pre-social isolation - 15% alcohol//water PrL 0.0 39497 65.8 10.0 193 128 66 3859.0 30
27 Cohort13b Cohort13b-M3-1 Pre-social isolation - 10% sucrose//water PrL 0.0 40323 67.2 10.0 183 1111 34 3848.0 30
28 Cohort13b Cohort13b-M3-1 Social isolation - 15% alcohol//water PrL 0.0 39551 65.9 10.0 184 352 60 3850.0 30
29 Cohort13b Cohort13b-M3-1 Social isolation - 10% sucrose//water PrL 0.0 39858 66.4 10.0 174 1768 64 3832.0 30
30 Cohort13b Cohort13b-M3-2 Pre-social isolation - 15% alcohol//water PrL 0.0 39616 66.0 10.0 85 69 96 3835.0 30
31 Cohort13b Cohort13b-M3-2 Pre-social isolation - 10% sucrose//water PrL 0.0 40050 66.8 10.0 112 1056 151 3825.0 30
32 Cohort13b Cohort13b-M3-2 Social isolation - 10% sucrose//water PrL 0.0 40570 67.6 10.0 109 2475 11 3856.0 30
33 Cohort13b Cohort13b-M3-2 Social isolation - 15% alcohol//water PrL 0.0 52791 88.0 10.0 74 405 40 3594.0 30
34 Cohort13b Cohort13b-M3-3 Pre-social isolation - 15% alcohol//water PrL 0.0 44791 74.7 10.0 112 7 126 3855.0 30
35 Cohort13b Cohort13b-M3-3 Pre-social isolation - 10% sucrose//water PrL 0.0 39777 66.3 10.0 126 1340 163 3850.0 30
36 Cohort16 Cohort16-M1-2 Pre-social isolation - 15% alcohol//water BLA 0.0 40543 67.6 10.0 25 114 83 3862.0 30
37 Cohort16 Cohort16-M1-3 Pre-social isolation - 15% alcohol//water BLA 0.0 40531 67.6 10.0 9 519 262 3882.0 30
38 Cohort16 Cohort16-M1-4 Pre-social isolation - 15% alcohol//water BLA 0.0 39787 66.3 10.0 29 49 41 3827.0 30
39 Cohort16 Cohort16-M2-1 Pre-social isolation - 15% alcohol//water BLA 0.0 39787 66.3 10.0 29 204 113 2359.0 30
40 Cohort16 Cohort16-M2-2 Pre-social isolation - 15% alcohol//water BLA 0.0 40462 67.4 10.0 81 194 74 3858.0 30
41 Cohort16 Cohort16-M2-3 Pre-social isolation - 15% alcohol//water BLA 0.0 40478 67.5 10.0 46 320 1027 3865.0 30
42 Cohort16 Cohort16-M2-4 Pre-social isolation - 15% alcohol//water BLA 0.0 39743 66.2 10.0 87 311 46 3827.0 30
43 Cohort16 Cohort16-M3-1 Pre-social isolation - 15% alcohol//water BLA 0.0 40666 67.8 10.0 39 76 42 3865.0 30
44 Cohort16 Cohort16-M3-2 Pre-social isolation - 15% alcohol//water BLA 0.0 40692 67.8 10.0 17 350 47 3865.0 30
45 Cohort16 Cohort16-M3-3 Pre-social isolation - 15% alcohol//water BLA 0.0 40370 67.3 10.0 14 658 30 3865.0 30
46 Cohort16 Cohort16-M3-4 Pre-social isolation - 15% alcohol//water BLA 0.0 40370 67.3 10.0 14 552 73 3865.0 30
47 Cohort9 Cohort9-M4-1 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 102 214 38 3727.0 30
48 Cohort9 Cohort9-M4-2 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 139 259 35 3689.0 30
49 Cohort9 Cohort9-M4-3 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 112 126 25 3683.0 30
50 Cohort9 Cohort9-M5-1 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 144 53 95 3806.0 30
51 Cohort9 Cohort9-M5-2 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 146 44 44 3845.0 30
52 Cohort9 Cohort9-M5-3 Pre-social isolation - 15% alcohol//water BLA 0.0 39364 65.6 10.0 142 144 23 3727.0 30
imaging rate (Hz): [10.] ; ROI trace unit a.u.; trace start time t0 (s): [0.]
lick onsets before offsets in every session: True
distinct cue time vectors: 1 ; distinct trial-type sequences: 2
{'313323323133233313133323313233': ['Cohort10-M2-1', 'Cohort10-M2-2', 'Cohort10-M5-1', 'Cohort10-M5-2', 'Cohort9-M4-1', 'Cohort9-M4-2', 'Cohort9-M4-3', 'Cohort9-M5-1', 'Cohort9-M5-2', 'Cohort9-M5-3'], '313324324143234314144423314234': ['Cohort13b-M1-1', 'Cohort13b-M1-2', 'Cohort13b-M1-3', 'Cohort13b-M2-1', 'Cohort13b-M2-2', 'Cohort13b-M2-3', 'Cohort13b-M3-1', 'Cohort13b-M3-2', 'Cohort13b-M3-3', 'Cohort16-M1-2', 'Cohort16-M1-3', 'Cohort16-M1-4', 'Cohort16-M2-1', 'Cohort16-M2-2', 'Cohort16-M2-3', 'Cohort16-M2-4', 'Cohort16-M3-1', 'Cohort16-M3-2', 'Cohort16-M3-3', 'Cohort16-M3-4']}
# The same imaging deposited twice?
import hashlib
hsh = pd.Series([hashlib.md5(s["F"].tobytes()).hexdigest() for s in S])
dup = hsh[hsh.duplicated(keep=False)]
for h in dup.unique():
idx = list(dup[dup == h].index)
print("identical traces:", [S[i]["path"].split("/")[1][4:45] for i in idx])
print("identical lick vectors:", int(pd.Series([hashlib.md5(np.r_[s['licks']['reward'], s['licks']['water']].tobytes()).hexdigest() for s in S]).duplicated().sum()))
# Licks against the cue schedule: share of licks in the 58-s access window (cue onset + 3 s to + 61 s),
# and licks of the bottle that a forced trial does not offer
def schedule_check(s):
cue, L = s["cue_t"], np.r_[s["licks"]["reward"], s["licks"]["water"]]
i = np.searchsorted(cue, L, side="right") - 1
rel = L - cue[np.clip(i, 0, None)]
out = dict(in_access=np.mean((i >= 0) & (rel >= 3) & (rel <= 61)) if len(L) else np.nan,
in_cue=np.mean((i >= 0) & (rel < 3)) if len(L) else np.nan)
for liq, bad in (("water", 2), ("reward", 1)):
x = s["licks"][liq]; j = np.searchsorted(cue, x, side="right") - 1
out[f"{liq}_in_forced_other"] = int(np.sum((j >= 0) & (s["cue_type"][np.clip(j, 0, None)] == bad)))
return out
SC = pd.DataFrame([schedule_check(s) for s in S], index=[s["path"].split("/")[1][4:45] for s in S])
SC["types_match_licks"] = (SC.water_in_forced_other == 0) & (SC.reward_in_forced_other == 0)
# licks of each bottle in forced trials of type 1 and 2: stored coding (1 water, 2 reward) or swapped
def forced_licks(s):
out = {}
for liq in ("reward", "water"):
x = s["licks"][liq]; j = np.searchsorted(s["cue_t"], x, side="right") - 1
ty = s["cue_type"][np.clip(j, 0, None)][j >= 0]
for t_ in (1, 2):
out[f"{liq}_in_type{t_}"] = int((ty == t_).sum())
return out
FL = pd.DataFrame([forced_licks(s) for s in S], index=SC.index)
SC = SC.join(FL)
SC["forced_coding"] = np.where((FL.reward_in_type1 == 0) & (FL.water_in_type2 == 0), "stored",
np.where((FL.reward_in_type2 == 0) & (FL.water_in_type1 == 0), "types 1 and 2 swapped", "mixed"))
print(SC.round(3).to_string())
print("\nforced-trial coding, sessions:", SC.forced_coding.value_counts().to_dict())
identical traces: ['Cohort13b-M2-2_ses-20230218T122550_behavi', 'Cohort13b-M3-2_ses-20230126T144321_behavi']
identical traces: ['Cohort16-M1-4_ses-20230324T165942_behavio', 'Cohort16-M2-1_ses-20230323T100316_behavio']
identical traces: ['Cohort16-M3-3_ses-20230323T132902_behavio', 'Cohort16-M3-4_ses-20230323T150219_behavio']
identical lick vectors: 0
in_access in_cue water_in_forced_other reward_in_forced_other types_match_licks reward_in_type1 reward_in_type2 water_in_type1 water_in_type2 forced_coding
Cohort10-M2-1_ses-20220828T101222_behavio 1.000 0.0 0 0 True 0 18 6 0 stored
Cohort10-M2-2_ses-20220828T114704_behavio 0.995 0.0 0 0 True 0 70 11 0 stored
Cohort10-M5-1_ses-20220828T130518_behavio 0.971 0.0 0 0 True 0 35 11 0 stored
Cohort10-M5-2_ses-20220828T145707_behavio 0.993 0.0 0 0 True 0 46 4 0 stored
Cohort13b-M1-1_ses-20221221T103450_behavi 1.000 0.0 0 0 True 0 0 0 0 stored
Cohort13b-M1-1_ses-20230216T124108_behavi 0.900 0.0 0 0 True 0 1 1 0 stored
Cohort13b-M1-1_ses-20230218T112540_behavi 0.993 0.0 0 0 True 0 273 3 0 stored
Cohort13b-M1-2_ses-20221221T115115_behavi 1.000 0.0 0 0 True 0 103 3 0 stored
Cohort13b-M1-2_ses-20221227T131038_behavi 0.988 0.0 0 0 True 0 293 28 0 stored
Cohort13b-M1-2_ses-20230216T134752_behavi 0.916 0.0 0 0 True 0 36 3 0 stored
Cohort13b-M1-2_ses-20230218T124133_behavi 0.980 0.0 0 0 True 0 163 2 0 stored
Cohort13b-M1-3_ses-20221221T130724_behavi 0.988 0.0 0 0 True 0 80 31 0 stored
Cohort13b-M1-3_ses-20221227T143457_behavi 0.976 0.0 0 0 True 0 111 32 0 stored
Cohort13b-M1-3_ses-20230216T145823_behavi 0.961 0.0 0 0 True 0 57 71 0 stored
Cohort13b-M1-3_ses-20230218T135642_behavi 0.962 0.0 0 0 True 0 342 9 0 stored
Cohort13b-M2-1_ses-20221221T103459_behavi 1.000 0.0 2 0 False 0 0 0 2 types 1 and 2 swapped
Cohort13b-M2-1_ses-20221227T120154_behavi 0.947 0.0 2 233 False 233 0 0 2 types 1 and 2 swapped
Cohort13b-M2-1_ses-20230216T121116_behavi 0.990 0.0 40 0 False 0 0 0 40 types 1 and 2 swapped
Cohort13b-M2-1_ses-20230218T103905_behavi 0.964 0.0 14 234 False 234 0 0 14 types 1 and 2 swapped
Cohort13b-M2-2_ses-20221221T115128_behavi 1.000 0.0 16 1 False 1 0 0 16 types 1 and 2 swapped
Cohort13b-M2-2_ses-20221227T131007_behavi 0.986 0.0 15 127 False 127 0 0 15 types 1 and 2 swapped
Cohort13b-M2-2_ses-20230216T133524_behavi 0.989 0.0 12 0 False 0 0 0 12 types 1 and 2 swapped
Cohort13b-M2-2_ses-20230218T122550_behavi 0.975 0.0 1 69 False 69 0 0 1 types 1 and 2 swapped
Cohort13b-M2-3_ses-20221221T130732_behavi 0.994 0.0 5 31 False 31 0 0 5 types 1 and 2 swapped
Cohort13b-M2-3_ses-20221227T143037_behavi 0.962 0.0 6 333 False 333 0 0 6 types 1 and 2 swapped
Cohort13b-M2-3_ses-20230216T144639_behavi 0.929 0.0 7 28 False 28 0 0 7 types 1 and 2 swapped
Cohort13b-M3-1_ses-20221221T142319_behavi 0.979 0.0 0 0 True 0 0 15 0 stored
Cohort13b-M3-1_ses-20221227T155926_behavi 0.953 0.0 0 0 True 0 174 2 0 stored
Cohort13b-M3-1_ses-20230119T151326_behavi 0.990 0.0 0 0 True 0 57 24 0 stored
Cohort13b-M3-1_ses-20230126T145428_behavi 0.988 0.0 0 0 True 0 246 13 0 stored
Cohort13b-M3-2_ses-20221221T142324_behavi 0.982 0.0 17 10 False 10 0 0 17 types 1 and 2 swapped
Cohort13b-M3-2_ses-20221227T155919_behavi 0.968 0.0 10 226 False 226 0 0 10 types 1 and 2 swapped
Cohort13b-M3-2_ses-20230126T144321_behavi 0.980 0.0 4 453 False 453 0 0 4 types 1 and 2 swapped
Cohort13b-M3-2_ses-20230130T135457_behavi 0.973 0.0 2 87 False 87 0 0 2 types 1 and 2 swapped
Cohort13b-M3-3_ses-20221221T153631_behavi 0.962 0.0 9 5 False 5 0 0 9 types 1 and 2 swapped
Cohort13b-M3-3_ses-20221227T170608_behavi 0.961 0.0 21 191 False 191 0 0 21 types 1 and 2 swapped
Cohort16-M1-2_ses-20230323T115428_behavio 0.939 0.0 0 3 False 3 15 12 0 mixed
Cohort16-M1-3_ses-20230324T153316_behavio 0.962 0.0 3 0 False 0 93 17 3 mixed
Cohort16-M1-4_ses-20230324T165942_behavio 0.978 0.0 0 0 True 0 1 4 0 stored
Cohort16-M2-1_ses-20230323T100316_behavio 0.953 0.0 44 50 False 50 0 0 44 types 1 and 2 swapped
Cohort16-M2-2_ses-20230323T115435_behavio 0.993 0.0 19 77 False 77 0 0 19 types 1 and 2 swapped
Cohort16-M2-3_ses-20230324T153322_behavio 0.954 0.0 215 134 False 134 0 4 215 mixed
Cohort16-M2-4_ses-20230324T165949_behavio 0.994 0.0 15 32 False 32 0 0 15 types 1 and 2 swapped
Cohort16-M3-1_ses-20230324T130302_behavio 0.754 0.0 3 11 False 11 0 0 3 types 1 and 2 swapped
Cohort16-M3-2_ses-20230323T115440_behavio 0.935 0.0 4 76 False 76 0 0 4 types 1 and 2 swapped
Cohort16-M3-3_ses-20230323T132902_behavio 0.945 0.0 5 96 False 96 0 0 5 types 1 and 2 swapped
Cohort16-M3-4_ses-20230323T150219_behavio 0.955 0.0 6 110 False 110 0 0 6 types 1 and 2 swapped
Cohort9-M4-1_ses-20220123T100123_behavior 1.000 0.0 0 0 True 0 86 2 0 stored
Cohort9-M4-2_ses-20220123T111628_behavior 1.000 0.0 0 0 True 0 4 2 0 stored
Cohort9-M4-3_ses-20220123T124108_behavior 1.000 0.0 0 0 True 0 9 5 0 stored
Cohort9-M5-1_ses-20220123T135022_behavior 0.966 0.0 0 0 True 0 3 17 0 stored
Cohort9-M5-2_ses-20220123T150746_behavior 0.989 0.0 0 0 True 0 12 24 0 stored
Cohort9-M5-3_ses-20220123T163320_behavior 0.976 0.0 0 0 True 0 13 4 0 stored
forced-trial coding, sessions: {'stored': 26, 'types 1 and 2 swapped': 24, 'mixed': 3}
Every session carries the same cue times, and one of two trial-type sequences. The licks fall in
the access windows of those cues (in_access near 1, no lick during the 3-s cue), so the cue times are
consistent with the licks. But in many sessions there are licks on the bottle that a forced trial,
by its type, does not offer. In every such mPFC session (cohort 13b) the mismatch is a clean swap:
alcohol or sucrose licks fall only on type-1 trials and water licks only on type-2 trials, as if the
two forced types were coded the other way round (forced_coding). Three cohort-16 sessions are
mixed. A swap of types 1 and 2 says nothing against the choice trials (types 3 and 4), so the
stimulation claims use the types as stored in every session. Whether light was delivered on the
type-4 trials cannot be checked from the files.
Three pairs of sessions hold identical traces with different licks. The next cell asks whose licks the traces follow.
# Clock check: the population response at bout onsets (median over neurons of |mean z, 0 to 3 s|),
# with the true onsets and with onsets shifted by -20 to +20 s
lags = np.arange(-20, 21, 1.0)
def strength(s, onsets):
z = P.event_z(s["F"], onsets, post_s=3.0)
if len(z) == 0:
return np.nan
return float(np.nanmedian(np.abs(np.nanmean(P.window_mean(z), axis=0))))
CK = []
for s in S:
b = P.session_bouts(s); on = b.onset.values[b.isolated.values]
st = np.array([strength(s, on + l) for l in lags])
far = np.nanmedian(st[np.abs(lags) >= 6])
CK.append(dict(session=s["path"].split("/")[1][4:45], bouts=len(on), lag0=st[20], far=far, best_lag=lags[np.nanargmax(st)]))
CK = pd.DataFrame(CK)
CK["aligned"] = (CK.lag0 > CK.far) & (CK.best_lag.between(-2, 5))
print(CK.round(3).to_string())
print("sessions where alignment is shown:", int(CK.aligned.sum()), "of", len(CK))
# duplicated traces: whose licks do they follow?
pairs = [("Cohort16-M1-4", "Cohort16-M2-1"), ("Cohort16-M3-3", "Cohort16-M3-4"),
("Cohort13b-M2-2_ses-20230218", "Cohort13b-M3-2_ses-20230126")]
for a, b_ in pairs:
sa = [s for s in S if a in s["path"]][0]; sb = [s for s in S if b_ in s["path"]][0]
for lab, lk in ((a, sa), (b_, sb)):
bb = P.session_bouts(lk); on = bb.onset.values[bb.isolated.values]
sh = np.nanmedian([strength(sa, on + l) for l in (-15, -10, 10, 15)])
print(f"traces of the pair with the licks of {lab}: {strength(sa, on):.3f} at the true onsets, {sh:.3f} shifted")
session bouts lag0 far best_lag aligned 0 Cohort10-M2-1_ses-20220828T101222_behavio 18 0.254 0.190 1.0 True 1 Cohort10-M2-2_ses-20220828T114704_behavio 32 0.246 0.147 4.0 True 2 Cohort10-M5-1_ses-20220828T130518_behavio 36 0.252 0.169 2.0 True 3 Cohort10-M5-2_ses-20220828T145707_behavio 19 0.276 0.202 1.0 True 4 Cohort13b-M1-1_ses-20221221T103450_behavi 1 0.360 0.808 -4.0 False 5 Cohort13b-M1-1_ses-20230216T124108_behavi 1 0.843 0.769 -12.0 False 6 Cohort13b-M1-1_ses-20230218T112540_behavi 22 0.395 0.265 1.0 True 7 Cohort13b-M1-2_ses-20221221T115115_behavi 13 0.698 0.411 0.0 True 8 Cohort13b-M1-2_ses-20221227T131038_behavi 43 0.495 0.228 1.0 True 9 Cohort13b-M1-2_ses-20230216T134752_behavi 14 0.305 0.237 4.0 True 10 Cohort13b-M1-2_ses-20230218T124133_behavi 33 0.170 0.180 16.0 False 11 Cohort13b-M1-3_ses-20221221T130724_behavi 35 0.285 0.183 3.0 True 12 Cohort13b-M1-3_ses-20221227T143457_behavi 37 0.347 0.200 0.0 True 13 Cohort13b-M1-3_ses-20230216T145823_behavi 19 0.423 0.244 2.0 True 14 Cohort13b-M1-3_ses-20230218T135642_behavi 34 0.244 0.210 1.0 True 15 Cohort13b-M2-1_ses-20221221T103459_behavi 5 0.647 0.617 6.0 False 16 Cohort13b-M2-1_ses-20221227T120154_behavi 25 0.408 0.211 3.0 True 17 Cohort13b-M2-1_ses-20230216T121116_behavi 24 0.137 0.055 8.0 False 18 Cohort13b-M2-1_ses-20230218T103905_behavi 35 0.289 0.229 4.0 True 19 Cohort13b-M2-2_ses-20221221T115128_behavi 16 0.497 0.313 0.0 True 20 Cohort13b-M2-2_ses-20221227T131007_behavi 21 0.392 0.268 -13.0 False 21 Cohort13b-M2-2_ses-20230216T133524_behavi 21 0.416 0.270 -1.0 True 22 Cohort13b-M2-2_ses-20230218T122550_behavi 24 0.437 0.286 1.0 True 23 Cohort13b-M2-3_ses-20221221T130732_behavi 27 0.432 0.280 3.0 True 24 Cohort13b-M2-3_ses-20221227T143037_behavi 41 0.455 0.204 0.0 True 25 Cohort13b-M2-3_ses-20230216T144639_behavi 29 0.467 0.268 0.0 True 26 Cohort13b-M3-1_ses-20221221T142319_behavi 13 0.605 0.409 -1.0 True 27 Cohort13b-M3-1_ses-20221227T155926_behavi 45 0.399 0.227 1.0 True 28 Cohort13b-M3-1_ses-20230119T151326_behavi 22 0.477 0.318 1.0 True 29 Cohort13b-M3-1_ses-20230126T145428_behavi 56 0.252 0.234 1.0 True 30 Cohort13b-M3-2_ses-20221221T142324_behavi 22 0.322 0.279 3.0 True 31 Cohort13b-M3-2_ses-20221227T155919_behavi 56 0.444 0.160 0.0 True 32 Cohort13b-M3-2_ses-20230126T144321_behavi 52 0.215 0.189 18.0 False 33 Cohort13b-M3-2_ses-20230130T135457_behavi 29 0.448 0.245 -1.0 True 34 Cohort13b-M3-3_ses-20221221T153631_behavi 29 0.491 0.243 0.0 True 35 Cohort13b-M3-3_ses-20221227T170608_behavi 51 0.277 0.191 1.0 True 36 Cohort16-M1-2_ses-20230323T115428_behavio 27 0.212 0.146 -6.0 False 37 Cohort16-M1-3_ses-20230324T153316_behavio 45 0.308 0.101 1.0 True 38 Cohort16-M1-4_ses-20230324T165942_behavio 15 0.339 0.195 0.0 True 39 Cohort16-M2-1_ses-20230323T100316_behavio 26 0.239 0.178 -12.0 False 40 Cohort16-M2-2_ses-20230323T115435_behavio 20 0.396 0.221 1.0 True 41 Cohort16-M2-3_ses-20230324T153322_behavio 76 0.503 0.085 1.0 True 42 Cohort16-M2-4_ses-20230324T165949_behavio 25 0.276 0.195 3.0 True 43 Cohort16-M3-1_ses-20230324T130302_behavio 12 0.297 0.259 -10.0 False 44 Cohort16-M3-2_ses-20230323T115440_behavio 18 0.128 0.190 -19.0 False 45 Cohort16-M3-3_ses-20230323T132902_behavio 42 0.374 0.190 3.0 True 46 Cohort16-M3-4_ses-20230323T150219_behavio 44 0.198 0.170 -2.0 True 47 Cohort9-M4-1_ses-20220123T100123_behavior 13 1.692 1.609 3.0 True 48 Cohort9-M4-2_ses-20220123T111628_behavior 15 1.636 1.435 1.0 True 49 Cohort9-M4-3_ses-20220123T124108_behavior 27 1.767 1.422 0.0 True 50 Cohort9-M5-1_ses-20220123T135022_behavior 19 1.506 1.187 13.0 False 51 Cohort9-M5-2_ses-20220123T150746_behavior 13 1.591 1.406 -7.0 False 52 Cohort9-M5-3_ses-20220123T163320_behavior 23 1.774 1.543 2.0 True sessions where alignment is shown: 40 of 53 traces of the pair with the licks of Cohort16-M1-4: 0.339 at the true onsets, 0.191 shifted traces of the pair with the licks of Cohort16-M2-1: 0.239 at the true onsets, 0.163 shifted traces of the pair with the licks of Cohort16-M3-3: 0.374 at the true onsets, 0.200 shifted traces of the pair with the licks of Cohort16-M3-4: 0.198 at the true onsets, 0.166 shifted traces of the pair with the licks of Cohort13b-M2-2_ses-20230218: 0.437 at the true onsets, 0.306 shifted traces of the pair with the licks of Cohort13b-M3-2_ses-20230126: 0.215 at the true onsets, 0.167 shifted
The traces of each identical pair follow the licks of one member: cohort 16 M1-4 (0.339 against 0.191 shifted) and M3-3, and cohort 13b M2-2's isolation sucrose session. The other member's file (cohort 16 M2-1 and M3-4, and cohort 13b M3-2's isolation sucrose session) carries another mouse's imaging and is left out. The clock is shown for the sessions marked aligned above; the others have few bouts or no peak near lag 0, and are named in the summary.
EXCLUDE = ("Cohort16-M2-1_ses", "Cohort16-M3-4_ses", "Cohort13b-M3-2_ses-20230126")
SS = [s for s in S if not any(e in s["path"] for e in EXCLUDE)]
NS = [s for s in SS if s["cohort"] in ("Cohort9", "Cohort10")]
PR = [s for s in SS if s["cohort"] == "Cohort16"]
MP = [s for s in SS if s["cohort"] == "Cohort13b"]
def kind(s):
d = s["description"]
return ("GH" if d.startswith("Pre") else "SI") + "_" + ("alcohol" if "alcohol" in d else "sucrose")
for s in MP:
s["kind"] = kind(s)
NS10 = [s for s in NS if s["cohort"] == "Cohort10"]
SUBJ = {s["subject"]: s for s in SS if s["cohort"] in ("Cohort9", "Cohort10", "Cohort16")}
# Readings of the BLA z-score (M3). A: the Methods' baseline z, with cohort 9 left out, as its
# traces are nonnegative and smooth between transients, where that z is undefined or biased
# (adopted). B: the same z on all mice (the first version of this attempt). C: z against the
# session s.d. on all mice, defined everywhere but on another scale.
BLA_R = {"A": ("baseline z, cohort 9 left out", NS10, "baseline"),
"B": ("baseline z, all mice", NS, "baseline"),
"C": ("session s.d. z, all mice", NS, "session")}
def zmode(m):
P.Z_MODE = m
for lab, grp in (("nonspecific BLA (cohorts 9, 10)", NS), ("nonspecific BLA, cohort 10 only", NS10), ("BLA-mPFC (cohort 16)", PR)):
print(f"{lab}: {len(grp)} mice, {sum(s['n_rois'] for s in grp)} ROIs "
f"(per mouse {[s['n_rois'] for s in grp]}); alcohol licks per mouse {[len(s['licks']['reward']) for s in grp]}")
print("paper: nonspecific 540 neurons from 10 mice, BLA-mPFC 196 from 11")
for k in ("GH_alcohol", "SI_alcohol", "GH_sucrose", "SI_sucrose"):
g = [s for s in MP if s["kind"] == k]
print(f"mPFC {k}: {len(g)} mice, {sum(s['n_rois'] for s in g)} ROIs; reward-bottle licks {[(s['subject'][-4:], len(s['licks']['reward'])) for s in g]}")
print("paper: alcohol 240 neurons from 6 mice (GH), 281 from 5 (SI); sucrose 284 from 7, 343 from 7")
nonspecific BLA (cohorts 9, 10): 10 mice, 1113 ROIs (per mouse [51, 31, 116, 130, 102, 139, 112, 144, 146, 142]); alcohol licks per mouse [111, 597, 267, 287, 214, 259, 126, 53, 44, 144]
nonspecific BLA, cohort 10 only: 4 mice, 328 ROIs (per mouse [51, 31, 116, 130]); alcohol licks per mouse [111, 597, 267, 287]
BLA-mPFC (cohort 16): 9 mice, 347 ROIs (per mouse [25, 9, 29, 81, 46, 87, 39, 17, 14]); alcohol licks per mouse [114, 519, 49, 194, 320, 311, 76, 350, 658]
paper: nonspecific 540 neurons from 10 mice, BLA-mPFC 196 from 11
mPFC GH_alcohol: 9 mice, 937 ROIs; reward-bottle licks [('M1-1', 2), ('M1-2', 231), ('M1-3', 185), ('M2-1', 10), ('M2-2', 53), ('M2-3', 297), ('M3-1', 128), ('M3-2', 69), ('M3-3', 7)]
mPFC SI_alcohol: 8 mice, 669 ROIs; reward-bottle licks [('M1-1', 1), ('M1-2', 247), ('M1-3', 192), ('M2-1', 4), ('M2-2', 14), ('M2-3', 84), ('M3-1', 352), ('M3-2', 405)]
mPFC GH_sucrose: 8 mice, 925 ROIs; reward-bottle licks [('M1-2', 1975), ('M1-3', 1257), ('M2-1', 993), ('M2-2', 808), ('M2-3', 1010), ('M3-1', 1111), ('M3-2', 1056), ('M3-3', 1340)]
mPFC SI_sucrose: 6 mice, 543 ROIs; reward-bottle licks [('M1-1', 929), ('M1-2', 2135), ('M1-3', 1518), ('M2-1', 1891), ('M2-2', 997), ('M3-1', 1768)]
paper: alcohol 240 neurons from 6 mice (GH), 281 from 5 (SI); sucrose 284 from 7, 343 from 7
The rule that mice with fewer than 50 alcohol licks are excluded from calcium analyses (Methods, 2BC drinking) gives exactly the paper's 6 group-housed and 5 isolated mice for the mPFC alcohol sessions, and is applied there. For BLA imaging the paper's N (10 and 11) equals every mouse in the dandiset, although Cohort9-M5-2 (44 licks) and Cohort16-M1-4 (49) are under 50, so the rule is not applied there (shown as a variant where it bears on a correlation). For the sucrose sessions the rule names no session; all mice with a session are used (8 group-housed, where the paper has 7; 6 isolated after the duplicate, where it has 7).
MP_A_GH = [s for s in MP if s["kind"] == "GH_alcohol" and len(s["licks"]["reward"]) >= P.MIN_ALCOHOL_LICKS]
MP_A_SI = [s for s in MP if s["kind"] == "SI_alcohol" and len(s["licks"]["reward"]) >= P.MIN_ALCOHOL_LICKS]
MP_S_GH = [s for s in MP if s["kind"] == "GH_sucrose"]
MP_S_SI = [s for s in MP if s["kind"] == "SI_sucrose"]
for lab, g in (("alcohol GH", MP_A_GH), ("alcohol SI", MP_A_SI), ("sucrose GH", MP_S_GH), ("sucrose SI", MP_S_SI)):
print(lab, [s["subject"] for s in g], sum(s["n_rois"] for s in g), "ROIs")
# isolated bouts and trial types per session
def bout_counts(s):
b = P.session_bouts(s); b = b[b.isolated]
return {f"{liq}_{t}": int(((b.liquid == liq) & (b.trial_type == t)).sum()) for liq in ("reward", "water") for t in (1, 2, 3, 4)}
BC = pd.DataFrame([bout_counts(s) for s in SS], index=[s["path"].split("/")[1][4:45] for s in SS])
print(BC.to_string())
# traces and z baselines by cohort: trace minimum, share of samples exactly 0, bout-neuron pairs
# whose baseline s.d. is 0 or under the floor, and the mean baseline z after onset with and without
# the floor (no floor: only s.d. = 0 undefined)
rows = []
for s in SS:
b = P.session_bouts(s); on = b.onset.values[b.isolated.values]
z = P.event_z(s["F"], on, post_s=3.0)
z0 = P.event_z(s["F"], on, post_s=3.0, sd_floor=0.0)
rows.append(dict(cohort=s["cohort"], trace_min=float(s["F"].min()), share_zero=float(np.mean(s["F"] == 0)),
pairs=z[..., 0].size, nan_floor=int(np.isnan(z[..., 0]).sum()), nan_nofloor=int(np.isnan(z0[..., 0]).sum()),
z03_floor=float(np.nanmean(P.window_mean(z))) if z.size else np.nan,
z03_nofloor_median=float(np.nanmedian(P.window_mean(z0))) if z0.size else np.nan,
z03_nofloor_max=float(np.nanmax(np.abs(P.window_mean(z0)))) if z0.size else np.nan))
ZD = pd.DataFrame(rows)
g = ZD.groupby("cohort")
print(pd.DataFrame({"sessions": g.size(), "trace min (range)": g.trace_min.agg(lambda x: f"{x.min():.2f} to {x.max():.2f}"),
"share of zero samples (max)": g.share_zero.max().round(3),
"pairs undefined, floor": (g.nan_floor.sum() / g.pairs.sum()).round(3),
"pairs undefined, no floor": (g.nan_nofloor.sum() / g.pairs.sum()).round(3),
"mean z 0-3 s, floor": g.z03_floor.mean().round(3),
"median z 0-3 s, no floor": g.z03_nofloor_median.median().round(3),
"largest |z|, no floor": g.z03_nofloor_max.max().map(lambda v: f"{v:.3g}")}).to_string())
print(f"all sessions: bout-neuron pairs with a baseline s.d. under {P.SD_FLOOR} of the session s.d.: {ZD.nan_floor.sum()} of {ZD.pairs.sum()} ({ZD.nan_floor.sum() / ZD.pairs.sum():.1%})")
# synthetic check: sparse nonnegative traces, transients at random times, z at random onsets (true value 0)
rs = np.random.default_rng(7)
Fsyn = np.zeros((36000, 50), np.float32)
for j in range(50):
for t_ in rs.choice(36000 - 100, 60, replace=False):
Fsyn[t_:t_ + 100, j] += np.exp(-np.arange(100) / 15.0) * rs.uniform(1, 3)
ons = rs.uniform(10, 3590, 200)
for lab, kw in (("baseline z, floor", {}), ("session s.d. z", {"sd_mode": "session"})):
zs = P.event_z(Fsyn, ons, post_s=3.0, **kw)
print(f"synthetic sparse traces, {lab}: mean z 0-3 s {np.nanmean(P.window_mean(zs)):.3f}, undefined {np.isnan(zs[..., 0]).mean():.0%}")
# cohort 13b: the sessions that lose pairs to the floor, and their ROIs whose trace is constant
for s, r in zip(SS, rows):
if s["cohort"] == "Cohort13b" and r["nan_floor"]:
print(f"{s['path'].split('/')[1][4:45]}: {r['nan_floor']} of {r['pairs']} pairs undefined; "
f"ROIs with a constant trace {int((np.ptp(s['F'], axis=0) == 0).sum())} of {s['n_rois']}")
# single licks (not in a bout) inside the 3-s baseline of an isolated bout; M2 isolates bouts from bouts only
nb_ = ns_ = 0
for s in SS:
b = P.session_bouts(s); on = b.onset.values[b.isolated.values]
L = np.sort(np.r_[s["licks"]["reward"], s["licks"]["water"]])
hit = np.searchsorted(L, on, side="left") - np.searchsorted(L, on - P.BASELINE_S, side="left")
nb_ += len(on); ns_ += int((hit > 0).sum())
print(f"isolated bouts with a single lick in the 3-s baseline: {ns_} of {nb_} ({ns_ / nb_:.1%})")
alcohol GH ['Cohort13b-M1-2', 'Cohort13b-M1-3', 'Cohort13b-M2-2', 'Cohort13b-M2-3', 'Cohort13b-M3-1', 'Cohort13b-M3-2'] 748 ROIs
alcohol SI ['Cohort13b-M1-2', 'Cohort13b-M1-3', 'Cohort13b-M2-3', 'Cohort13b-M3-1', 'Cohort13b-M3-2'] 439 ROIs
sucrose GH ['Cohort13b-M1-2', 'Cohort13b-M1-3', 'Cohort13b-M2-1', 'Cohort13b-M2-2', 'Cohort13b-M2-3', 'Cohort13b-M3-1', 'Cohort13b-M3-2', 'Cohort13b-M3-3'] 925 ROIs
sucrose SI ['Cohort13b-M1-1', 'Cohort13b-M1-2', 'Cohort13b-M1-3', 'Cohort13b-M2-1', 'Cohort13b-M2-2', 'Cohort13b-M3-1'] 543 ROIs
reward_1 reward_2 reward_3 reward_4 water_1 water_2 water_3 water_4
Cohort10-M2-1_ses-20220828T101222_behavio 0 1 6 0 2 0 9 0
Cohort10-M2-2_ses-20220828T114704_behavio 0 3 19 0 4 0 6 0
Cohort10-M5-1_ses-20220828T130518_behavio 0 2 12 0 3 0 19 0
Cohort10-M5-2_ses-20220828T145707_behavio 0 2 13 0 1 0 3 0
Cohort13b-M1-1_ses-20221221T103450_behavi 0 0 0 0 0 0 0 1
Cohort13b-M1-1_ses-20230216T124108_behavi 0 0 0 0 0 0 1 0
Cohort13b-M1-1_ses-20230218T112540_behavi 0 7 4 9 1 0 0 1
Cohort13b-M1-2_ses-20221221T115115_behavi 0 3 6 1 1 0 0 2
Cohort13b-M1-2_ses-20221227T131038_behavi 0 9 21 11 1 0 0 1
Cohort13b-M1-2_ses-20230216T134752_behavi 0 2 2 6 1 0 3 0
Cohort13b-M1-2_ses-20230218T124133_behavi 0 3 19 11 0 0 0 0
Cohort13b-M1-3_ses-20221221T130724_behavi 0 3 5 7 4 0 11 5
Cohort13b-M1-3_ses-20221227T143457_behavi 0 2 10 4 4 0 6 11
Cohort13b-M1-3_ses-20230216T145823_behavi 0 1 0 4 2 0 7 5
Cohort13b-M1-3_ses-20230218T135642_behavi 0 8 8 11 1 0 3 3
Cohort13b-M2-1_ses-20221221T103459_behavi 0 0 0 2 0 0 3 0
Cohort13b-M2-1_ses-20221227T120154_behavi 5 0 11 8 0 0 0 1
Cohort13b-M2-1_ses-20230216T121116_behavi 0 0 0 1 0 8 6 9
Cohort13b-M2-1_ses-20230218T103905_behavi 1 0 9 8 0 2 9 6
Cohort13b-M2-2_ses-20221221T115128_behavi 0 0 3 0 0 3 2 8
Cohort13b-M2-2_ses-20221227T131007_behavi 2 0 5 2 0 3 5 4
Cohort13b-M2-2_ses-20230216T133524_behavi 0 0 3 1 0 3 8 6
Cohort13b-M2-2_ses-20230218T122550_behavi 3 0 8 8 0 0 3 2
Cohort13b-M2-3_ses-20221221T130732_behavi 4 0 9 8 0 1 2 3
Cohort13b-M2-3_ses-20221227T143037_behavi 11 0 15 5 0 1 5 4
Cohort13b-M2-3_ses-20230216T144639_behavi 3 0 7 4 0 2 9 4
Cohort13b-M3-1_ses-20221221T142319_behavi 0 0 4 1 2 0 4 2
Cohort13b-M3-1_ses-20221227T155926_behavi 0 7 16 15 1 0 3 3
Cohort13b-M3-1_ses-20230119T151326_behavi 0 2 6 5 2 0 1 6
Cohort13b-M3-1_ses-20230126T145428_behavi 0 8 19 16 2 0 6 5
Cohort13b-M3-2_ses-20221221T142324_behavi 1 0 4 2 0 3 4 8
Cohort13b-M3-2_ses-20221227T155919_behavi 4 0 18 16 0 2 12 4
Cohort13b-M3-2_ses-20230130T135457_behavi 4 0 11 9 0 0 2 3
Cohort13b-M3-3_ses-20221221T153631_behavi 1 0 0 0 0 3 12 13
Cohort13b-M3-3_ses-20221227T170608_behavi 5 0 10 8 0 5 13 10
Cohort16-M1-2_ses-20230323T115428_behavio 0 1 5 6 4 0 2 9
Cohort16-M1-3_ses-20230324T153316_behavio 0 3 9 10 4 1 13 5
Cohort16-M1-4_ses-20230324T165942_behavio 0 0 6 2 1 0 4 2
Cohort16-M2-2_ses-20230323T115435_behavio 2 0 3 4 0 2 6 3
Cohort16-M2-3_ses-20230324T153322_behavio 5 0 4 7 1 14 29 16
Cohort16-M2-4_ses-20230324T165949_behavio 2 0 7 6 0 3 2 5
Cohort16-M3-1_ses-20230324T130302_behavio 0 0 2 1 0 1 7 1
Cohort16-M3-2_ses-20230323T115440_behavio 3 0 8 2 0 0 4 1
Cohort16-M3-3_ses-20230323T132902_behavio 6 0 16 15 0 0 4 1
Cohort9-M4-1_ses-20220123T100123_behavior 0 2 5 0 0 0 6 0
Cohort9-M4-2_ses-20220123T111628_behavior 0 1 7 0 0 0 7 0
Cohort9-M4-3_ses-20220123T124108_behavior 0 4 18 0 1 0 4 0
Cohort9-M5-1_ses-20220123T135022_behavior 0 1 3 0 4 0 11 0
Cohort9-M5-2_ses-20220123T150746_behavior 0 1 6 0 2 0 4 0
Cohort9-M5-3_ses-20220123T163320_behavior 0 1 20 0 0 0 2 0
sessions trace min (range) share of zero samples (max) pairs undefined, floor pairs undefined, no floor mean z 0-3 s, floor median z 0-3 s, no floor largest |z|, no floor cohort Cohort10 4 -4.22 to -2.92 0.000 0.000 0.000 -0.049 -0.150 24.8 Cohort13b 31 -6.14 to -0.03 0.000 0.013 0.002 0.049 -0.100 1.44e+06 Cohort16 9 -5.04 to -2.53 0.000 0.011 0.000 0.001 -0.064 34.7 Cohort9 6 0.00 to 0.00 0.074 0.617 0.034 -0.859 -3.073 1.43e+20 all sessions: bout-neuron pairs with a baseline s.d. under 0.05 of the session s.d.: 10132 of 123908 (8.2%) synthetic sparse traces, baseline z, floor: mean z 0-3 s -0.580, undefined 87% synthetic sparse traces, session s.d. z: mean z 0-3 s -0.008, undefined 0% Cohort13b-M1-1_ses-20230218T112540_behavi: 2 of 1430 pairs undefined; ROIs with a constant trace 0 of 65 Cohort13b-M1-2_ses-20221221T115115_behavi: 2 of 1001 pairs undefined; ROIs with a constant trace 0 of 77 Cohort13b-M1-2_ses-20221227T131038_behavi: 4 of 3225 pairs undefined; ROIs with a constant trace 0 of 75 Cohort13b-M1-2_ses-20230216T134752_behavi: 184 of 784 pairs undefined; ROIs with a constant trace 0 of 56 Cohort13b-M1-2_ses-20230218T124133_behavi: 6 of 1749 pairs undefined; ROIs with a constant trace 0 of 53 Cohort13b-M1-3_ses-20221221T130724_behavi: 1 of 4410 pairs undefined; ROIs with a constant trace 0 of 126 Cohort13b-M2-1_ses-20230216T121116_behavi: 682 of 1416 pairs undefined; ROIs with a constant trace 0 of 59 Cohort13b-M2-2_ses-20221221T115128_behavi: 1 of 2288 pairs undefined; ROIs with a constant trace 0 of 143 Cohort13b-M2-3_ses-20221221T130732_behavi: 1 of 3348 pairs undefined; ROIs with a constant trace 0 of 124 Cohort13b-M2-3_ses-20221227T143037_behavi: 12 of 5535 pairs undefined; ROIs with a constant trace 0 of 135 Cohort13b-M2-3_ses-20230216T144639_behavi: 190 of 1914 pairs undefined; ROIs with a constant trace 0 of 66 Cohort13b-M3-1_ses-20221227T155926_behavi: 4 of 8235 pairs undefined; ROIs with a constant trace 0 of 183 Cohort13b-M3-1_ses-20230119T151326_behavi: 11 of 4048 pairs undefined; ROIs with a constant trace 0 of 184 Cohort13b-M3-1_ses-20230126T145428_behavi: 68 of 9744 pairs undefined; ROIs with a constant trace 0 of 174 Cohort13b-M3-3_ses-20221227T170608_behavi: 8 of 6426 pairs undefined; ROIs with a constant trace 0 of 126 isolated bouts with a single lick in the 3-s baseline: 101 of 1338 (7.5%)
The z-score on cohort 9. Cohort 9 traces are nonnegative (minimum exactly 0, up to 7% of samples at 0) and smooth between transients, so the s.d. of a 3-s baseline is a small fraction of the session s.d. in most bouts. The Methods' z divides by that baseline s.d.: without a floor, z reaches values of order 1e20 (3% of the pairs have a baseline s.d. of exactly 0); with the floor of 5% of the session s.d., 62% of cohort 9's bout-neuron pairs are undefined, and the ones kept are mostly baselines that hold the decay of an earlier transient, so z is biased downward (mean z after onset -0.86 in cohort 9 against about 0 elsewhere; the synthetic sparse traces above give about -0.6 where the true value is 0). The other cohorts take negative values, have no zero samples, and lose at most 1.3% of pairs to the floor. Three readings are therefore shown for the BLA claims: A, the Methods' baseline z with cohort 9 left out (the nonspecific population is then the 4 cohort-10 mice), adopted as the one on which the paper's z is defined; B, the same z on all mice (the first version of this attempt); C, z against the neuron's s.d. over the session, defined on every trace but on another scale than the Methods' z, so that the 0.5 and 1.98 thresholds mean less. The mPFC claims use the baseline z with the floor (cohort 13b loses 1.3% of its pairs, 1056 of the 1176 in three sessions recorded on 16 February 2023, one of which loses 682 of 1416; no ROI in the sessions that lose pairs has a constant trace).
ed5d-cue-response-modest¶
Both BLA populations respond to the cue with a modest, transient increase below 0.5 z-score.
Criterion: cue-onset z-scores per M3 with cue onset in place of bout onset, baselines 3 s and 5 s; reproduced, under both readings, when the population mean trace of each population peaks above 0 and below 0.5 within 3 s of cue onset and falls back toward 0 by the end of the 3-s cue. All 30 cues are used (the claim names no trial subset). "Falls back toward 0" is read as the trace at 3 s being at most half its peak (a choice of this attempt; the first version read it as below the peak, which a trace still rising at 2.9 s meets). Each of the three z readings (A adopted; B and C variants, see the data check) is shown.
def cue_trace(grp, pre):
tr = [np.nanmean(P.event_z(s["F"], s["cue_t"], pre_s=pre, post_s=5.0), axis=0) for s in grp] # neurons x frames
return np.concatenate(tr, axis=0)
ED5D = {}
for rd, (rname, nsg, mode) in BLA_R.items():
zmode(mode)
for pre in (3.0, 5.0):
for lab, grp in (("nonspecific", nsg), ("BLA-mPFC", PR)):
tr = cue_trace(grp, pre)
m = np.nanmean(tr, axis=0)
t = (np.arange(m.size) - int(pre * 10)) / 10
w = (t >= 0) & (t <= 3)
pk = np.nanmax(m[w]); tpk = t[w][np.nanargmax(m[w])]
end = m[np.argmin(np.abs(t - 3.0))]
ED5D[(rd, pre, lab)] = (pk, tpk, end)
print(f"{rd} {rname}, baseline {pre:.0f} s, {lab}: {tr.shape[0]} neurons from {len(grp)} mice; mean z peak {pk:.3f} at {tpk:.1f} s, "
f"at 3 s {end:.3f} ({end / pk if pk > 0 else np.nan:.0%} of the peak), mean 0-3 s {np.nanmean(m[w]):.3f}; trace range {np.nanmin(m):.3f} to {np.nanmax(m):.3f}")
if pre == 3.0:
per = [np.nanmax(np.nanmean(np.nanmean(P.event_z(s['F'], s['cue_t'], pre_s=pre, post_s=5.0), axis=0), axis=0)[30:61]) for s in grp]
print(" peak 0-3 s by mouse:", np.round(per, 3).tolist())
zmode("baseline")
A baseline z, cohort 9 left out, baseline 3 s, nonspecific: 328 neurons from 4 mice; mean z peak 0.031 at 2.7 s, at 3 s 0.026 (85% of the peak), mean 0-3 s -0.014; trace range -0.058 to 0.095
peak 0-3 s by mouse: [0.0820000022649765, -0.003000000026077032, 0.02199999988079071, 0.06800000369548798]
A baseline z, cohort 9 left out, baseline 3 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.106 at 2.9 s, at 3 s 0.103 (98% of the peak), mean 0-3 s 0.032; trace range -0.059 to 0.129
peak 0-3 s by mouse: [0.6520000100135803, 0.45399999618530273, 0.08299999684095383, -0.0729999989271164, 0.22499999403953552, 0.12800000607967377, 0.07800000160932541, 0.08699999749660492, 0.4189999997615814]
A baseline z, cohort 9 left out, baseline 5 s, nonspecific: 328 neurons from 4 mice; mean z peak 0.045 at 2.7 s, at 3 s 0.042 (92% of the peak), mean 0-3 s -0.004; trace range -0.060 to 0.108
A baseline z, cohort 9 left out, baseline 5 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.118 at 2.9 s, at 3 s 0.117 (99% of the peak), mean 0-3 s 0.043; trace range -0.058 to 0.138
B baseline z, all mice, baseline 3 s, nonspecific: 1113 neurons from 10 mice; mean z peak -0.520 at 0.6 s, at 3 s -0.772 (nan% of the peak), mean 0-3 s -0.612; trace range -0.914 to 0.599
peak 0-3 s by mouse: [0.0820000022649765, -0.003000000026077032, 0.02199999988079071, 0.06800000369548798, -0.6330000162124634, -0.8690000176429749, -0.7070000171661377, -0.2939999997615814, -0.6549999713897705, -0.7599999904632568]
B baseline z, all mice, baseline 3 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.106 at 2.9 s, at 3 s 0.103 (98% of the peak), mean 0-3 s 0.032; trace range -0.059 to 0.129
peak 0-3 s by mouse: [0.6520000100135803, 0.45399999618530273, 0.08299999684095383, -0.0729999989271164, 0.22499999403953552, 0.12800000607967377, 0.07800000160932541, 0.08699999749660492, 0.4189999997615814]
B baseline z, all mice, baseline 5 s, nonspecific: 1113 neurons from 10 mice; mean z peak -0.412 at 1.5 s, at 3 s -0.449 (nan% of the peak), mean 0-3 s -0.437; trace range -0.490 to 0.593
B baseline z, all mice, baseline 5 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.118 at 2.9 s, at 3 s 0.117 (99% of the peak), mean 0-3 s 0.043; trace range -0.058 to 0.138
C session s.d. z, all mice, baseline 3 s, nonspecific: 1113 neurons from 10 mice; mean z peak 0.016 at 1.9 s, at 3 s 0.014 (87% of the peak), mean 0-3 s 0.010; trace range -0.004 to 0.017
peak 0-3 s by mouse: [0.02800000086426735, 0.010999999940395355, 0.02199999988079071, 0.01600000075995922, 0.004999999888241291, 0.00800000037997961, 0.06499999761581421, 0.017999999225139618, 0.03999999910593033, 0.032999999821186066]
C session s.d. z, all mice, baseline 3 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.008 at 1.9 s, at 3 s -0.000 (-3% of the peak), mean 0-3 s -0.001; trace range -0.010 to 0.008
peak 0-3 s by mouse: [0.1469999998807907, 0.11500000208616257, 0.017000000923871994, -0.010999999940395355, 0.017999999225139618, 0.03099999949336052, 0.019999999552965164, 0.019999999552965164, 0.04399999976158142]
C session s.d. z, all mice, baseline 5 s, nonspecific: 1113 neurons from 10 mice; mean z peak 0.013 at 1.9 s, at 3 s 0.011 (85% of the peak), mean 0-3 s 0.008; trace range -0.006 to 0.015
C session s.d. z, all mice, baseline 5 s, BLA-mPFC: 347 neurons from 9 mice; mean z peak 0.011 at 1.9 s, at 3 s 0.003 (23% of the peak), mean 0-3 s 0.002; trace range -0.011 to 0.011
Result: not reproduced, resting on the assignment of cohorts to populations and on reading "falls back toward 0" as the trace at 3 s being at most half its peak. Under the adopted reading A (the Methods' baseline z, cohort 9 left out) neither mean trace is transient: nonspecific BLA (cohort 10, 4 mice) peaks at 0.031 at 2.7 s and is still at 85% of its peak at 3 s (5-s baseline 0.045, 92%), BLA-mPFC peaks at 0.106 at 2.9 s and is at 98% at 3 s (5-s baseline 0.118, 99%). Both peaks are above 0 and below 0.5, but the traces rise through the cue. Under reading B (all mice) the nonspecific trace is negative after the cue (largest value within 3 s -0.520 and -0.412), from the six cohort-9 mice (peaks -0.87 to -0.29). Under reading C (session s.d.) the BLA-mPFC trace falls back (peak 0.008 at 1.9 s, -3% at 3 s; 23% with the 5-s baseline) but the nonspecific trace does not (87% and 85%). No reading gives the transient increase in both populations. Under the first version's looser reading of "falls back" (the trace at 3 s below its peak) reading A would pass both populations (0.026 < 0.031 and 0.103 < 0.106 with the 3-s baseline); the stricter reading is kept because both peaks fall at 2.7 to 2.9 s, at the end of the cue, so the traces do not fall back within it.**
fig3f-blampfc-distinct-clusters¶
Hierarchical clustering of alcohol responses gives several functional clusters, and BLA-mPFC neurons distribute across them differently from nonspecific BLA neurons.
Criterion: one clustering of both populations pooled; Ward linkage, Euclidean distance on each neuron's mean alcohol z trace (M3), cut at the highest linkage giving at least one nonresponsive cluster (a cluster whose mean trace stays within ±1.98 after onset); trace spans -3 to +5 s and 0 to +3 s; chi-square of population by cluster, p < 0.05 under both spans. Mean traces use alcohol and water bouts matched per session (M3 reading a, random); neurons without a defined trace (no isolated alcohol bout) are left out.
def alcohol_water_traces(grp, rng, how="random"):
out = {"reward": [], "water": [], "mouse": [], "n": []}
for s in grp:
b = P.session_bouts(s)
tr, m, _ = P.condition_traces(s, b, {"reward": (b.liquid == "reward").values, "water": (b.liquid == "water").values}, rng, how)
out["reward"].append(tr["reward"]); out["water"].append(tr["water"])
out["mouse"] += [s["subject"]] * s["n_rois"]; out["n"].append(m)
return {k: (np.concatenate(v) if k in ("reward", "water") else v) for k, v in out.items()}
TR, TRb = {}, {}
for rd, (rname, nsg, mode) in BLA_R.items():
zmode(mode)
rng = np.random.default_rng(31)
TR[rd] = {lab: alcohol_water_traces(g, rng) for lab, g in (("nonspecific", nsg), ("BLA-mPFC", PR))}
rng = np.random.default_rng(55)
TRb[rd] = {lab: alcohol_water_traces(g, rng, how="first") for lab, g in (("nonspecific", nsg), ("BLA-mPFC", PR))}
zmode("baseline")
for lab in TR["B"]:
print(lab, "matched alcohol/water bouts per mouse:", dict(zip([s["subject"] for s in (NS if lab == "nonspecific" else PR)], TR["B"][lab]["n"])))
nonspecific matched alcohol/water bouts per mouse: {'Cohort10-M2-1': 7, 'Cohort10-M2-2': 10, 'Cohort10-M5-1': 14, 'Cohort10-M5-2': 4, 'Cohort9-M4-1': 6, 'Cohort9-M4-2': 7, 'Cohort9-M4-3': 5, 'Cohort9-M5-1': 4, 'Cohort9-M5-2': 6, 'Cohort9-M5-3': 2}
BLA-mPFC matched alcohol/water bouts per mouse: {'Cohort16-M1-2': 12, 'Cohort16-M1-3': 22, 'Cohort16-M1-4': 7, 'Cohort16-M2-2': 9, 'Cohort16-M2-3': 16, 'Cohort16-M2-4': 10, 'Cohort16-M3-1': 3, 'Cohort16-M3-2': 5, 'Cohort16-M3-3': 5}
def cluster_test(span, rd):
T_ = TR[rd]
X = np.concatenate([T_["nonspecific"]["reward"], T_["BLA-mPFC"]["reward"]])
pop = np.array(["nonspecific"] * len(T_["nonspecific"]["reward"]) + ["BLA-mPFC"] * len(T_["BLA-mPFC"]["reward"]))
coh = np.array([m.split("-")[0] for m in T_["nonspecific"]["mouse"] + T_["BLA-mPFC"]["mouse"]])
t = (np.arange(X.shape[1]) - 30) / 10
cols = (t >= -3) & (t < 5) if span == "-3 to 5 s" else (t >= 0) & (t < 3)
keep = np.all(np.isfinite(X[:, cols]), axis=1)
Xk, popk = X[keep][:, cols], pop[keep]
Z = linkage(Xk, method="ward", metric="euclidean")
after = t[cols] >= 0
for k in range(2, 60):
lab = fcluster(Z, k, criterion="maxclust")
nonresp = [c for c in np.unique(lab) if np.all(np.abs(Xk[lab == c].mean(0)[after]) < P.Z_THRESHOLD)]
if nonresp:
break
tab = pd.crosstab(lab, popk)
if tab.shape[0] < 2:
print(f"{rd} {BLA_R[rd][0]}, span {span}: one cluster, no test"); return np.nan
chi = stats.chi2_contingency(tab)
exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum()
enrich = (tab.values - exp) / exp * 100
print(f"{rd} {BLA_R[rd][0]}, span {span}: {keep.sum()} of {len(X)} neurons clustered; first cut with a nonresponsive cluster: {k} clusters (nonresponsive {nonresp})")
print(tab.assign(**{f"enrich_{c}_%": np.round(enrich[:, i], 1) for i, c in enumerate(tab.columns)}).to_string())
print(" ROIs per cluster by cohort:", pd.crosstab(lab, coh[keep]).to_dict("index"))
print(" cluster mean trace after onset, range:", {c: f"{Xk[lab == c].mean(0)[after].min():.2f} to {Xk[lab == c].mean(0)[after].max():.2f}" for c in np.unique(lab)})
print(f" chi-square({chi.dof}) = {chi.statistic:.2f}, p = {chi.pvalue:.3g}")
return chi.pvalue
FIG3F = {(rd, span): cluster_test(span, rd) for rd in BLA_R for span in ("-3 to 5 s", "0 to 3 s")}
A baseline z, cohort 9 left out, span -3 to 5 s: 675 of 675 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(1), np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 249 238 -0.5 0.6
2 98 90 1.4 -1.5
ROIs per cluster by cohort: {1: {'Cohort10': 238, 'Cohort16': 249}, 2: {'Cohort10': 90, 'Cohort16': 98}}
cluster mean trace after onset, range: {np.int32(1): '-0.54 to -0.18', np.int32(2): '0.14 to 1.42'}
chi-square(1) = 0.02, p = 0.883
A baseline z, cohort 9 left out, span 0 to 3 s: 675 of 675 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(1), np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 184 189 -4.0 4.3
2 163 139 5.0 -5.3
ROIs per cluster by cohort: {1: {'Cohort10': 189, 'Cohort16': 184}, 2: {'Cohort10': 139, 'Cohort16': 163}}
cluster mean trace after onset, range: {np.int32(1): '-0.71 to -0.27', np.int32(2): '0.16 to 0.76'}
chi-square(1) = 1.26, p = 0.262
B baseline z, all mice, span -3 to 5 s: 1266 of 1460 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 3 66 -84.1 31.8
2 344 853 4.9 -1.8
ROIs per cluster by cohort: {1: {'Cohort10': 3, 'Cohort16': 3, 'Cohort9': 63}, 2: {'Cohort10': 325, 'Cohort16': 344, 'Cohort9': 528}}
cluster mean trace after onset, range: {np.int32(1): '-0.48 to 10.45', np.int32(2): '-1.08 to -0.39'}
chi-square(1) = 18.30, p = 1.89e-05
B baseline z, all mice, span 0 to 3 s: 1266 of 1460 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 2 43 -83.8 31.6
2 345 876 3.1 -1.2
ROIs per cluster by cohort: {1: {'Cohort10': 2, 'Cohort16': 2, 'Cohort9': 41}, 2: {'Cohort10': 326, 'Cohort16': 345, 'Cohort9': 550}}
cluster mean trace after onset, range: {np.int32(1): '-0.08 to 8.74', np.int32(2): '-0.90 to -0.41'}
chi-square(1) = 11.20, p = 0.000818
C session s.d. z, all mice, span -3 to 5 s: 1460 of 1460 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(1), np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 33 147 -22.9 7.1
2 314 966 3.2 -1.0
ROIs per cluster by cohort: {1: {'Cohort10': 38, 'Cohort16': 33, 'Cohort9': 109}, 2: {'Cohort10': 290, 'Cohort16': 314, 'Cohort9': 676}}
cluster mean trace after onset, range: {np.int32(1): '0.12 to 0.70', np.int32(2): '-0.09 to -0.02'}
chi-square(1) = 3.01, p = 0.0826
C session s.d. z, all mice, span 0 to 3 s: 1460 of 1460 neurons clustered; first cut with a nonresponsive cluster: 2 clusters (nonresponsive [np.int32(1), np.int32(2)])
col_0 BLA-mPFC nonspecific enrich_BLA-mPFC_% enrich_nonspecific_%
row_0
1 64 248 -13.7 4.3
2 283 865 3.7 -1.2
ROIs per cluster by cohort: {1: {'Cohort10': 72, 'Cohort16': 64, 'Cohort9': 176}, 2: {'Cohort10': 256, 'Cohort16': 283, 'Cohort9': 609}}
cluster mean trace after onset, range: {np.int32(1): '0.14 to 0.45', np.int32(2): '-0.13 to -0.04'}
chi-square(1) = 2.10, p = 0.148
/tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum() /tmp/ipykernel_2429/1594306916.py:21: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. exp = tab.sum(1).values[:, None] * tab.sum(0).values[None, :] / tab.values.sum()
Result: not reproduced, resting on the assignment of cohorts to populations and on all ROIs standing for the curated neurons. Under the adopted reading A (cohort 9 left out, 675 ROIs) the cut gives 2 clusters and population by cluster is not significant (chi-square(1) = 0.02, p = 0.88, for -3 to 5 s; 1.26, p = 0.26, for 0 to 3 s); the enrichments are at most 5.3% in size. Both clusters of this cut are nonresponsive (their mean traces after onset stay within +-1.98, see the ranges printed), so the rule stops at the first cut it tries and the test compares two nonresponsive clusters: it follows the Methods and the criterion, but says little about the paper's functional clusters. Under reading C (session s.d., all 1460 ROIs) p = 0.083 and 0.15. Only reading B (baseline z with the floor on all mice, the first version) gives p = 1.9e-05 and 0.00082, and there the responsive cluster's nonspecific ROIs are 63 of 66 (41 of 43) from cohort 9, whose z-scores the floor biases (data check), so that difference is one of cohort 9 traces. Under every reading the cut gives 2 clusters, not the several functional clusters the statement describes.**
ed5ef-alcohol-water-nonoverlapping¶
Neurons excited by alcohol and those excited by water are largely separate ensembles.
Criterion: excited neurons per M4 for alcohol and for water bouts, in each population (the Wilcoxon reading shown too); reproduced when fewer than half of the smaller excited set is also excited by the other liquid, in both populations, under the threshold reading. Responses use the matched traces of fig3f (reading a) and the first-bouts reading (b).
def overlap(ra, rw):
ea, ew = ra >= P.Z_THRESHOLD, rw >= P.Z_THRESHOLD
both = int((ea & ew).sum()); small = min(ea.sum(), ew.sum())
return int(ea.sum()), int(ew.sum()), both, (both / small if small else np.nan)
ED5EF = {}
for rd, (rname, nsg, mode) in BLA_R.items():
for reading, D_ in (("a random", TR[rd]), ("b first", TRb[rd])):
for lab in D_:
ra, rw = P.window_mean(D_[lab]["reward"]), P.window_mean(D_[lab]["water"])
ok = np.isfinite(ra) & np.isfinite(rw)
ea, ew, both, frac = overlap(ra[ok], rw[ok])
ED5EF[(rd, reading, lab)] = frac
print(f"{rd} {rname}, reading {reading}, {lab}: {ok.sum()} neurons with both responses; excited alcohol {ea}, water {ew}, both {both}; overlap / smaller set {frac:.2f}")
# Wilcoxon reading over all isolated bouts of each liquid
zmode(mode)
for lab, grp in (("nonspecific", nsg), ("BLA-mPFC", PR)):
ea = ew = both = 0
for s in grp:
b = P.session_bouts(s); b = b[b.isolated]
za = P.event_z(s["F"], b.onset.values[b.liquid == "reward"], post_s=3.0)
zw = P.event_z(s["F"], b.onset.values[b.liquid == "water"], post_s=3.0)
if len(za) < 5 or len(zw) < 5:
continue
wa, ww = P.wilcoxon_responsive(za) == 1, P.wilcoxon_responsive(zw) == 1
ea += wa.sum(); ew += ww.sum(); both += (wa & ww).sum()
print(f"{rd} Wilcoxon reading, {lab} (mice with >= 5 bouts of each): excited alcohol {ea}, water {ew}, both {both}, overlap / smaller {both / max(1, min(ea, ew)):.2f}")
zmode("baseline")
A baseline z, cohort 9 left out, reading a random, nonspecific: 328 neurons with both responses; excited alcohol 4, water 2, both 0; overlap / smaller set 0.00 A baseline z, cohort 9 left out, reading a random, BLA-mPFC: 347 neurons with both responses; excited alcohol 5, water 6, both 1; overlap / smaller set 0.20 A baseline z, cohort 9 left out, reading b first, nonspecific: 328 neurons with both responses; excited alcohol 2, water 3, both 0; overlap / smaller set 0.00 A baseline z, cohort 9 left out, reading b first, BLA-mPFC: 347 neurons with both responses; excited alcohol 5, water 8, both 0; overlap / smaller set 0.00
A Wilcoxon reading, nonspecific (mice with >= 5 bouts of each): excited alcohol 9, water 6, both 1, overlap / smaller 0.17
A Wilcoxon reading, BLA-mPFC (mice with >= 5 bouts of each): excited alcohol 31, water 31, both 8, overlap / smaller 0.26 B baseline z, all mice, reading a random, nonspecific: 829 neurons with both responses; excited alcohol 52, water 59, both 9; overlap / smaller set 0.17 B baseline z, all mice, reading a random, BLA-mPFC: 347 neurons with both responses; excited alcohol 5, water 6, both 1; overlap / smaller set 0.20 B baseline z, all mice, reading b first, nonspecific: 848 neurons with both responses; excited alcohol 59, water 61, both 7; overlap / smaller set 0.12 B baseline z, all mice, reading b first, BLA-mPFC: 347 neurons with both responses; excited alcohol 5, water 8, both 0; overlap / smaller set 0.00
B Wilcoxon reading, nonspecific (mice with >= 5 bouts of each): excited alcohol 11, water 6, both 1, overlap / smaller 0.17
B Wilcoxon reading, BLA-mPFC (mice with >= 5 bouts of each): excited alcohol 31, water 31, both 8, overlap / smaller 0.26 C session s.d. z, all mice, reading a random, nonspecific: 1113 neurons with both responses; excited alcohol 0, water 1, both 0; overlap / smaller set nan C session s.d. z, all mice, reading a random, BLA-mPFC: 347 neurons with both responses; excited alcohol 0, water 1, both 0; overlap / smaller set nan C session s.d. z, all mice, reading b first, nonspecific: 1113 neurons with both responses; excited alcohol 0, water 1, both 0; overlap / smaller set nan C session s.d. z, all mice, reading b first, BLA-mPFC: 347 neurons with both responses; excited alcohol 0, water 2, both 0; overlap / smaller set nan
C Wilcoxon reading, nonspecific (mice with >= 5 bouts of each): excited alcohol 17, water 8, both 1, overlap / smaller 0.12
C Wilcoxon reading, BLA-mPFC (mice with >= 5 bouts of each): excited alcohol 28, water 33, both 8, overlap / smaller 0.29
Result: reproduced, resting on the assignment of cohorts to populations. Under the adopted reading A few neurons are excited by both liquids: nonspecific BLA (cohort 10) 0 of the smaller set (4 alcohol, 2 water excited; reading b 0 of 2), BLA-mPFC 1 of 5 (0.20; reading b 0.00); the Wilcoxon reading gives 0.17 and 0.26. Reading B gives 0.17 and 0.12 for nonspecific BLA. The excited sets under the threshold are very small (2 to 6 neurons under reading A, up to 8 under B), so the overlap rests on few neurons; under reading C (session s.d.) the threshold of 1.98 is reached by at most 2 neurons and the overlap is undefined, and the Wilcoxon reading gives 0.12 and 0.29.**
Decoding claims (fig3h-nonspecific-decoding-85, fig3h-blampfc-decodes-better, ed6b-decoding-above-chance): blocked¶
M5 uses bouts longer than 1 s separated from other bouts by at least 2 s, with five folds per animal, each holding at least one bout of each class, so an animal needs five such bouts of alcohol and five of water. The counts per mouse:
DC = []
for lab, grp in (("nonspecific", NS), ("BLA-mPFC", PR)):
for s in grp:
b = P.decoding_bouts(s)
DC.append(dict(population=lab, mouse=s["subject"], alcohol=int((b.liquid == "reward").sum()), water=int((b.liquid == "water").sum())))
DC = pd.DataFrame(DC)
DC["usable"] = (DC.alcohol >= 5) & (DC.water >= 5)
print(DC.to_string(index=False))
print(DC.groupby("population").usable.sum().to_dict(), "mice have five or more bouts of each class")
population mouse alcohol water usable
nonspecific Cohort10-M2-1 4 2 False
nonspecific Cohort10-M2-2 20 1 False
nonspecific Cohort10-M5-1 5 6 True
nonspecific Cohort10-M5-2 7 0 False
nonspecific Cohort9-M4-1 5 2 False
nonspecific Cohort9-M4-2 6 0 False
nonspecific Cohort9-M4-3 4 0 False
nonspecific Cohort9-M5-1 2 3 False
nonspecific Cohort9-M5-2 3 1 False
nonspecific Cohort9-M5-3 9 1 False
BLA-mPFC Cohort16-M1-2 2 1 False
BLA-mPFC Cohort16-M1-3 8 10 True
BLA-mPFC Cohort16-M1-4 1 0 False
BLA-mPFC Cohort16-M2-2 6 2 False
BLA-mPFC Cohort16-M2-3 7 23 True
BLA-mPFC Cohort16-M2-4 10 2 False
BLA-mPFC Cohort16-M3-1 0 2 False
BLA-mPFC Cohort16-M3-2 7 3 False
BLA-mPFC Cohort16-M3-3 20 0 False
{'BLA-mPFC': 2, 'nonspecific': 1} mice have five or more bouts of each class
Only 1 of 10 nonspecific mice and 2 of 9 BLA-mPFC mice have five decoding bouts of each liquid;
most mice have 0 to 2 water bouts. The paper's procedure cannot be run on these bouts, so the
three decoding claims are blocked (other: too few bouts under the claim's own rule).
fig3k-blampfc-response-predicts-bouts¶
Across mice, the mean BLA-mPFC response to alcohol correlates positively with the number of alcohol bouts.
Criterion: per mouse, the mean over its BLA-mPFC neurons of the M3 alcohol response, against its number of alcohol bouts (M1) in the imaging session; Pearson; Bonferroni over (a) four tests (Fig. 3i to l) or (b) two tests (k and l); reproduced when r2 = 0.59 ± 0.059, r positive and corrected two-sided p < 0.05 under both. Bouts counted are all M1 alcohol bouts.
def per_mouse(T_, lab, liquid):
tr = T_[lab]
r = P.window_mean(tr[liquid]); mice = np.array(tr["mouse"])
rows = []
for m in dict.fromkeys(tr["mouse"]):
s = SUBJ[m]
rows.append(dict(mouse=m, response=np.nanmean(r[mice == m]),
bouts=len(P.bouts(s["licks"][liquid])), licks=len(s["licks"]["reward"])))
return pd.DataFrame(rows)
def corr(df, name, excl=False):
d = df.dropna()
if excl:
d = d[d.licks >= P.MIN_ALCOHOL_LICKS]
r, p = stats.pearsonr(d.response, d.bouts)
print(f"{name}: n = {len(d)} mice, r = {r:.3f}, r2 = {r * r:.3f}, p = {p:.3g}; Bonferroni x4 {min(1, 4 * p):.3g}, x2 {min(1, 2 * p):.3g}")
return r, p, len(d)
K = {}
for rd, (rname, nsg, mode) in BLA_R.items():
if rd == "B":
continue # BLA-mPFC traces are the same under A and B
for reading, D_ in (("a random", TR[rd]), ("b first", TRb[rd])):
df = per_mouse(D_, "BLA-mPFC", "reward")
if reading == "a random":
print(df.round(3).to_string(index=False))
K[(rd, reading)] = corr(df, f"fig3k BLA-mPFC alcohol, {rname}, reading {reading}")
corr(df, f" variant without mice under 50 alcohol licks, reading {reading}", excl=True)
mouse response bouts licks
Cohort16-M1-2 -0.271 26 114
Cohort16-M1-3 -0.128 46 519
Cohort16-M1-4 0.004 8 49
Cohort16-M2-2 -0.042 9 194
Cohort16-M2-3 -0.068 27 320
Cohort16-M2-4 -0.176 15 311
Cohort16-M3-1 0.009 5 76
Cohort16-M3-2 -0.038 15 350
Cohort16-M3-3 0.154 46 658
fig3k BLA-mPFC alcohol, baseline z, cohort 9 left out, reading a random: n = 9 mice, r = 0.064, r2 = 0.004, p = 0.87; Bonferroni x4 1, x2 1
variant without mice under 50 alcohol licks, reading a random: n = 8 mice, r = 0.143, r2 = 0.021, p = 0.735; Bonferroni x4 1, x2 1
fig3k BLA-mPFC alcohol, baseline z, cohort 9 left out, reading b first: n = 9 mice, r = 0.123, r2 = 0.015, p = 0.753; Bonferroni x4 1, x2 1
variant without mice under 50 alcohol licks, reading b first: n = 8 mice, r = 0.195, r2 = 0.038, p = 0.643; Bonferroni x4 1, x2 1
mouse response bouts licks
Cohort16-M1-2 -0.100 26 114
Cohort16-M1-3 -0.055 46 519
Cohort16-M1-4 -0.048 8 49
Cohort16-M2-2 -0.011 9 194
Cohort16-M2-3 -0.028 27 320
Cohort16-M2-4 -0.047 15 311
Cohort16-M3-1 -0.019 5 76
Cohort16-M3-2 -0.011 15 350
Cohort16-M3-3 0.108 46 658
fig3k BLA-mPFC alcohol, session s.d. z, all mice, reading a random: n = 9 mice, r = 0.320, r2 = 0.102, p = 0.402; Bonferroni x4 1, x2 0.804
variant without mice under 50 alcohol licks, reading a random: n = 8 mice, r = 0.284, r2 = 0.081, p = 0.495; Bonferroni x4 1, x2 0.99
fig3k BLA-mPFC alcohol, session s.d. z, all mice, reading b first: n = 9 mice, r = 0.301, r2 = 0.091, p = 0.431; Bonferroni x4 1, x2 0.861
variant without mice under 50 alcohol licks, reading b first: n = 8 mice, r = 0.322, r2 = 0.104, p = 0.436; Bonferroni x4 1, x2 0.873
Result: not reproduced, resting on the assignment of cohorts to populations. Across the 9 BLA-mPFC mice the mean alcohol response and the number of alcohol bouts are weakly and not significantly correlated (reading A, r = 0.064, r2 = 0.004, p = 0.87; first bouts r2 = 0.015, p = 0.75; session s.d. z r2 = 0.102 and 0.091, p = 0.40 and 0.43), against the paper's r2 = 0.59. Leaving out the mouse under 50 licks changes little (r2 = 0.021 to 0.104). The BLA-mPFC traces are the same under readings A and B; the r2 of 0.083 in the first version came from another random draw of matched bouts.**
fig3ijl-no-other-correlations¶
Nonspecific BLA responses do not correlate with alcohol or water bouts, and BLA-mPFC water responses do not correlate with water bouts.
Criterion: a claim of absence on the paper's test (Pearson, Bonferroni over Fig. 3i to l) at p < 0.05; reproduced when none of the three reaches corrected p < 0.05.
IJL = {}
for rd, (rname, nsg, mode) in BLA_R.items():
for reading, D_ in (("a random", TR[rd]), ("b first", TRb[rd])):
for lab, liq in (("nonspecific", "reward"), ("nonspecific", "water"), ("BLA-mPFC", "water")):
if rd == "B" and lab == "BLA-mPFC":
continue
df = per_mouse(D_, lab, liq)
IJL[(rd, reading, lab, liq)] = corr(df, f"{rd} {lab} {liq} response against {liq} bouts, reading {reading}")
A nonspecific reward response against reward bouts, reading a random: n = 4 mice, r = -0.336, r2 = 0.113, p = 0.664; Bonferroni x4 1, x2 1 A nonspecific water response against water bouts, reading a random: n = 4 mice, r = -0.481, r2 = 0.232, p = 0.519; Bonferroni x4 1, x2 1 A BLA-mPFC water response against water bouts, reading a random: n = 9 mice, r = 0.301, r2 = 0.091, p = 0.431; Bonferroni x4 1, x2 0.861 A nonspecific reward response against reward bouts, reading b first: n = 4 mice, r = -0.324, r2 = 0.105, p = 0.676; Bonferroni x4 1, x2 1 A nonspecific water response against water bouts, reading b first: n = 4 mice, r = -0.725, r2 = 0.526, p = 0.275; Bonferroni x4 1, x2 0.549 A BLA-mPFC water response against water bouts, reading b first: n = 9 mice, r = 0.067, r2 = 0.004, p = 0.864; Bonferroni x4 1, x2 1 B nonspecific reward response against reward bouts, reading a random: n = 10 mice, r = 0.095, r2 = 0.009, p = 0.794; Bonferroni x4 1, x2 1 B nonspecific water response against water bouts, reading a random: n = 10 mice, r = 0.502, r2 = 0.252, p = 0.139; Bonferroni x4 0.555, x2 0.278 B nonspecific reward response against reward bouts, reading b first: n = 10 mice, r = -0.041, r2 = 0.002, p = 0.909; Bonferroni x4 1, x2 1 B nonspecific water response against water bouts, reading b first: n = 10 mice, r = 0.491, r2 = 0.241, p = 0.15; Bonferroni x4 0.598, x2 0.299 C nonspecific reward response against reward bouts, reading a random: n = 10 mice, r = -0.345, r2 = 0.119, p = 0.329; Bonferroni x4 1, x2 0.658 C nonspecific water response against water bouts, reading a random: n = 10 mice, r = 0.269, r2 = 0.072, p = 0.453; Bonferroni x4 1, x2 0.906 C BLA-mPFC water response against water bouts, reading a random: n = 9 mice, r = 0.192, r2 = 0.037, p = 0.62; Bonferroni x4 1, x2 1 C nonspecific reward response against reward bouts, reading b first: n = 10 mice, r = -0.602, r2 = 0.362, p = 0.0655; Bonferroni x4 0.262, x2 0.131 C nonspecific water response against water bouts, reading b first: n = 10 mice, r = 0.048, r2 = 0.002, p = 0.895; Bonferroni x4 1, x2 1 C BLA-mPFC water response against water bouts, reading b first: n = 9 mice, r = 0.183, r2 = 0.033, p = 0.638; Bonferroni x4 1, x2 1
Result: reproduced. None of the three correlations reaches p < 0.05 even before correction under any reading. Reading A: nonspecific alcohol r2 = 0.113 (p = 0.66) and water r2 = 0.232 (p = 0.52), over only the 4 cohort-10 mice, and BLA-mPFC water r2 = 0.091 (p = 0.43); first bouts, smallest p 0.28. Reading B (all 10 nonspecific mice): r2 = 0.009 (p = 0.79) and 0.252 (p = 0.14). Reading C: smallest p 0.066. With 4 mice the nonspecific tests of reading A have little power.**
ed6ij-cue-responses-no-correlation¶
Cue-evoked responses of neither population correlate with alcohol bouts.
Criterion: a claim of absence on the paper's test (Pearson, p < 0.05); per mouse mean cue response as in ed5d (mean z 0 to 3 s after cue onset) against alcohol bouts; reproduced when neither correlation has p < 0.05. Both cue baselines (3 s and 5 s) are shown.
ED6IJ = {}
for rd, (rname, nsg, mode) in BLA_R.items():
zmode(mode)
for pre in (3.0, 5.0):
for lab, grp in (("nonspecific", nsg), ("BLA-mPFC", PR)):
if rd == "B" and lab == "BLA-mPFC":
continue
resp = [np.nanmean(P.window_mean(P.event_z(s["F"], s["cue_t"], pre_s=pre, post_s=5.0), pre_s=pre)) for s in grp]
nb = [len(P.bouts(s["licks"]["reward"])) for s in grp]
r, p = stats.pearsonr(resp, nb)
ED6IJ[(rd, pre, lab)] = p
print(f"{rd} {rname}, baseline {pre:.0f} s, {lab}: n = {len(grp)}, r = {r:.3f}, r2 = {r * r:.3f}, p = {p:.3g}")
zmode("baseline")
A baseline z, cohort 9 left out, baseline 3 s, nonspecific: n = 4, r = -0.451, r2 = 0.203, p = 0.549 A baseline z, cohort 9 left out, baseline 3 s, BLA-mPFC: n = 9, r = 0.733, r2 = 0.537, p = 0.0247
A baseline z, cohort 9 left out, baseline 5 s, nonspecific: n = 4, r = -0.514, r2 = 0.264, p = 0.486 A baseline z, cohort 9 left out, baseline 5 s, BLA-mPFC: n = 9, r = 0.753, r2 = 0.567, p = 0.0193
B baseline z, all mice, baseline 3 s, nonspecific: n = 10, r = 0.125, r2 = 0.016, p = 0.731
B baseline z, all mice, baseline 5 s, nonspecific: n = 10, r = 0.057, r2 = 0.003, p = 0.875
C session s.d. z, all mice, baseline 3 s, nonspecific: n = 10, r = 0.278, r2 = 0.077, p = 0.437 C session s.d. z, all mice, baseline 3 s, BLA-mPFC: n = 9, r = 0.580, r2 = 0.336, p = 0.102 C session s.d. z, all mice, baseline 5 s, nonspecific: n = 10, r = 0.428, r2 = 0.183, p = 0.217
C session s.d. z, all mice, baseline 5 s, BLA-mPFC: n = 9, r = 0.606, r2 = 0.367, p = 0.0836
Result: not reproduced, resting on the assignment of cohorts to populations. Under the Methods' baseline z (readings A and B, the same for cohort 16, whose traces have no flat baselines) BLA-mPFC cue responses correlate with alcohol bouts across 9 mice (r = 0.733, r2 = 0.537, p = 0.025; 5-s baseline r2 = 0.567, p = 0.019). Nonspecific cue responses do not (reading A, 4 mice, p = 0.55 and 0.49; reading B, 10 mice, p = 0.73 and 0.88). Under reading C (session s.d.) the BLA-mPFC correlation is weaker and not significant (r2 = 0.336, p = 0.10; 5-s baseline p = 0.084).**
ed6k-bout-duration-not-number¶
Average bout duration does not correlate with the number of bouts.
Criterion: a claim of absence on the paper's test (Pearson, p < 0.05), alcohol bouts (M1) of the BLA-mPFC mice; reproduced when p >= 0.05. Bout duration is first to last lick (M1).
rows = []
for s in PR:
b = P.bouts(s["licks"]["reward"])
rows.append(dict(mouse=s["subject"], bouts=len(b), mean_duration_s=(b.offset - b.onset).mean()))
d6k = pd.DataFrame(rows)
print(d6k.round(2).to_string(index=False))
r, p = stats.pearsonr(d6k.mean_duration_s, d6k.bouts)
print(f"n = {len(d6k)}, r = {r:.3f}, r2 = {r * r:.3f}, p = {p:.3g}")
ED6K = p
mouse bouts mean_duration_s Cohort16-M1-2 26 0.87 Cohort16-M1-3 46 2.47 Cohort16-M1-4 8 0.87 Cohort16-M2-2 9 3.16 Cohort16-M2-3 27 2.04 Cohort16-M2-4 15 2.88 Cohort16-M3-1 5 0.64 Cohort16-M3-2 15 2.64 Cohort16-M3-3 46 1.94 n = 9, r = 0.159, r2 = 0.025, p = 0.683
Result: reproduced. Across the 9 BLA-mPFC mice mean alcohol bout duration does not correlate with the number of bouts (r = 0.159, r2 = 0.025, p = 0.68).**
mPFC responses on the stimulation sessions¶
For each mPFC session, the isolated bouts (M2) of the reward bottle (alcohol or sucrose) and of water are labelled by their trial: stimulated choice trial (type 4), nonstimulated choice trial (type 3) or forced trial (types 1 and 2). The stimulation claims compare types 4 and 3, the choice trials the criteria name; the housing claims use the nonstimulated trials (types 1 to 3) or all trials. Per neuron, M3 traces are averaged over a matched number of bouts per condition (reading a random, reading b first bouts). For the stimulation claims the conditions are stimulated and nonstimulated bouts of one liquid; for the housing claims the conditions are the reward liquid and water of the session, on (a) nonstimulated trials or (b) all trials, as the criteria name. Neurons whose response is undefined (no bout in a condition) are dropped and counted.
def mpfc_stim(grp, liquid, rng, how):
"""Per neuron responses, stimulated (type 4) and nonstimulated (type 3) choice-trial bouts of
`liquid`, matched per session (the criteria compare stimulated and nonstimulated choice trials)."""
st, ns, mouse, nb = [], [], [], []
for s in grp:
b = P.session_bouts(s)
liq = (b.liquid == liquid).values
tr, m, _ = P.condition_traces(s, b, {"stim": liq & (b.trial_type == 4).values, "nostim": liq & (b.trial_type == 3).values}, rng, how)
st.append(P.window_mean(tr["stim"])); ns.append(P.window_mean(tr["nostim"]))
mouse += [s["subject"]] * s["n_rois"]; nb.append(m)
return np.concatenate(st), np.concatenate(ns), np.array(mouse), nb
def mpfc_housing(grp, liquid, rng, how, trials):
out, mouse, nb = [], [], []
for s in grp:
b = P.session_bouts(s)
sel = (b.trial_type != 4).values if trials == "nonstimulated" else np.ones(len(b), bool)
tr, m, _ = P.condition_traces(s, b, {"reward": sel & (b.liquid == "reward").values, "water": sel & (b.liquid == "water").values}, rng, how)
out.append(P.window_mean(tr[liquid])); mouse += [s["subject"]] * s["n_rois"]; nb.append(m)
return np.concatenate(out), np.array(mouse), nb
for lab, g in (("alcohol GH", MP_A_GH), ("alcohol SI", MP_A_SI), ("sucrose GH", MP_S_GH), ("sucrose SI", MP_S_SI)):
print(f"{lab}: forced-trial coding by session", {s["subject"]: SC.forced_coding[s["path"].split("/")[1][4:45]] for s in g})
alcohol GH: forced-trial coding by session {'Cohort13b-M1-2': 'stored', 'Cohort13b-M1-3': 'stored', 'Cohort13b-M2-2': 'types 1 and 2 swapped', 'Cohort13b-M2-3': 'types 1 and 2 swapped', 'Cohort13b-M3-1': 'stored', 'Cohort13b-M3-2': 'types 1 and 2 swapped'}
alcohol SI: forced-trial coding by session {'Cohort13b-M1-2': 'stored', 'Cohort13b-M1-3': 'stored', 'Cohort13b-M2-3': 'types 1 and 2 swapped', 'Cohort13b-M3-1': 'stored', 'Cohort13b-M3-2': 'types 1 and 2 swapped'}
sucrose GH: forced-trial coding by session {'Cohort13b-M1-2': 'stored', 'Cohort13b-M1-3': 'stored', 'Cohort13b-M2-1': 'types 1 and 2 swapped', 'Cohort13b-M2-2': 'types 1 and 2 swapped', 'Cohort13b-M2-3': 'types 1 and 2 swapped', 'Cohort13b-M3-1': 'stored', 'Cohort13b-M3-2': 'types 1 and 2 swapped', 'Cohort13b-M3-3': 'types 1 and 2 swapped'}
sucrose SI: forced-trial coding by session {'Cohort13b-M1-1': 'stored', 'Cohort13b-M1-2': 'stored', 'Cohort13b-M1-3': 'stored', 'Cohort13b-M2-1': 'types 1 and 2 swapped', 'Cohort13b-M2-2': 'types 1 and 2 swapped', 'Cohort13b-M3-1': 'stored'}
fig5b-isolation-increases-mpfc-alcohol¶
Isolation increases mPFC neuron responses to alcohol.
Criterion: M3 alcohol responses of mPFC neurons in the alcohol stimulation session before and after isolation; trials (a) nonstimulated only, (b) all; neurons are units; reproduced when, under both, the isolated mean exceeds the group-housed mean with one-sided p < 0.05; the two-sided p is reported.
def housing_test(gh, si, liquid, seed, alt):
res = {}
for trials in ("nonstimulated", "all"):
for how in ("random", "first"):
rng = np.random.default_rng(seed)
a, ma, na = mpfc_housing(gh, liquid, rng, how, trials)
b, mb, nb = mpfc_housing(si, liquid, rng, how, trials)
a, b = a[np.isfinite(a)], b[np.isfinite(b)]
t = stats.ttest_ind(b, a)
one = stats.ttest_ind(b, a, alternative=alt).pvalue if alt != "two-sided" else t.pvalue
res[(trials, how)] = (a.mean(), b.mean(), one, t.pvalue)
print(f"{liquid}, trials {trials}, bouts {how}: GH {a.mean():.3f} (n={len(a)}, dropped {len(ma) - len(a)}), "
f"SI {b.mean():.3f} (n={len(b)}, dropped {len(mb) - len(b)}); t = {t.statistic:.2f}, p ({alt}) = {one:.3g}, two-sided {t.pvalue:.3g}; matched bouts GH {na}, SI {nb}")
ps = []
for i in range(20):
rng = np.random.default_rng(seed + 1000 * (i + 1))
a = mpfc_housing(gh, liquid, rng, "random", trials)[0]; b = mpfc_housing(si, liquid, rng, "random", trials)[0]
a, b = a[np.isfinite(a)], b[np.isfinite(b)]
ps.append(stats.ttest_ind(b, a, alternative=alt).pvalue)
print(f" reading a over 20 further random draws, trials {trials}: median p ({alt}) {np.median(ps):.3g}, p < 0.05 in {np.mean(np.array(ps) < 0.05):.0%}")
return res
FIG5B = housing_test(MP_A_GH, MP_A_SI, "reward", 51, "greater")
# by mouse
for lab, g in (("GH", MP_A_GH), ("SI", MP_A_SI)):
r, m, _ = mpfc_housing(g, "reward", np.random.default_rng(51), "random", "nonstimulated")
print(lab, "mean alcohol response by mouse:", {k: round(float(np.nanmean(r[m == k])), 3) for k in np.unique(m)})
reward, trials nonstimulated, bouts random: GH 0.096 (n=748, dropped 0), SI 0.099 (n=426, dropped 13); t = 0.03, p (greater) = 0.487, two-sided 0.974; matched bouts GH [1, 8, 3, 3, 4, 5], SI [4, 1, 10, 3, 2]
reward, trials nonstimulated, bouts first: GH -0.015 (n=748, dropped 0), SI 0.172 (n=426, dropped 13); t = 1.98, p (greater) = 0.0238, two-sided 0.0476; matched bouts GH [1, 8, 3, 3, 4, 5], SI [4, 1, 10, 3, 2]
reading a over 20 further random draws, trials nonstimulated: median p (greater) 0.238, p < 0.05 in 10% reward, trials all, bouts random: GH 0.076 (n=748, dropped 0), SI 0.162 (n=426, dropped 13); t = 1.12, p (greater) = 0.131, two-sided 0.262; matched bouts GH [3, 15, 3, 6, 5, 7], SI [4, 5, 14, 9, 5]
reward, trials all, bouts first: GH 0.008 (n=748, dropped 0), SI 0.161 (n=426, dropped 13); t = 2.02, p (greater) = 0.0218, two-sided 0.0436; matched bouts GH [3, 15, 3, 6, 5, 7], SI [4, 5, 14, 9, 5]
reading a over 20 further random draws, trials all: median p (greater) 0.144, p < 0.05 in 0%
GH mean alcohol response by mouse: {np.str_('Cohort13b-M1-2'): 0.437, np.str_('Cohort13b-M1-3'): -0.019, np.str_('Cohort13b-M2-2'): 0.134, np.str_('Cohort13b-M2-3'): 0.146, np.str_('Cohort13b-M3-1'): 0.048, np.str_('Cohort13b-M3-2'): -0.075}
SI mean alcohol response by mouse: {np.str_('Cohort13b-M1-2'): 0.08, np.str_('Cohort13b-M1-3'): 0.148, np.str_('Cohort13b-M2-3'): 0.138, np.str_('Cohort13b-M3-1'): 0.32, np.str_('Cohort13b-M3-2'): -0.057}
Result: not reproduced, resting on the reading of bout matching. Under reading a (random matched bouts) the isolated mean does not exceed the group-housed one significantly: nonstimulated trials 0.099 against 0.096 (one-sided p = 0.49; median over 20 further draws 0.24, p < 0.05 in 10%), all trials 0.162 against 0.076 (p = 0.13; median 0.14, 0%). Under reading b (first bouts) it does: 0.172 against -0.015 (p = 0.024) and 0.161 against 0.008 (p = 0.022). The outcome rests on reading a, adopted as an assumption. Matched bout counts are 1 to 15 per mouse.**
fig5c-isolation-no-water-change¶
Isolation does not change mPFC responses to water.
Criterion: a claim of absence, the test of fig5b on water bouts, both trial readings, two-sided unpaired t-test at p < 0.05; reproduced when p >= 0.05 under both.
FIG5C = housing_test(MP_A_GH, MP_A_SI, "water", 52, "two-sided")
water, trials nonstimulated, bouts random: GH 0.042 (n=748, dropped 0), SI 0.053 (n=422, dropped 17); t = 0.13, p (two-sided) = 0.893, two-sided 0.893; matched bouts GH [1, 8, 3, 3, 4, 5], SI [4, 1, 10, 3, 2] water, trials nonstimulated, bouts first: GH 0.052 (n=748, dropped 0), SI 0.114 (n=422, dropped 17); t = 0.68, p (two-sided) = 0.499, two-sided 0.499; matched bouts GH [1, 8, 3, 3, 4, 5], SI [4, 1, 10, 3, 2]
reading a over 20 further random draws, trials nonstimulated: median p (two-sided) 0.822, p < 0.05 in 0% water, trials all, bouts random: GH 0.085 (n=748, dropped 0), SI 0.071 (n=422, dropped 17); t = -0.19, p (two-sided) = 0.851, two-sided 0.851; matched bouts GH [3, 15, 3, 6, 5, 7], SI [4, 5, 14, 9, 5]
water, trials all, bouts first: GH 0.063 (n=748, dropped 0), SI 0.076 (n=422, dropped 17); t = 0.17, p (two-sided) = 0.868, two-sided 0.868; matched bouts GH [3, 15, 3, 6, 5, 7], SI [4, 5, 14, 9, 5]
reading a over 20 further random draws, trials all: median p (two-sided) 0.919, p < 0.05 in 0%
Result: reproduced. Water responses do not differ between housing conditions under any reading (two-sided p 0.50 to 0.89; over 20 further draws median 0.82 and 0.92).**
fig5d-isolation-decreases-mpfc-sucrose¶
Isolation decreases mPFC neuron responses to sucrose.
Criterion: as fig5b for sucrose bouts of the sucrose stimulation sessions, both trial readings; reproduced when, under both, the isolated mean is below the group-housed mean with one-sided p < 0.05; the two-sided p is given.
FIG5D = housing_test(MP_S_GH, MP_S_SI, "reward", 53, "less")
reward, trials nonstimulated, bouts random: GH 0.039 (n=846, dropped 79), SI -0.025 (n=490, dropped 53); t = -0.76, p (less) = 0.224, two-sided 0.449; matched bouts GH [1, 10, 0, 7, 6, 4, 14, 15], SI [1, 0, 4, 10, 3, 8]
reward, trials nonstimulated, bouts first: GH 0.044 (n=846, dropped 79), SI -0.011 (n=490, dropped 53); t = -0.56, p (less) = 0.287, two-sided 0.573; matched bouts GH [1, 10, 0, 7, 6, 4, 14, 15], SI [1, 0, 4, 10, 3, 8]
reading a over 20 further random draws, trials nonstimulated: median p (less) 0.36, p < 0.05 in 0% reward, trials all, bouts random: GH 0.016 (n=925, dropped 0), SI 0.025 (n=490, dropped 53); t = 0.14, p (less) = 0.558, two-sided 0.885; matched bouts GH [2, 16, 1, 9, 10, 7, 18, 23], SI [2, 0, 7, 17, 5, 13]
reward, trials all, bouts first: GH 0.074 (n=925, dropped 0), SI 0.006 (n=490, dropped 53); t = -0.79, p (less) = 0.216, two-sided 0.432; matched bouts GH [2, 16, 1, 9, 10, 7, 18, 23], SI [2, 0, 7, 17, 5, 13]
reading a over 20 further random draws, trials all: median p (less) 0.497, p < 0.05 in 0%
Result: not reproduced. The isolated sucrose response is not significantly below the group-housed one under any reading (one-sided p 0.22 to 0.56; isolated mean -0.025 to 0.025 against 0.016 to 0.074; over 20 further draws median p 0.36 and 0.50, never below 0.05).**
def stim_test(grp, liquid, seed, alt, label):
res = {}
for subset, g in (("all sessions", grp),):
for how in ("random", "first"):
if not g:
print(f"{label}, {subset}: no session"); continue
st, ns, mouse, nb = mpfc_stim(g, liquid, np.random.default_rng(seed), how)
ok = np.isfinite(st) & np.isfinite(ns)
t = stats.ttest_rel(st[ok], ns[ok])
one = stats.ttest_rel(st[ok], ns[ok], alternative=alt).pvalue if alt != "two-sided" else t.pvalue
res[(subset, how)] = (ns[ok].mean(), st[ok].mean(), one, t.pvalue, ok.sum())
print(f"{label}, {subset}, bouts {how}: {ok.sum()} neurons of {len(st)} from {len(g)} mice; nonstim {ns[ok].mean():.3f}, stim {st[ok].mean():.3f}, "
f"t({ok.sum() - 1}) = {t.statistic:.2f}, p ({alt}) = {one:.3g}, two-sided {t.pvalue:.3g}; matched bouts per mouse {nb}")
if subset == "all sessions" and how == "random":
print(" by mouse, stim minus nonstim (neurons):", {m: f"{np.mean(st[ok & (mouse == m)] - ns[ok & (mouse == m)]):.3f} ({(ok & (mouse == m)).sum()})" for m in np.unique(mouse)})
if subset == "all sessions" and g:
ps = []
for i in range(20):
st, ns, mouse, nb = mpfc_stim(g, liquid, np.random.default_rng(seed + 1000 * (i + 1)), "random")
ok = np.isfinite(st) & np.isfinite(ns)
ps.append(stats.ttest_rel(st[ok], ns[ok], alternative=alt).pvalue)
print(f" reading a over 20 further random draws: median p ({alt}) {np.median(ps):.3g}, p < 0.05 in {np.mean(np.array(ps) < 0.05):.0%}")
return res
def proportion_test(grp, liquid, seed, label):
"""Per mouse percentage excited and inhibited (M4 threshold), stimulated against nonstimulated; paired over mice."""
res = {}
for subset, g in (("all sessions", grp),):
for how in ("random", "first"):
if len(g) < 2:
print(f"{label}, {subset}: fewer than 2 sessions"); continue
st, ns, mouse, nb = mpfc_stim(g, liquid, np.random.default_rng(seed), how)
rows = []
for m in np.unique(mouse):
k = (mouse == m) & np.isfinite(st) & np.isfinite(ns)
if k.sum() == 0:
continue
rows.append(dict(mouse=m, n=k.sum(), exc_stim=100 * np.mean(st[k] >= P.Z_THRESHOLD), exc_nostim=100 * np.mean(ns[k] >= P.Z_THRESHOLD),
inh_stim=100 * np.mean(st[k] <= -P.Z_THRESHOLD), inh_nostim=100 * np.mean(ns[k] <= -P.Z_THRESHOLD)))
d = pd.DataFrame(rows)
for kind_ in ("exc", "inh"):
t = stats.ttest_rel(d[f"{kind_}_stim"], d[f"{kind_}_nostim"])
lo = stats.ttest_rel(d[f"{kind_}_stim"], d[f"{kind_}_nostim"], alternative="less").pvalue
res[(subset, how, kind_)] = (d[f"{kind_}_nostim"].mean(), d[f"{kind_}_stim"].mean(), t.pvalue, lo, len(d))
print(f"{label}, {subset}, bouts {how}, {kind_}: {len(d)} mice; nonstim {d[f'{kind_}_nostim'].mean():.1f}%, stim {d[f'{kind_}_stim'].mean():.1f}%, "
f"t({len(d) - 1}) = {t.statistic:.2f}, two-sided p = {t.pvalue:.3g}, one-sided (stim lower) p = {lo:.3g}")
if how == "random" and subset == "all sessions":
print(d.round(1).to_string(index=False))
if subset == "all sessions" and len(g) >= 2:
ps = {"exc": [], "inh": []}
for i in range(20):
st, ns, mouse, nb = mpfc_stim(g, liquid, np.random.default_rng(seed + 1000 * (i + 1)), "random")
for kind_ in ps:
thr = (lambda x: x >= P.Z_THRESHOLD) if kind_ == "exc" else (lambda x: x <= -P.Z_THRESHOLD)
a_, b_ = [], []
for m in np.unique(mouse):
k = (mouse == m) & np.isfinite(st) & np.isfinite(ns)
if k.sum():
a_.append(100 * np.mean(thr(st[k]))); b_.append(100 * np.mean(thr(ns[k])))
ps[kind_].append(stats.ttest_rel(a_, b_).pvalue)
print(" reading a over 20 further random draws, two-sided p: " + "; ".join(
f"{k} median {np.nanmedian(v):.3g}, p < 0.05 in {np.mean(np.array(v) < 0.05):.0%}" for k, v in ps.items()))
return res
fig6c-stim-increases-mpfc-alcohol-gh¶
In group-housed mice, BLA-mPFC stimulation increases mPFC responses to alcohol, mimicking isolation.
Criterion: M3 alcohol responses of each neuron on stimulated and nonstimulated choice trials of the group-housed alcohol stimulation session; paired over neurons; reproduced when stimulated exceeds nonstimulated with one-sided p < 0.05; the two-sided p is reported. Nonstimulated bouts are those of choice trials without light (type 3), as the criterion says; the first version also took the forced trials (types 1 and 2).
FIG6C = stim_test(MP_A_GH, "reward", 61, "greater", "alcohol GH")
alcohol GH, all sessions, bouts random: 605 neurons of 748 from 6 mice; nonstim -0.026, stim 0.096, t(604) = 1.11, p (greater) = 0.134, two-sided 0.269; matched bouts per mouse [1, 5, 0, 8, 1, 2]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-2'): '0.428 (77)', np.str_('Cohort13b-M1-3'): '0.030 (126)', np.str_('Cohort13b-M2-2'): 'nan (0)', np.str_('Cohort13b-M2-3'): '-0.020 (124)', np.str_('Cohort13b-M3-1'): '0.089 (193)', np.str_('Cohort13b-M3-2'): '0.264 (85)'}
alcohol GH, all sessions, bouts first: 605 neurons of 748 from 6 mice; nonstim 0.048, stim 0.091, t(604) = 0.33, p (greater) = 0.37, two-sided 0.741; matched bouts per mouse [1, 5, 0, 8, 1, 2]
reading a over 20 further random draws: median p (greater) 0.183, p < 0.05 in 0%
Result: not reproduced. In the group-housed alcohol session stimulated responses (0.096) are not significantly above nonstimulated choice-trial responses (-0.026; one-sided p = 0.13, two-sided 0.27; reading b 0.091 against 0.048, p = 0.37; over 20 further draws median 0.18, never below 0.05), over 605 neurons with both responses; matched bouts are 0 to 8 per mouse, and one of the 6 mice has none.**
fig6de-stim-fewer-alcohol-inhibited¶
BLA-mPFC stimulation lowers the proportion of mPFC neurons inhibited by alcohol, without changing the proportion excited.
Criterion: per mouse, the percentage of its neurons inhibited (and excited) per M4 on stimulated and nonstimulated trials, group-housed, paired over mice; reproduced when the inhibited proportion falls with p < 0.05 and the excited proportion does not change at p < 0.05, under both sidedness readings.
FIG6DE = proportion_test(MP_A_GH, "reward", 62, "alcohol GH")
alcohol GH, all sessions, bouts random, exc: 5 mice; nonstim 10.8%, stim 10.6%, t(4) = -0.17, two-sided p = 0.872, one-sided (stim lower) p = 0.436
alcohol GH, all sessions, bouts random, inh: 5 mice; nonstim 11.4%, stim 9.7%, t(4) = -0.57, two-sided p = 0.597, one-sided (stim lower) p = 0.298
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-2 77 14.3 19.5 14.3 24.7
Cohort13b-M1-3 126 1.6 0.8 4.0 0.0
Cohort13b-M2-3 124 6.5 3.2 1.6 0.8
Cohort13b-M3-1 193 21.2 21.2 23.8 19.7
Cohort13b-M3-2 85 9.4 9.4 4.7 11.8
alcohol GH, all sessions, bouts first, exc: 5 mice; nonstim 11.0%, stim 11.1%, t(4) = 0.05, two-sided p = 0.959, one-sided (stim lower) p = 0.52
alcohol GH, all sessions, bouts first, inh: 5 mice; nonstim 12.0%, stim 9.7%, t(4) = -0.59, two-sided p = 0.588, one-sided (stim lower) p = 0.294
reading a over 20 further random draws, two-sided p: exc median 0.63, p < 0.05 in 5%; inh median 0.493, p < 0.05 in 0%
Result: not reproduced. The inhibited proportion does not fall significantly with stimulation (11.4% to 9.7%, two-sided p = 0.60, one-sided 0.30; reading b 12.0% to 9.7%, p = 0.59; over 20 further draws median p 0.49, never below 0.05), and the excited proportion does not change (p = 0.87 and 0.96), over 5 mice (the sixth has no matched choice-trial alcohol bouts).**
fig6f-stim-decreases-mpfc-alcohol-si¶
After isolation, BLA-mPFC stimulation decreases mPFC responses to alcohol.
Criterion: as fig6c in the isolation session; reproduced when stimulated is below nonstimulated with one-sided p < 0.05; the two-sided p is reported.
FIG6F = stim_test(MP_A_SI, "reward", 63, "less", "alcohol SI")
alcohol SI, all sessions, bouts random: 364 neurons of 439 from 5 mice; nonstim 0.117, stim 0.226, t(363) = 1.25, p (less) = 0.894, two-sided 0.212; matched bouts per mouse [2, 0, 4, 5, 9]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-2'): '0.303 (43)', np.str_('Cohort13b-M1-3'): 'nan (0)', np.str_('Cohort13b-M2-3'): '0.428 (63)', np.str_('Cohort13b-M3-1'): '0.029 (184)', np.str_('Cohort13b-M3-2'): '-0.078 (74)'}
alcohol SI, all sessions, bouts first: 364 neurons of 439 from 5 mice; nonstim 0.102, stim 0.199, t(363) = 1.10, p (less) = 0.864, two-sided 0.272; matched bouts per mouse [2, 0, 4, 5, 9]
reading a over 20 further random draws: median p (less) 0.907, p < 0.05 in 0%
Result: not reproduced. In the isolation alcohol session stimulated responses (0.226) are above, not below, nonstimulated choice-trial responses (0.117; one-sided p = 0.89, two-sided 0.21; reading b 0.199 against 0.102, p = 0.86; median over 20 further draws 0.91), over 364 neurons; one of the 5 mice has no matched bouts.**
fig6gj-stim-no-water-effect¶
BLA-mPFC stimulation does not change mPFC responses to water, nor the proportions of excited or inhibited water neurons, before or after isolation.
Criterion: a claim of absence on the tests of fig6c (paired over neurons) and fig6de (paired over mice) on water bouts, both housing conditions, two-sided, p < 0.05; reproduced when none reaches p < 0.05. The alcohol sessions are used.
FIG6GJ = {}
for lab, g, seed in (("water GH", MP_A_GH, 64), ("water SI", MP_A_SI, 65)):
FIG6GJ[(lab, "resp")] = stim_test(g, "water", seed, "two-sided", lab)
FIG6GJ[(lab, "prop")] = proportion_test(g, "water", seed, lab)
water GH, all sessions, bouts random: 671 neurons of 748 from 6 mice; nonstim 0.069, stim 0.119, t(670) = 0.53, p (two-sided) = 0.596, two-sided 0.596; matched bouts per mouse [0, 5, 2, 2, 2, 4]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-2'): 'nan (0)', np.str_('Cohort13b-M1-3'): '-0.213 (126)', np.str_('Cohort13b-M2-2'): '0.069 (143)', np.str_('Cohort13b-M2-3'): '0.116 (124)', np.str_('Cohort13b-M3-1'): '0.248 (193)', np.str_('Cohort13b-M3-2'): '-0.138 (85)'}
water GH, all sessions, bouts first: 671 neurons of 748 from 6 mice; nonstim 0.074, stim 0.106, t(670) = 0.36, p (two-sided) = 0.723, two-sided 0.723; matched bouts per mouse [0, 5, 2, 2, 2, 4]
reading a over 20 further random draws: median p (two-sided) 0.627, p < 0.05 in 0%
water GH, all sessions, bouts random, exc: 5 mice; nonstim 9.6%, stim 9.4%, t(4) = -0.07, two-sided p = 0.95, one-sided (stim lower) p = 0.475
water GH, all sessions, bouts random, inh: 5 mice; nonstim 8.8%, stim 6.8%, t(4) = -1.81, two-sided p = 0.145, one-sided (stim lower) p = 0.0724
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-3 126 0.0 11.9 0.8 5.6
Cohort13b-M2-2 143 16.1 11.9 13.3 12.6
Cohort13b-M2-3 124 15.3 9.7 8.9 10.5
Cohort13b-M3-1 193 14.5 13.5 10.9 15.5
Cohort13b-M3-2 85 1.2 1.2 0.0 0.0
water GH, all sessions, bouts first, exc: 5 mice; nonstim 8.6%, stim 9.2%, t(4) = 0.22, two-sided p = 0.838, one-sided (stim lower) p = 0.581
water GH, all sessions, bouts first, inh: 5 mice; nonstim 8.3%, stim 5.1%, t(4) = -2.50, two-sided p = 0.0665, one-sided (stim lower) p = 0.0333
reading a over 20 further random draws, two-sided p: exc median 0.761, p < 0.05 in 0%; inh median 0.411, p < 0.05 in 0%
water SI, all sessions, bouts random: 378 neurons of 439 from 5 mice; nonstim -0.011, stim 0.052, t(377) = 0.42, p (two-sided) = 0.674, two-sided 0.674; matched bouts per mouse [0, 5, 4, 1, 2]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-2'): 'nan (0)', np.str_('Cohort13b-M1-3'): '0.253 (59)', np.str_('Cohort13b-M2-3'): '0.342 (62)', np.str_('Cohort13b-M3-1'): '0.009 (183)', np.str_('Cohort13b-M3-2'): '-0.191 (74)'}
water SI, all sessions, bouts first: 377 neurons of 439 from 5 mice; nonstim 0.015, stim 0.150, t(376) = 1.01, p (two-sided) = 0.312, two-sided 0.312; matched bouts per mouse [0, 5, 4, 1, 2]
reading a over 20 further random draws: median p (two-sided) 0.408, p < 0.05 in 0%
water SI, all sessions, bouts random, exc: 4 mice; nonstim 6.7%, stim 7.4%, t(3) = 0.41, two-sided p = 0.709, one-sided (stim lower) p = 0.646
water SI, all sessions, bouts random, inh: 4 mice; nonstim 8.3%, stim 6.8%, t(3) = -0.50, two-sided p = 0.652, one-sided (stim lower) p = 0.326
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-3 59 3.4 1.7 1.7 3.4
Cohort13b-M2-3 62 8.1 3.2 6.5 3.2
Cohort13b-M3-1 183 16.9 16.4 19.1 16.9
Cohort13b-M3-2 74 1.4 5.4 0.0 9.5
water SI, all sessions, bouts first, exc: 4 mice; nonstim 8.8%, stim 8.3%, t(3) = -0.35, two-sided p = 0.752, one-sided (stim lower) p = 0.376
water SI, all sessions, bouts first, inh: 4 mice; nonstim 8.2%, stim 6.7%, t(3) = -0.67, two-sided p = 0.552, one-sided (stim lower) p = 0.276
reading a over 20 further random draws, two-sided p: exc median 0.489, p < 0.05 in 5%; inh median 0.712, p < 0.05 in 0%
Result: reproduced. No water test reaches p < 0.05: responses over neurons, group-housed p = 0.60 and 0.72 (readings a and b), isolated p = 0.67 and 0.31; proportions over mice, group-housed excited p = 0.95 and 0.84, inhibited p = 0.145 and 0.067, isolated (4 mice) excited p = 0.71 and 0.75, inhibited p = 0.65 and 0.55. The smallest, 0.067, is the group-housed inhibited proportion under reading b.**
fig6k-stim-decreases-mpfc-sucrose-gh¶
In group-housed mice, BLA-mPFC stimulation decreases mPFC responses to sucrose, mimicking isolation.
Criterion: as fig6c on sucrose bouts of the group-housed sucrose stimulation session; reproduced when stimulated is below nonstimulated with one-sided p < 0.05.
FIG6K = stim_test(MP_S_GH, "reward", 66, "less", "sucrose GH")
sucrose GH, all sessions, bouts random: 925 neurons of 925 from 8 mice; nonstim 0.009, stim 0.040, t(924) = 0.69, p (less) = 0.756, two-sided 0.489; matched bouts per mouse [11, 4, 8, 2, 5, 15, 16, 8]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-2'): '-0.147 (75)', np.str_('Cohort13b-M1-3'): '0.021 (68)', np.str_('Cohort13b-M2-1'): '0.058 (79)', np.str_('Cohort13b-M2-2'): '0.135 (147)', np.str_('Cohort13b-M2-3'): '-0.097 (135)', np.str_('Cohort13b-M3-1'): '0.077 (183)', np.str_('Cohort13b-M3-2'): '0.024 (112)', np.str_('Cohort13b-M3-3'): '0.082 (126)'}
sucrose GH, all sessions, bouts first: 925 neurons of 925 from 8 mice; nonstim 0.058, stim 0.040, t(924) = -0.39, p (less) = 0.347, two-sided 0.695; matched bouts per mouse [11, 4, 8, 2, 5, 15, 16, 8]
reading a over 20 further random draws: median p (less) 0.622, p < 0.05 in 0%
Result: not reproduced. In the group-housed sucrose session stimulated responses are not below nonstimulated choice-trial ones (reading a 0.040 against 0.009, one-sided p = 0.76; reading b 0.040 against 0.058, p = 0.35; median over 20 further draws 0.62), over 925 neurons from 8 mice.**
fig6lm-stim-fewer-sucrose-excited¶
BLA-mPFC stimulation lowers the proportion of mPFC neurons excited by sucrose, without changing the proportion inhibited.
Criterion: as fig6de on sucrose, group-housed; reproduced when the excited proportion falls with p < 0.05 and the inhibited proportion does not change at p < 0.05; both sidedness readings.
FIG6LM = proportion_test(MP_S_GH, "reward", 67, "sucrose GH")
sucrose GH, all sessions, bouts random, exc: 8 mice; nonstim 6.5%, stim 4.1%, t(7) = -2.13, two-sided p = 0.0706, one-sided (stim lower) p = 0.0353
sucrose GH, all sessions, bouts random, inh: 8 mice; nonstim 3.8%, stim 2.4%, t(7) = -3.13, two-sided p = 0.0166, one-sided (stim lower) p = 0.00828
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-2 75 4.0 12.0 2.7 4.0
Cohort13b-M1-3 68 1.5 2.9 0.0 2.9
Cohort13b-M2-1 79 5.1 3.8 1.3 1.3
Cohort13b-M2-2 147 7.5 9.5 11.6 14.3
Cohort13b-M2-3 135 5.2 5.9 1.5 1.5
Cohort13b-M3-1 183 3.3 2.7 1.1 1.1
Cohort13b-M3-2 112 1.8 4.5 0.0 1.8
Cohort13b-M3-3 126 4.8 10.3 0.8 3.2
sucrose GH, all sessions, bouts first, exc: 8 mice; nonstim 6.7%, stim 4.1%, t(7) = -3.74, two-sided p = 0.00724, one-sided (stim lower) p = 0.00362 sucrose GH, all sessions, bouts first, inh: 8 mice; nonstim 3.4%, stim 2.4%, t(7) = -1.07, two-sided p = 0.32, one-sided (stim lower) p = 0.16
reading a over 20 further random draws, two-sided p: exc median 0.0514, p < 0.05 in 50%; inh median 0.0773, p < 0.05 in 30%
Result: not reproduced, resting on the reading of bout matching. The excited proportion falls with stimulation under both readings, but under the adopted reading a (random matched bouts) not at two-sided p < 0.05 (6.5% to 4.1%, two-sided p = 0.071, one-sided 0.035), and the inhibited proportion also falls (3.8% to 2.4%, two-sided p = 0.017), so neither part of the criterion holds under both sidedness readings. Over 20 further draws the excited p has median 0.051 (below 0.05 in 50%) and the inhibited p median 0.077 (30%). Under reading b (first bouts) the excited proportion falls from 6.7% to 4.1% (two-sided p = 0.0072, one-sided 0.0036) and the inhibited one does not change (p = 0.32), which meets the criterion.**
fig6n-isolation-occludes-sucrose-effect¶
After isolation, BLA-mPFC stimulation no longer changes mPFC responses to sucrose.
Criterion: a claim of absence on the paired t-test over neurons, stimulated against nonstimulated in the isolation sucrose session, two-sided at p < 0.05; reproduced when p >= 0.05.
FIG6N = stim_test(MP_S_SI, "reward", 68, "two-sided", "sucrose SI")
sucrose SI, all sessions, bouts random: 543 neurons of 543 from 6 mice; nonstim -0.032, stim 0.051, t(542) = 1.75, p (two-sided) = 0.0801, two-sided 0.0801; matched bouts per mouse [4, 11, 8, 8, 8, 16]
by mouse, stim minus nonstim (neurons): {np.str_('Cohort13b-M1-1'): '0.176 (65)', np.str_('Cohort13b-M1-2'): '-0.085 (53)', np.str_('Cohort13b-M1-3'): '-0.097 (70)', np.str_('Cohort13b-M2-1'): '0.087 (72)', np.str_('Cohort13b-M2-2'): '0.172 (109)', np.str_('Cohort13b-M3-1'): '0.116 (174)'}
sucrose SI, all sessions, bouts first: 543 neurons of 543 from 6 mice; nonstim -0.036, stim 0.036, t(542) = 1.54, p (two-sided) = 0.123, two-sided 0.123; matched bouts per mouse [4, 11, 8, 8, 8, 16]
reading a over 20 further random draws: median p (two-sided) 0.244, p < 0.05 in 0%
Result: reproduced. In the isolation sucrose session stimulation does not change sucrose responses (two-sided p = 0.080, reading b 0.12; median over 20 further draws 0.24, never below 0.05), over 543 neurons from 6 mice.**
ed8n-stim-fewer-sucrose-inhibited-si¶
During isolation, BLA-mPFC stimulation lowers the proportion of mPFC neurons inhibited by sucrose, with no change in those excited.
Criterion: as fig6lm in the isolation sucrose session, paired over mice, two-sided; reproduced when the inhibited proportion falls with p < 0.05 and the excited proportion does not change at p < 0.05.
ED8N = proportion_test(MP_S_SI, "reward", 69, "sucrose SI")
sucrose SI, all sessions, bouts random, exc: 6 mice; nonstim 2.7%, stim 3.3%, t(5) = 0.97, two-sided p = 0.377, one-sided (stim lower) p = 0.812
sucrose SI, all sessions, bouts random, inh: 6 mice; nonstim 1.7%, stim 0.6%, t(5) = -2.10, two-sided p = 0.0897, one-sided (stim lower) p = 0.0448
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-1 65 4.6 3.1 1.5 3.1
Cohort13b-M1-2 53 0.0 0.0 0.0 0.0
Cohort13b-M1-3 70 0.0 1.4 0.0 0.0
Cohort13b-M2-1 72 5.6 4.2 1.4 4.2
Cohort13b-M2-2 109 9.2 6.4 0.9 2.8
Cohort13b-M3-1 174 0.6 1.1 0.0 0.0
sucrose SI, all sessions, bouts first, exc: 6 mice; nonstim 2.3%, stim 2.8%, t(5) = 0.47, two-sided p = 0.657, one-sided (stim lower) p = 0.672
sucrose SI, all sessions, bouts first, inh: 6 mice; nonstim 1.5%, stim 0.6%, t(5) = -2.70, two-sided p = 0.0426, one-sided (stim lower) p = 0.0213
reading a over 20 further random draws, two-sided p: exc median 0.642, p < 0.05 in 0%; inh median 0.138, p < 0.05 in 5%
Result: not reproduced, resting on the reading of bout matching. Under the adopted reading a the inhibited proportion is lower on stimulated trials (1.7% to 0.6%) but not significantly (two-sided p = 0.090; over 20 further draws median 0.14, below 0.05 in 5%), with no change in the excited proportion (p = 0.38). Under reading b the fall (1.5% to 0.6%) has p = 0.043 with no change in the excited proportion (p = 0.66), which would meet the criterion. The inhibited proportions are a few percent per mouse.**
ed8op-stim-no-alcohol-proportions-si¶
During isolation, BLA-mPFC stimulation does not change the proportions of mPFC neurons excited or inhibited by alcohol.
Criterion: a claim of absence; two-sided paired t-test over the 5 mice of the isolation alcohol session, percentages excited and inhibited per M4, stimulated against nonstimulated, p < 0.05; reproduced when neither reaches p < 0.05.
ED8OP = proportion_test(MP_A_SI, "reward", 70, "alcohol SI")
alcohol SI, all sessions, bouts random, exc: 4 mice; nonstim 4.6%, stim 7.5%, t(3) = 1.85, two-sided p = 0.161, one-sided (stim lower) p = 0.919
alcohol SI, all sessions, bouts random, inh: 4 mice; nonstim 4.6%, stim 2.8%, t(3) = -1.46, two-sided p = 0.24, one-sided (stim lower) p = 0.12
mouse n exc_stim exc_nostim inh_stim inh_nostim
Cohort13b-M1-2 43 4.7 0.0 2.3 7.0
Cohort13b-M2-3 62 11.3 4.8 1.6 4.8
Cohort13b-M3-1 184 11.4 10.9 7.1 6.5
Cohort13b-M3-2 74 2.7 2.7 0.0 0.0
alcohol SI, all sessions, bouts first, exc: 4 mice; nonstim 5.0%, stim 6.3%, t(3) = 1.83, two-sided p = 0.165, one-sided (stim lower) p = 0.917
alcohol SI, all sessions, bouts first, inh: 4 mice; nonstim 4.3%, stim 2.2%, t(3) = -1.12, two-sided p = 0.344, one-sided (stim lower) p = 0.172
reading a over 20 further random draws, two-sided p: exc median 0.16, p < 0.05 in 5%; inh median 0.51, p < 0.05 in 0%
Result: reproduced. Neither proportion changes with stimulation in the isolation alcohol session (excited 4.6% to 7.5%, p = 0.16 and 0.165, inhibited 4.6% to 2.8%, p = 0.24 and 0.34 under readings a and b; over 20 further draws median p 0.16 and 0.51), over the 4 mice with matched choice-trial bouts.**
Blocked: ed9c-coregistered-fraction¶
The claim needs CellReg on the CNMF-E footprints of the four resident-intruder sessions of each mouse. The cell below reads only the metadata of those files: how many ROIs each holds, and whether the footprints are every ROI or only the 199 co-registered neurons the paper reports.
RI = A[A.path.str.endswith("_image+ophys.nwb") & ~A.path.str.contains("behavior")].reset_index(drop=True)
def ri_meta(aid):
f = P.open_asset(aid)
ps = f["processing/ophys/ImageSegmentation/PlaneSegmentation"]
rr = f["processing/ophys/Fluorescence/RoiResponseSeries"]
out = dict(subject=P._text(f["general/subject/subject_id"]), session=P._text(f["session_description"]),
footprints=int(ps["id"].shape[0]), pixels=int(ps["pixel_mask"].shape[0]),
trace_rois=int(rr["data"].shape[1]), frames=int(rr["data"].shape[0]),
acquisition=sorted(f["acquisition"]))
f.close()
return out
RIM = pd.DataFrame(P.parallel(ri_meta, list(RI.asset_id), workers=24))
print(RIM.drop(columns="acquisition").to_string())
print("acquisition groups:", RIM.acquisition.map(tuple).value_counts().to_dict())
print(f"{RIM.subject.nunique()} mice, {len(RIM)} sessions; footprints per session {RIM.footprints.min()} to {RIM.footprints.max()}, "
f"footprints equal trace ROIs in every file: {bool((RIM.footprints == RIM.trace_rois).all())}")
print("ROIs per mouse, smallest session:", RIM.groupby("subject").footprints.min().to_dict(),
f"; sum {RIM.groupby('subject').footprints.min().sum()} against the paper's 199 co-registered neurons from 6 mice")
subject session footprints pixels trace_rois frames
0 M1-1 Pre-SI - no stimulation 123 39177 123 9005
1 M1-1 Pre-SI - stimulation 132 41288 132 9005
2 M1-1 SI - stimulation 136 41622 136 9005
3 M1-1 SI - no stimulation 149 46806 149 9005
4 M1-2 Pre-SI - no stimulation 103 31530 103 9005
5 M1-2 Pre-SI - stimulation 80 24299 80 9006
6 M1-2 SI - stimulation 108 32888 108 9005
7 M1-2 SI - no stimulation 92 27966 92 9006
8 M1-3 Pre-SI - no stimulation 170 58100 170 9005
9 M1-3 Pre-SI - stimulation 128 41592 128 9005
10 M1-3 SI - stimulation 159 50946 159 9005
11 M1-3 SI - no stimulation 147 48340 147 9005
12 M2-1 Pre-SI - stimulation 142 42409 142 9005
13 M2-1 Pre-SI - no stimulation 106 31751 106 9005
14 M2-1 SI - no stimulation 127 35828 127 9005
15 M2-1 SI - stimulation 129 38809 129 9005
16 M2-2 Pre-SI - stimulation 138 45210 138 9005
17 M2-2 Pre-SI - no stimulation 128 43899 128 9005
18 M2-2 SI - no stimulation 118 37685 118 9005
19 M2-2 SI - stimulation 103 30391 103 9005
20 M2-3 Pre-SI - stimulation 191 64022 191 9005
21 M2-3 Pre-SI - no stimulation 137 46886 137 9005
22 M2-3 SI - no stimulation 187 63683 187 9006
23 M2-3 SI - stimulation 168 55833 168 9005
acquisition groups: {('BehaviorVideo', 'Histology data', 'OnePhotonSeries'): 24}
6 mice, 24 sessions; footprints per session 80 to 191, footprints equal trace ROIs in every file: True
ROIs per mouse, smallest session: {'M1-1': 123, 'M1-2': 80, 'M1-3': 128, 'M2-1': 106, 'M2-2': 103, 'M2-3': 137} ; sum 677 against the paper's 199 co-registered neurons from 6 mice
Summary¶
| Claim | Outcome |
|---|---|
| ed5d-cue-response-modest | not reproduced (assumed: cohort to population, cohort 9 left out of the z, "falls back" read as at most half the peak) |
| fig3f-blampfc-distinct-clusters | not reproduced (assumed: cohort to population, cohort 9 left out of the z) |
| ed5ef-alcohol-water-nonoverlapping | reproduced (assumed: cohort to population, cohort 9 left out of the z) |
| fig3h-nonspecific-decoding-85, fig3h-blampfc-decodes-better, ed6b-decoding-above-chance | blocked: too few decoding bouts per mouse |
| fig3k-blampfc-response-predicts-bouts | not reproduced (assumed: cohort to population) |
| fig3ijl-no-other-correlations | reproduced (assumed: cohort to population, cohort 9 left out of the z) |
| ed6ij-cue-responses-no-correlation | not reproduced (assumed: cohort to population) |
| ed6k-bout-duration-not-number | reproduced (assumed: cohort to population) |
| fig5b-isolation-increases-mpfc-alcohol | not reproduced (assumed: random bout matching) |
| fig5c-isolation-no-water-change | reproduced |
| fig5d-isolation-decreases-mpfc-sucrose | not reproduced |
| fig6c-stim-increases-mpfc-alcohol-gh | not reproduced |
| fig6de-stim-fewer-alcohol-inhibited | not reproduced |
| fig6f-stim-decreases-mpfc-alcohol-si | not reproduced |
| fig6gj-stim-no-water-effect | reproduced |
| fig6k-stim-decreases-mpfc-sucrose-gh | not reproduced |
| fig6lm-stim-fewer-sucrose-excited | not reproduced (assumed: random bout matching) |
| fig6n-isolation-occludes-sucrose-effect | reproduced |
| ed8n-stim-fewer-sucrose-inhibited-si | not reproduced (assumed: random bout matching) |
| ed8op-stim-no-alcohol-proportions-si | reproduced |
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: every CNMF-E ROI is used, as the curated neurons are not in the dandiset (1113 nonspecific ROIs against the paper's 540, 347 BLA-mPFC against 196, 748 and 439 mPFC alcohol ROIs against 240 and 281); the populations are assigned to cohorts by their mouse counts; z-scores are left undefined where the baseline s.d. is under 5% of the session s.d., and cohort 9 is left out of the BLA z-scores, as its nonnegative traces sit at 0 between transients (variants: all mice with the floor, and z against the session s.d.); the stimulation claims compare stimulated (type 4) with nonstimulated choice trials (type 3); the files of three sessions whose traces belong to another session are left out; matched bout counts are small (often 1 to 10 per mouse); trial types are as stored; where the forced-trial licks do not match them, types 1 and 2 are swapped, which leaves the choice trials as they are; the sucrose groups hold 8 and 6 mice (paper 7 and 7). The decoding analyses could not be run.
What was found about the dataset: all 53 cued-2BC files carry the same cue times and one of two trial-type sequences, and in every session of 5 of the 9 mPFC mice and in 10 of 11 cohort-16 sessions there are licks on the bottle a forced trial does not offer: in every such mPFC session the forced types 1 and 2 are swapped (alcohol or sucrose licks only on type-1 trials, water licks only on type-2 trials), and 3 cohort-16 sessions are mixed; three pairs of files hold identical imaging with different licks (cohort 16 M1-4 and M2-1, M3-3 and M3-4; cohort 13b M2-2 and M3-2 isolation sucrose); the files hold uncurated ROIs; nothing in the files says which BLA cohort is projection-specific (the virus field is empty); cohort-9 traces are nonnegative with exact zeros, while the Methods say CNMF-E was run without nonnegativity; four mPFC sessions hold 44791 to 65535 frames at 10 Hz (75 to 109 min) for sessions whose last lick is before 3900 s; the alignment of traces and licks could not be shown for 13 of 53 sessions (few bouts or no response peak near lag 0: cohort 13b M1-1 group-housed and isolated alcohol, M1-2 isolated sucrose, M2-1 group-housed and isolated alcohol, M2-2 group-housed sucrose, M3-2 isolated sucrose; cohort 16 M1-2, M2-1, M3-1, M3-2; cohort 9 M5-1, M5-2); the resident-intruder files hold no pose tracking or interaction annotation, but their footprints are every ROI of each session (the ed9c cell), so co-registration could be run with CellReg, which is not available here.
print(f"runtime {(time.time() - t_start) / 60:.1f} min")
runtime 2.2 min