Aery Jones et al. (2021) from dandiset 000165: home cage (rest) sessions¶

Paper. Aery Jones EA, Rao A, Zilberter M, Djukic B, Bant JS, Gillespie AK, Koutsodendris N, Nelson M, Yoon SY, Huang K, Yuan H, Gill TM, Huang Y, Frank LM (2021). Dentate gyrus and CA3 GABAergic interneurons bidirectionally modulate signatures of internal and external drive to CA1. Cell Reports 37, 110159. doi:10.1016/j.celrep.2021.110159. The claims file (claims/jones-2021.yaml) was written from the accepted author manuscript in PubMed Central (PMC9069800) with its main supplement; Table S7 was not available to the reader.

Dandiset. DANDI:000165, version 0.211118.1526 (doi:10.48324/dandi.000165/0.211118.1526). The paper links the draft, not a version. This is the only published version, and the draft has the same 572 assets and size, so the most recent published version is pinned. Files are streamed with remfile and h5py; nothing is written to disk.

Notebooks. rest_home_cage.ipynb tests the claims on the home cage (rest) sessions; run_linear_track.ipynb tests those on the linear track (run) sessions; csd_cohort1.ipynb tests the CSD claim on the single-shank home cage sessions of cohort 1. Methods are in the helper jones2021.py, whose docstring says where each parameter comes from.

Common method (Method M of the claims file). For each feature, a linear mixed model feature ~ treatment + (treatment|animal), fitted by maximum likelihood, with an F test of the treatment coefficient (CNO minus vehicle); the model is fitted exactly from per-mouse, per-treatment sufficient statistics (cell counts, means and sums of squares), which gives the same likelihood as fitting every observation. The genotype test is the likelihood ratio of feature ~ treatment + (treatment|animal) against feature ~ treatment:genotype + (treatment:genotype|animal) on the pooled data, with 9 degrees of freedom as Table S3 gives. Two readings of the log transform are run: (a) log when the within-cell residuals have skewness above 1 (assumption: the Methods log right-skewed features without a rule); (b) log for every feature (the code). Significance is Holm-Bonferroni at 0.05 over the paper's family (24 rest or 36 run comparisons per group or pair), with comparisons not computed here ranked after those computed.

Claim Tested in Status
fig1-tables1-expression none blocked: data_missing (histology not deposited)
figs1ef-exvivo-cno none blocked: data_missing (slice recordings not deposited)
fig2ef-csd-sr csd tested (cohort 1, csd_cohort1.ipynb)
fig3b-mua-during-swr rest tested
fig3c-swr-rate-bidirectional rest tested
fig3d-swr-chains rest tested
fig3e-swr-length-sst rest tested
swr-longer-100ms-sst rest tested
fig3f-swr-frequency-pv rest tested
fig3g-sw-amplitude-pv rest tested
figs2a-swr-size-pv rest tested
tables2-fast-ripples-pv none blocked: data_missing (LFP filtered at 300 Hz, sampled at 1 kHz)
tables2-detection-unchanged rest tested
tables2-rest-sg-pv rest tested
fig4d-swr-sg-power-pv rest tested
fig4e-swr-sg-coherence-pv rest tested
figs2cd-sg-predicts-sw-frequency rest tested
ca3-swr-overlap rest tested
figs3-ca3-swr-pv rest tested
figs3c-ca3-swr-rate-sst rest tested
figs3-dentate-spikes rest tested
fig5b-mua-run to figs5-theta-coherence-frequency (14 claims) run tested
running-speed-unchanged run tested
tables4-genotype-baseline run tested
tables6-sex-swr-size rest and run tested
sex-stratified-effects rest and run tested
figs6-double-like-pv, figs6-double-unlike-sst, figs6-empty-vector-control rest and run tested
In [1]:
import time
import warnings

import numpy as np
import pandas as pd
from scipy import stats

import jones2021 as J

warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 400)
started = time.time()

assets = J.list_assets()
print(f"dandiset {J.DANDISET_ID} version {J.DANDISET_VERSION}: {len(assets)} files, "
      f"{assets['size'].sum() / 1e9:.1f} GB")
print(assets.kind.value_counts().to_string())
hc_assets = assets[assets.kind == "HomeCage"]
meta = hc_assets.merge(J.scan(hc_assets.asset_id.tolist(), workers=16), on="asset_id")
print("metadata read from", len(meta), "home cage files; errors:", int(meta.get("error", pd.Series(dtype=str)).notna().sum()),
      f"({time.time() - started:.0f} s)")
dandiset 000165 version 0.211118.1526: 572 files, 98.0 GB
kind
HomeCage       402
LinearTrack    170
metadata read from 402 home cage files; errors: 0 (21 s)

Data check¶

The file metadata of every home cage file, before any selection.

In [2]:
meta["group"] = [J.group_of(r) for _, r in meta.iterrows()]
meta["minutes"] = meta.n_samples / 1000 / 60
print("Sampling rate(s):", meta.rate.unique(), " LFP unit attribute:", meta.unit.unique())
print("Session descriptions:", meta.description.unique())
print("\nMice and files by probe, group and treatment:")
print(meta.groupby(["probe", "group", "treatment"]).agg(files=("path", "size"), mice=("subject_id", "nunique")).to_string())
print("\nSession length (min) by probe:")
print(meta.groupby("probe").minutes.describe().round(1).to_string())
seq = (meta.sort_values(["subject_id", "session_number"]).groupby("subject_id")
       .agg(group=("group", "first"), probe=("probe", "first"),
            sequence=("treatment", lambda t: "".join("C" if x == "CNO" else "v" for x in t)),
            sessions=("session_number", lambda s: ",".join(map(str, s))),
            minutes=("minutes", "median")))
print("\nTreatment sequence per mouse in session order (v vehicle, C CNO):")
print(seq.round(1).to_string())
dups = meta[meta.duplicated(["subject_id", "session_number", "n_samples", "n_spikes"], keep=False)]
print("\nFiles with the same mouse, session number, LFP length and spike count:")
print(dups[["path", "n_samples", "n_spikes", "start"]].to_string())
Sampling rate(s): [1000.]  LFP unit attribute: <StringArray>
['microvolts']
Length: 1, dtype: str
Session descriptions: <StringArray>
['Home cage recording starting 1 hour after CNO injection']
Length: 1, dtype: str

Mice and files by probe, group and treatment:
                                           files  mice
probe                     group treatment             
A1x32-6mm-50-703-CM32     PV    CNO           19     5
                                Vehicle       15     5
                          SST   CNO           16     4
                                Vehicle       12     4
A4x8-5mm-400-200-703-CM32 EV    CNO           24     8
                                Vehicle       24     8
                          PS    CNO           39    13
                                Vehicle       44    13
                          PV    CNO           56    16
                                Vehicle       48    14
                          SST   CNO           56    16
                                Vehicle       49    14

Session length (min) by probe:
                           count  mean   std   min   25%   50%   75%   max
probe                                                                     
A1x32-6mm-50-703-CM32       62.0  69.1   7.4  60.0  64.3  67.7  70.9  94.1
A4x8-5mm-400-200-703-CM32  340.0  45.7  21.1  12.1  25.1  58.9  63.2  95.9

Treatment sequence per mouse in session order (v vehicle, C CNO):
            group                      probe  sequence            sessions  minutes
subject_id                                                                         
Adobo          PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Anise          EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Aphid          PV      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     71.8
Baharat       SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.0
Bashir         PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     63.3
Basil          PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.0
Beverly        PV  A4x8-5mm-400-200-703-CM32   CCCCCCC  8,9,10,12,15,16,17     62.8
Bones          PV  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     60.7
Caraway        PV  A4x8-5mm-400-200-703-CM32     vvCCC           2,3,4,5,6     25.1
Cardamom      SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Chakotay       PV  A4x8-5mm-400-200-703-CM32  vvCvCvCv     1,1,2,3,4,5,6,7     61.7
Chives         PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Cicada        SST      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     69.2
Cinnamon       PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.4
Cricket       SST      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     70.3
Cumin          PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Dax            PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     61.0
Dill           PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Doctor         PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     61.4
Fenugreek      PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.0
Fruitfly       PV      A1x32-6mm-50-703-CM32    vCvCvC         1,2,3,4,5,7     64.5
GaramMasala    PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Garrett       SST  A4x8-5mm-400-200-703-CM32    vCvCvC         1,2,3,4,5,6     62.3
Grasshopper    PV      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     68.9
Guinan        SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     64.4
Honeybee       PV      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     68.5
Jerk          SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.2
Keeler        SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     64.2
Kes           SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     64.1
Ladybug       SST      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     68.0
Mace          SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Mantis        SST      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     65.3
Neelix        SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     67.0
Nerys          PV  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     67.8
Nutmeg         PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.0
OBrien        SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     63.1
Odo            PV  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     62.9
OldBay         EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Paprika        PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.0
Parsley        PS  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Pepper         EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     24.9
Picard        SST  A4x8-5mm-400-200-703-CM32   CCCCCCC  8,9,10,12,15,16,17     63.3
Provence       EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Quark         SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     61.8
Rain           PV  A4x8-5mm-400-200-703-CM32    vCvCCv         1,2,3,4,6,7     61.1
Riker         SST  A4x8-5mm-400-200-703-CM32   CCCCCCC  8,9,10,12,15,16,17     64.2
Rolypoly       PV      A1x32-6mm-50-703-CM32   vCvCvCC       1,2,3,4,5,6,7     64.6
Rosemary       EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Saffron        EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Sage           EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Salt           PV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.2
Sato          SST  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     62.4
Scotty         PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     62.7
SevenOfNine    PV  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     62.5
Sulu           PV  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     67.9
Sumac          PS  A4x8-5mm-400-200-703-CM32     vvCCC           1,3,4,5,6     25.8
TPol           PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     64.4
Tarragon      SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.1
Thyme          EV  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.3
Tuvok          PS  A4x8-5mm-400-200-703-CM32   vCvCvCv       1,2,3,4,5,6,7     63.4
Vanilla       SST  A4x8-5mm-400-200-703-CM32    vvvCCC         1,2,3,4,5,6     25.2
Worf           PV  A4x8-5mm-400-200-703-CM32   CCCCCCC  8,9,10,12,15,16,17     64.9

Files with the same mouse, session number, LFP length and spike count:
                                                                      path  n_samples  n_spikes                             start
63  sub-Chakotay/sub-Chakotay_ses-Chakotay01-HomeCage_behavior+ecephys.nwb    3701569    174198  2017-07-03T15:06:45.000000-07:00
64  sub-Chakotay/sub-Chakotay_ses-Chakotay01_HomeCage_behavior+ecephys.nwb    3701569    174198  2017-07-03T15:06:45.000000-07:00

Checks of the metadata against the paper and the files:

  • Every file has 32 sites at 1000 Hz with the LFP unit given as microvolts; the session description says "1 hour after CNO injection" for vehicle sessions too.
  • Mice per group match the paper: 5 PV-Cre and 4 SST-Cre on the single-shank probe (cohort 1), and on the 4-shank probe 16 PV-Cre, 16 SST-Cre, 13 PV-Cre/SST-Cre and 8 empty vector mice (cohorts 2 and 3).
  • Four 4-shank mice (Beverly and Worf, PV-Cre; Picard and Riker, SST-Cre) have only sessions labelled CNO, numbered 8 to 17. They give no vehicle sessions, so they are left out: 14 PV-Cre and 14 SST-Cre mice are tested where the paper has 16 each.
  • Cohort 2 mice alternate vehicle and CNO, as the Methods say; cohort 3 mice (25 min home cage sessions) have three vehicle sessions followed by three CNO sessions. Treatment is then confounded with session order in cohort 3.
  • Home cage sessions of cohort 3 last about 25 min (median by mouse in the table); the Methods give 60 min home cage sessions. Many cohort 2 mice have 7 sessions where the Methods give 6.
  • One session, Chakotay01, is deposited twice under two file names with identical LFP length, spike count and start time; it is counted once.
In [3]:
both = seq[seq.sequence.str.contains("v") & seq.sequence.str.contains("C")].index
use = meta[meta.probe.str.contains("A4x8") & meta.subject_id.isin(both)]
use = use.drop_duplicates(["subject_id", "session_number", "n_samples", "n_spikes"])
print("Excluded mice (4-shank) without both treatments:",
      sorted(set(meta[meta.probe.str.contains("A4x8")].subject_id) - set(both)))
print("Files analysed:", len(use), "of", len(meta))
print(use.groupby(["group", "treatment"]).agg(files=("path", "size"), mice=("subject_id", "nunique")).to_string())
t0 = time.time()
results = J.process_many(use.asset_id.tolist(), "HomeCage", workers=4)
errors = [r for r in results if "error" in r]
print(f"processed {len(results)} files in {(time.time() - t0) / 60:.1f} min; failed: {len(errors)}")
for e in errors:
    print("  ", e)
Excluded mice (4-shank) without both treatments: ['Beverly', 'Picard', 'Riker', 'Worf']
Files analysed: 311 of 402
                 files  mice
group treatment             
EV    CNO           24     8
      Vehicle       24     8
PS    CNO           39    13
      Vehicle       44    13
PV    CNO           42    14
      Vehicle       47    14
SST   CNO           42    14
      Vehicle       49    14
processed 311 files in 22.5 min; failed: 0
In [4]:
S = J.session_table(results)
S = S[S.animal.notna()] if "animal" in S else S
print("Sessions skipped:", S[S.skipped.notna()][["session", "skipped"]].to_string() if S.skipped.notna().any() else "none")
S = S[S.skipped.isna()].reset_index(drop=True)
chk = pd.DataFrame([dict(session=results[i]["meta"]["session_id"], group=g,
                         lfp_min=results[i]["lfp_range"][0], lfp_max=results[i]["lfp_range"][1],
                         conversion=results[i]["conv"], pos_hz=results[i]["pos"]["pos_hz"], lfp_t0=results[i]["pos"]["lfp_t0"],
                         pos_t0=results[i]["pos"]["pos_t0"],
                         pos_end_minus_lfp_end=results[i]["pos"]["pos_t1"] - results[i]["n_samples"] / 1000,
                         x_range=np.ptp(results[i]["pos"]["x_range"]), y_range=np.ptp(results[i]["pos"]["y_range"]),
                         rest_min=results[i]["rest_s"] / 60, swr=len(results[i]["swr"]),
                         artifacts=results[i]["n_artifact"],
                         ripple_mean=results[i]["ripple_band"]["mean"], ripple_sd=results[i]["ripple_band"]["sd"],
                         zero_spikes=results[i]["n_zero_spikes"], n_ca1_pyr=len(results[i]["regions"]["ca1_pyr"]),
                         n_ca1_sr=len(results[i]["regions"]["ca1_sr"]), n_ca3=len(results[i]["regions"]["ca3"]),
                         n_dg=len(results[i]["regions"]["dg"]),
                         ca3_swr=len(results[i].get("ca3_swr", [])), ds=len(results[i].get("ds", [])),
                         mua_lag=results[i]["mua_lag"], mua_lag_ratio=results[i]["mua_lag_peak_ratio"],
                         seconds=results[i]["seconds"], maxrss_gb=results[i]["maxrss_kb"] / 1e6)
                    for i, g in zip(S.i, S.group)])
print("Per-session values (ranges over sessions):")
print(chk.drop(columns=["session", "group"]).describe().round(3).T.to_string())
print("\nSessions whose LFP reaches the int16 limits (-32768 or 32767):",
      int(((chk.lfp_max >= 32767) | (chk.lfp_min <= -32768)).sum()), "of", len(chk))
print("Sessions without a 'ca1-pyr 1' site, CA3 or DG sites:",
      int((chk.n_ca1_pyr == 0).sum()), int((chk.n_ca3 == 0).sum()), int((chk.n_dg == 0).sum()))
print("\nSWRs per minute of rest by group and treatment (mean over sessions):")
chk["swr_per_min"] = chk.swr / chk.rest_min
print(chk.assign(treatment=S.treatment).groupby(["group", "treatment"]).swr_per_min.describe().round(2).to_string())
print("\nLFP starting_time (s) over sessions:", sorted(set(chk.lfp_t0)), "; first position timestamp (s):", sorted(set(chk.pos_t0.round(3)))[:5])
off = pd.DataFrame([dict(session=results[i]["meta"]["session_id"], **results[i]["sw_offset"][results[i]["regions"]["ca1_sr_ref"][0]])
                    for i in S.i if results[i]["regions"]["ca1_sr_ref"]])
print("At the SW site (CA1-sr on the SWR shank), per session: median raw LFP over rest and mean of the 0-30 Hz trace (file units):")
print(off[["median_lfp", "mean_sw"]].describe().round(1).T.to_string())
Sessions skipped: none
Per-session values (ranges over sessions):
                       count       mean        std        min        25%        50%        75%        max
lfp_min                311.0 -25316.466   5796.476 -32768.000 -32768.000 -23985.000 -20717.500 -12595.000
lfp_max                311.0  23947.376   7846.413   9906.000  16838.500  23124.000  32767.000  32767.000
conversion             311.0      1.000      0.000      1.000      1.000      1.000      1.000      1.000
pos_hz                 311.0     28.897      3.135     23.438     26.002     27.422     32.154     32.154
lfp_t0                 311.0      0.000      0.000      0.000      0.000      0.000      0.000      0.000
pos_t0                 311.0      0.000      0.000      0.000      0.000      0.000      0.000      0.000
pos_end_minus_lfp_end  311.0      0.057      2.613    -21.803     -0.000      0.025      0.063     28.126
x_range                311.0     20.255      8.213      0.598     21.832     23.178     25.271     28.112
y_range                311.0     13.735      4.840      0.299     14.131     15.327     16.598     20.037
rest_min               311.0     37.344     21.859      8.765     18.048     22.024     59.135     86.077
swr                    311.0    948.778    611.592    118.000    426.000    621.000   1514.500   2471.000
artifacts              311.0    163.643    115.221     17.000     70.000    133.000    236.000    793.000
ripple_mean            311.0     68.773     11.816     36.991     59.844     68.898     75.882    107.522
ripple_sd              311.0     79.914     23.435     23.851     62.878     78.129     96.570    174.312
zero_spikes            311.0     30.968      0.210     29.000     31.000     31.000     31.000     31.000
n_ca1_pyr              311.0      3.379      0.734      1.000      3.000      4.000      4.000      4.000
n_ca1_sr               311.0      2.929      0.958      0.000      2.000      3.000      4.000      4.000
n_ca3                  311.0      3.704      0.917      1.000      3.000      4.000      4.000      6.000
n_dg                   311.0      2.881      1.278      1.000      2.000      3.000      4.000      7.000
ca3_swr                311.0    623.270    420.104     80.000    263.000    414.000   1038.500   1661.000
ds                     311.0  19232.695  12553.566   3203.000   7867.000  11719.000  31378.500  50156.000
mua_lag                311.0     -0.311      0.583     -1.985     -0.465     -0.145     -0.045      1.985
mua_lag_ratio          311.0      6.968      4.564      0.667      3.792      5.647      8.589     24.750
seconds                311.0     17.331      9.481      5.092      9.459     10.794     25.063     83.076
maxrss_gb              311.0      1.711      0.348      0.705      1.530      1.664      2.058      2.069

Sessions whose LFP reaches the int16 limits (-32768 or 32767): 123 of 311
Sessions without a 'ca1-pyr 1' site, CA3 or DG sites: 0 0 0

SWRs per minute of rest by group and treatment (mean over sessions):
                 count   mean   std    min    25%    50%    75%    max
group treatment                                                       
EV    CNO         24.0  28.88  6.55  17.94  23.63  29.86  34.47  37.44
      Vehicle     24.0  23.80  5.32  10.96  21.26  24.41  27.39  31.46
PS    CNO         39.0  24.92  5.92   6.72  22.81  25.50  28.36  35.35
      Vehicle     44.0  23.69  5.42  11.24  21.59  23.91  25.55  37.27
PV    CNO         42.0  27.43  5.22  16.83  22.97  28.25  31.34  35.99
      Vehicle     47.0  23.57  4.63  12.72  20.38  24.87  26.42  32.48
SST   CNO         42.0  24.46  6.29   8.09  20.55  25.85  28.95  34.52
      Vehicle     49.0  25.32  4.69   9.97  22.87  25.62  28.53  32.51

LFP starting_time (s) over sessions: [0.0] ; first position timestamp (s): [0.0]
At the SW site (CA1-sr on the SWR shank), per session: median raw LFP over rest and mean of the 0-30 Hz trace (file units):
            count  mean   std  min   25%   50%   75%    max
median_lfp  308.0  42.7  27.5 -4.0  22.8  39.0  54.2  209.0
mean_sw     308.0  -0.0   0.2 -1.5  -0.1  -0.0   0.0    0.7

Checks of the data:

  • The LFP reaches the int16 limits (-32768 or 32767) in some sessions. The ripple-band envelope mean over rest (ripple_mean above) is close to Table S2's 72.39 uV in file units, which is consistent with the file units being microvolts as the unit attribute says, with the extreme values clipped. The one claim with expected values in microvolts (tables2-rest-sg-pv) is still compared both in file units and scaled by 0.195 (the Intan step), since neither is shown.
  • Every file gives the LFP a starting_time of 0 s, and position timestamps start at 0 s; the LFP is placed on the position clock from its starting_time.
  • At the SW site the median raw LFP over rest and the mean of the 0-30 Hz trace are printed per session: the offsets are small next to the SW amplitudes (fig3g-sw-amplitude-pv).
  • Position is in cm, at 23 to 32 Hz in the home cage, and ends within a fraction of a second of the LFP in most sessions (see pos_end_minus_lfp_end).
  • Rest periods, SWR counts and the number of sites per region are printed per session; every session has a "ca1-pyr 1" site (the SWR site) and CA3 and DG sites.
  • Every unit's spike train begins with a spike at exactly 0.0 s, which is dropped (zero_spikes is about 31 per session).
In [5]:
# Clock check of spikes against the LFP: CA1 MUA around CA1 SWR midpoints, per session
lag_ok = chk.mua_lag_ratio >= J.LAG_MIN_RATIO
print(f"CA1 MUA cross-correlogram with SWR midpoints, +-{J.LAG_MAX_S} s, 10 ms bins (3-bin smoothing):")
print(f"  sessions with a peak at least {J.LAG_MIN_RATIO} times the median: {lag_ok.sum()} of {len(chk)}")
print("  lag of the peak (s), MUA relative to SWR midpoint, those sessions:")
print(chk.mua_lag[lag_ok].describe().round(3).to_string())
print("  sessions with |lag| <= 20 ms:", int((chk.mua_lag[lag_ok].abs() <= 0.02).sum()),
      "; lag < -100 ms:", int((chk.mua_lag[lag_ok] < -0.1).sum()), "; lag > 100 ms:", int((chk.mua_lag[lag_ok] > 0.1).sum()))
sw = pd.concat([results[i]["swr"].assign(group=g) for i, g in zip(S.i, S.group)])
print("\nNormalised CA1 MUA during SWRs (SD units): as deposited mean", round(sw.mua_ca1.mean(), 3),
      "median", round(sw.mua_ca1.median(), 3), "; aligned mean", round(sw.mua_ca1_aligned.mean(), 3),
      "median", round(sw.mua_ca1_aligned.median(), 3), "(n SWRs", sw.mua_ca1_aligned.notna().sum(), ")")
print("Peak memory of the processing workers (GB):", round(chk.maxrss_gb.max(), 2),
      "; mean seconds per file:", round(chk.seconds.mean(), 1))
CA1 MUA cross-correlogram with SWR midpoints, +-2.0 s, 10 ms bins (3-bin smoothing):
  sessions with a peak at least 3.0 times the median: 261 of 311
  lag of the peak (s), MUA relative to SWR midpoint, those sessions:
count    261.000
mean      -0.326
std        0.441
min       -1.985
25%       -0.395
50%       -0.145
75%       -0.055
max        0.945
  sessions with |lag| <= 20 ms: 26 ; lag < -100 ms: 155 ; lag > 100 ms: 1

Normalised CA1 MUA during SWRs (SD units): as deposited mean 0.389 median -0.2 ; aligned mean 1.729 median 1.349 (n SWRs 243051 )
Peak memory of the processing workers (GB): 2.07 ; mean seconds per file: 17.3

Clock of the spikes against the LFP. The paper verified SWR sites by "large increases in MUA during SWRs". CA1 MUA has a clear peak around the SWRs detected on the LFP in most sessions, but the peak is displaced from the SWR midpoint by a session-specific lag, mostly with the MUA earlier, up to about 2 s (summary above); only a few sessions have the peak within 20 ms. With the deposited times the mean normalised CA1 MUA during SWRs is close to 0; with each session's spike times shifted by its lag it is clearly positive. The spike times and the LFP are therefore not on the same clock as deposited. For every measure of MUA locked to events (SWRs, CA3 SWRs, dentate spikes) the main reading uses the shifted spike times, an assumption, and sessions without a clear peak are left out of it; results with the deposited times are shown as variants. MUA rates over rest or run periods (seconds to minutes) are used as deposited.

In [6]:
# SWR-coincident SG power (fig4d): z-score each SWR's power by rest statistics (helper add_swr_sg_z)
USED = J.add_swr_sg_z(results, S)
print("CNO sessions:", len(USED), "; z-scored by an earlier vehicle session:", int(USED.earlier.sum()),
      "; by a later one (no earlier vehicle session):", int((~USED.earlier & USED.vehicle_session.notna()).sum()),
      "; without a vehicle session:", int(USED.vehicle_session.isna().sum()))
sgz = pd.concat([results[i]["swr"][[c for c in ("sg_ca1", "sg_ca3", "sg_dg", "sgcoh_ca3", "sgcoh_dg") if c in results[i]["swr"]]]
                 .assign(treatment=t) for i, t in zip(S.i, S.treatment)])
print("Per-SWR values by treatment (z units for power, coherence difference post minus pre):")
print(sgz.groupby("treatment").describe().T.round(3).to_string())
CNO sessions: 147 ; z-scored by an earlier vehicle session: 147 ; by a later one (no earlier vehicle session): 0 ; without a vehicle session: 0
Per-SWR values by treatment (z units for power, coherence difference post minus pre):
treatment               CNO     Vehicle
sg_ca1    count  133834.000  158450.000
          mean        2.351       1.200
          std         3.033       1.614
          min        -1.013      -1.050
          25%         0.449       0.150
          50%         1.443       0.773
          75%         3.186       1.748
          max        67.543      25.232
sg_ca3    count  135615.000  159455.000
          mean        1.163       0.827
          std         1.799       1.320
          min        -1.124      -1.176
          25%         0.023      -0.050
          50%         0.646       0.474
          75%         1.715       1.307
          max        43.395      19.525
sg_dg     count  135615.000  159455.000
          mean        0.751       0.618
          std         1.380       1.160
          min        -1.160      -1.188
          25%        -0.141      -0.156
          50%         0.393       0.335
          75%         1.220       1.066
          max        44.840      32.977
sgcoh_ca3 count   97375.000  110494.000
          mean       -0.004      -0.007
          std         0.189       0.187
          min        -0.775      -0.793
          25%        -0.134      -0.135
          50%        -0.004      -0.008
          75%         0.125       0.121
          max         0.737       0.758
sgcoh_dg  count   97375.000  110494.000
          mean       -0.014      -0.017
          std         0.198       0.202
          min        -0.841      -0.786
          25%        -0.150      -0.156
          50%        -0.015      -0.019
          75%         0.121       0.120
          max         0.723       0.790
In [7]:
GROUPS = ("PV", "SST", "PS", "EV")
PAIRS = (("PV", "SST"), ("PV", "PS"), ("SST", "PS"))
t0 = time.time()
TAB = J.build_tables(results, S, {**J.REST_FEATURES, **{k: g for k, (_, g) in J.REST_VARIANTS.items()}})
res = J.test_all(TAB, groups=GROUPS, pairs=PAIRS)
counter = {k: m for k, (m, _) in J.REST_VARIANTS.items()}
res = J.add_decisions(res, J.REST_FAMILY, list(J.REST_FEATURES), counter)
print(f"Rest comparisons computed: {len(J.REST_FEATURES)} features of the paper's {J.REST_FAMILY}; "
      f"tests run: {len(res)} ({time.time() - t0:.0f} s)")
print("Observations per feature (all groups):", {k: len(v) for k, v in TAB.items() if k in J.REST_FEATURES})
print(res[res.feature.isin(list(J.REST_FEATURES)) & (res.reading == "a")]
      .pivot_table(index="feature", columns="test", values="p", aggfunc="first").map(lambda v: f"{v:.2g}").to_string())

def part_table(parts):
    t = J.show_parts(res, parts)
    print(t.to_string(index=False, float_format=lambda v: f"{v:.3g}"))
Rest comparisons computed: 22 features of the paper's 24; tests run: 616 (798 s)
Observations per feature (all groups): {'swr_rate': 10732, 'chain': 295070, 'length': 295070, 'freq': 295070, 'sw_amp': 294065, 'size': 295070, 'mua_ca1': 243051, 'mua_ca3': 243051, 'mua_dg': 243051, 'ca3_rate': 10732, 'ca3_length': 193837, 'ca3_freq': 193837, 'ca3_mua': 158351, 'ds_rate': 10732, 'ds_length': 5981368, 'ds_amp': 5981368, 'ds_mua': 4924596, 'sg_ca1': 292284, 'sg_ca3': 295070, 'sg_dg': 295070, 'sgcoh_ca3': 207869, 'sgcoh_dg': 207869}
test             EV       PS       PV PV vs PS PV vs SST     SST SST vs PS
feature                                                                   
ca3_freq       0.35    0.034     0.17     0.96     0.047    0.18      0.02
ca3_length     0.97     0.32     0.29     0.22      0.58    0.15      0.61
ca3_mua        0.16     0.43     0.76     0.91     0.036    0.68      0.34
ca3_rate       0.28    0.016  0.00019     0.95       0.9    0.05      0.62
chain       2.9e-07  4.5e-09     0.48     0.12      0.39  0.0064      0.62
ds_amp         0.17  0.00015  3.4e-05    0.075         1   0.022      0.25
ds_length      0.67     0.41     0.91     0.98         1    0.34      0.99
ds_mua         0.83     0.68     0.97        1    0.0043    0.26      0.44
ds_rate        0.39     0.72      0.4     0.98      0.34   0.071      0.69
freq          0.055  1.6e-06  4.5e-05     0.82      0.97   0.063       0.4
length         0.86     0.52    0.072      0.6       0.3   0.011       0.2
mua_ca1       0.024     0.12     0.12     0.97      0.64     0.3      0.32
mua_ca3         0.2      0.8      0.8     0.98      0.24    0.59      0.75
mua_dg         0.47     0.88    0.094    0.089   9.2e-05   0.094      0.78
sg_ca1      1.6e-05  1.6e-07  1.3e-11     0.98      0.11  0.0095      0.41
sg_ca3        0.019  1.1e-05  0.00046     0.75      0.59    0.23      0.63
sg_dg          0.33    0.071     0.19     0.98         1    0.14      0.93
sgcoh_ca3      0.87     0.35     0.82     0.54     0.077   0.038      0.43
sgcoh_dg       0.27     0.32     0.88        1       0.6   0.082      0.53
size        3.9e-05   0.0018  2.1e-05     0.37      0.71     0.5      0.55
sw_amp         0.03  0.00016  7.8e-08     0.88      0.53  0.0021      0.68
swr_rate     0.0017   0.0092    0.014    0.032      0.67    0.37      0.11

fig3b-mua-during-swr¶

Suppressing either interneuron class increases the recruitment of DG and CA3 MUA to CA1 SWRs, but not of CA1 MUA.

Normalised MUA per SWR (code RTMUA.m normrate, as the criterion says) at each region's MUA site. The main reading uses spike times shifted by the session's offset (data check); the deposited times are shown below. Reading (a) logs features whose within-cell residuals are right skewed, (b) logs all.

In [8]:
parts = [("mua_ca1", "PV", "ns"), ("mua_ca1", "SST", "ns"), ("mua_ca3", "PV", "up"), ("mua_ca3", "SST", "up"),
         ("mua_dg", "PV", "up"), ("mua_dg", "SST", "up")]
part_table(parts)
print("\nAs deposited (no clock correction):")
part_table([(f + "_deposited", g, e) for f, g, e in parts])
feature test expected reading  log    coef   stat      p  significant  holds  animals     n
mua_ca1   PV       ns       a True  0.0889   2.45  0.118        False   True       14 83099
mua_ca1   PV       ns       b True  0.0889   2.45  0.118        False   True       14 83099
mua_ca1  SST       ns       a True  -0.073   1.08  0.299        False   True       14 74408
mua_ca1  SST       ns       b True  -0.073   1.08  0.299        False   True       14 74408
mua_ca3   PV       up       a True -0.0163 0.0646  0.799        False  False       14 83099
mua_ca3   PV       up       b True -0.0163 0.0646  0.799        False  False       14 83099
mua_ca3  SST       up       a True -0.0231  0.284  0.594        False  False       14 74408
mua_ca3  SST       up       b True -0.0231  0.284  0.594        False  False       14 74408
 mua_dg   PV       up       a True  -0.167    2.8 0.0941        False  False       14 83099
 mua_dg   PV       up       b True  -0.167    2.8 0.0941        False  False       14 83099
 mua_dg  SST       up       a True   0.108    2.8 0.0943        False  False       14 74408
 mua_dg  SST       up       b True   0.108    2.8 0.0943        False  False       14 74408

As deposited (no clock correction):
          feature test expected reading  log      coef     stat      p  significant  holds  animals      n
mua_ca1_deposited   PV       ns       a True      0.12     4.56 0.0327        False   True       14  93269
mua_ca1_deposited   PV       ns       b True      0.12     4.56 0.0327        False   True       14  93269
mua_ca1_deposited  SST       ns       a True -0.000168 4.42e-06  0.998        False   True       14 101653
mua_ca1_deposited  SST       ns       b True -0.000168 4.42e-06  0.998        False   True       14 101653
mua_ca3_deposited   PV       up       a True      0.13     4.35 0.0371        False  False       14  93269
mua_ca3_deposited   PV       up       b True      0.13     4.35 0.0371        False  False       14  93269
mua_ca3_deposited  SST       up       a True    0.0202    0.266  0.606        False  False       14 101653
mua_ca3_deposited  SST       up       b True    0.0202    0.266  0.606        False  False       14 101653
 mua_dg_deposited   PV       up       a True   -0.0664     1.93  0.165        False  False       14  93269
 mua_dg_deposited   PV       up       b True   -0.0664     1.93  0.165        False  False       14  93269
 mua_dg_deposited  SST       up       a True    0.0743     3.04  0.081        False  False       14 101653
 mua_dg_deposited  SST       up       b True    0.0743     3.04  0.081        False  False       14 101653

Result: not reproduced. With the spike times aligned to the SWRs, CA1 MUA recruitment does not change (PV-Cre p = 0.12, SST-Cre p = 0.30), as the claim says, but neither does CA3 MUA (p = 0.80 and 0.59) nor DG MUA (p = 0.09 and 0.09, the PV-Cre coefficient negative). With the deposited spike times no CA3 or DG increase is significant either. Both log readings give the same result. The outcome rests on the clock alignment, an assumption.

fig3c-swr-rate-bidirectional¶

Suppressing PV+ interneurons increases CA1 SWR rate while suppressing SST+ interneurons decreases it, and the two effects differ significantly.

SWR counts per complete 1 min bin of rest. The code's 5 SD events are a variant.

In [9]:
part_table([("swr_rate", "PV", "up"), ("swr_rate", "SST", "down"), ("swr_rate", "PV vs SST", "sig")])
print("\n5 SD variant:")
part_table([("swr_rate_5sd", "PV", "up"), ("swr_rate_5sd", "SST", "down"), ("swr_rate_5sd", "PV vs SST", "sig")])
r = pd.DataFrame([dict(group=g, treatment=tr, animal=a, rate=np.mean(J.REST_FEATURES["swr_rate"](results[i])))
                  for i, g, tr, a in zip(S.i, S.group, S.treatment, S.animal)])
m = r.groupby(["group", "animal", "treatment"]).rate.mean().unstack()
print("\nSWRs per min, mean over mice of the mouse mean, and mice whose rate rose with CNO:")
print(pd.DataFrame({"vehicle": m.Vehicle.groupby(level=0).mean(), "CNO": m.CNO.groupby(level=0).mean(),
                    "rose": (m.CNO > m.Vehicle).groupby(level=0).sum(), "mice": m.dropna().groupby(level=0).size()}).round(2).to_string())
 feature      test expected reading   log    coef   stat        p  significant  holds  animals    n  p_df5 significant_df5
swr_rate        PV       up       a False    4.24   6.04   0.0141        False  False       14 3427    NaN             NaN
swr_rate        PV       up       b  True   0.332     33 1.01e-08         True   True       14 3427    NaN             NaN
swr_rate       SST     down       a False   -1.12  0.798    0.372        False  False       14 3754    NaN             NaN
swr_rate       SST     down       b  True -0.0141 0.0393    0.843        False  False       14 3754    NaN             NaN
swr_rate PV vs SST      sig       a False   -5.27    6.7    0.668        False  False       28 7181  0.244           False
swr_rate PV vs SST      sig       b  True  -0.346   14.9   0.0932        False  False       28 7181 0.0107           False

5 SD variant:
     feature      test expected reading   log   coef   stat        p  significant  holds  animals    n  p_df5 significant_df5
swr_rate_5sd        PV       up       a False   3.34   5.59   0.0181        False  False       14 3427    NaN             NaN
swr_rate_5sd        PV       up       b  True  0.347   26.2 3.19e-07         True   True       14 3427    NaN             NaN
swr_rate_5sd       SST     down       a False  -1.03  0.997    0.318        False  False       14 3754    NaN             NaN
swr_rate_5sd       SST     down       b  True 0.0141 0.0333    0.855        False  False       14 3754    NaN             NaN
swr_rate_5sd PV vs SST      sig       a False  -4.33   6.72    0.666        False  False       28 7181  0.242           False
swr_rate_5sd PV vs SST      sig       b  True -0.332   12.9    0.168        False  False       28 7181 0.0246           False

SWRs per min, mean over mice of the mouse mean, and mice whose rate rose with CNO:
       vehicle    CNO  rose  mice
group                            
EV       25.00  30.67     6     8
PS       24.66  25.70     8    13
PV       24.09  28.49    10    14
SST      25.93  25.34     6    14

Result: not reproduced. Under reading (b), log for all features, SWR rate rises with PV+ suppression (coefficient 0.33 on the log scale, p = 1.0e-08), but under reading (a), where the rate is not logged, the PV-Cre rise (+4.2 per min, p = 0.014) does not pass Holm. SST+ suppression does not decrease the rate under either reading (p = 0.37 and 0.84), and the genotype test is not significant (p = 0.67 and 0.093). The 5 SD variant gives the same pattern. The empty vector mice also have a higher rate on CNO days (Summary table of the data check: 23.8 against 28.9 SWRs per min of rest), which points to the session order.

fig3d-swr-chains¶

Suppressing either interneuron class decreases the proportion of SWRs that occur in chains (within 200 ms of another SWR).

In [10]:
part_table([("chain", "PV", "down"), ("chain", "SST", "down")])
print("\n5 SD variant:")
part_table([("chain_5sd", "PV", "down"), ("chain_5sd", "SST", "down")])
feature test expected reading  log    coef  stat       p  significant  holds  animals      n
  chain   PV     down       a True -0.0556 0.491   0.483        False  False       14  93269
  chain   PV     down       b True -0.0556 0.491   0.483        False  False       14  93269
  chain  SST     down       a True -0.0931  7.42 0.00644        False  False       14 101653
  chain  SST     down       b True -0.0931  7.42 0.00644        False  False       14 101653

5 SD variant:
  feature test expected reading  log    coef  stat        p  significant  holds  animals     n
chain_5sd   PV     down       a True -0.0805 0.881    0.348        False  False       14 73333
chain_5sd   PV     down       b True -0.0805 0.881    0.348        False  False       14 73333
chain_5sd  SST     down       a True  -0.117  12.4 0.000439         True   True       14 77387
chain_5sd  SST     down       b True  -0.117  12.4 0.000439         True   True       14 77387

Result: not reproduced. The proportion of SWRs in chains does not decrease significantly with PV+ suppression (p = 0.48) and falls with SST+ suppression without passing Holm (p = 0.0064). With the code's 5 SD events the SST-Cre decrease is significant (p = 0.00044) and the PV-Cre effect is not (p = 0.35).

fig3e-swr-length-sst¶

Suppressing SST+ interneurons lengthens CA1 SWRs, an effect not seen with PV+ suppression, and the genotypes differ.

In [11]:
part_table([("length", "SST", "up"), ("length", "PV", "ns"), ("length", "PV vs SST", "sig")])
print("\n5 SD variant:")
part_table([("length_5sd", "SST", "up"), ("length_5sd", "PV", "ns"), ("length_5sd", "PV vs SST", "sig")])
feature      test expected reading  log    coef  stat      p  significant  holds  animals      n  p_df5 significant_df5
 length       SST       up       a True  0.0244   6.4 0.0114        False  False       14 101653    NaN             NaN
 length       SST       up       b True  0.0244   6.4 0.0114        False  False       14 101653    NaN             NaN
 length        PV       ns       a True -0.0231  3.23 0.0724        False   True       14  93269    NaN             NaN
 length        PV       ns       b True -0.0231  3.23 0.0724        False   True       14  93269    NaN             NaN
 length PV vs SST      sig       a True  0.0475  10.7    0.3        False  False       28 194922 0.0586           False
 length PV vs SST      sig       b True  0.0475  10.7    0.3        False  False       28 194922 0.0586           False

5 SD variant:
   feature      test expected reading  log   coef  stat       p  significant  holds  animals      n  p_df5 significant_df5
length_5sd       SST       up       a True 0.0277  7.67 0.00563        False  False       14  77387    NaN             NaN
length_5sd       SST       up       b True 0.0277  7.67 0.00563        False  False       14  77387    NaN             NaN
length_5sd        PV       ns       a True -0.031  4.39  0.0361        False   True       14  73333    NaN             NaN
length_5sd        PV       ns       b True -0.031  4.39  0.0361        False   True       14  73333    NaN             NaN
length_5sd PV vs SST      sig       a True 0.0587  12.5   0.187        False  False       28 150720 0.0287           False
length_5sd PV vs SST      sig       b True 0.0587  12.5   0.187        False  False       28 150720 0.0287           False

Result: not reproduced. SWRs lengthen with SST+ suppression on the log scale (coefficient 0.024, p = 0.011), which does not pass Holm; the PV-Cre effect is not significant (p = 0.072) and the genotype test is not (p = 0.30). The 5 SD variant gives p = 0.0057 for SST-Cre, also short of the threshold.

swr-longer-100ms-sst¶

With SST+ suppression the percentage of SWRs longer than 100 ms rises from 38.5% under vehicle to 49.6% under CNO.

Readings of the denominator: (a) the valid SWRs; (b) every detected event (before the edge and artifact rules). Of pooling: (c) pooled over a treatment's sessions; (d) mean of session fractions. The code's >= 100 ms is a variant. Expected 38.5 +/- 3.85 and 49.6 +/- 4.96 %.

In [12]:
rows = []
for i, g, tr, a in zip(S.i, S.group, S.treatment, S.animal):
    for den, L in (("a valid", results[i]["swr"].length.values), ("b all detected", results[i]["all_event_lengths"])):
        for op, f in (("> 100 ms", lambda x: x > 0.1 + 1e-9), (">= 100 ms", lambda x: x >= 0.1 - 1e-9)):
            rows.append(dict(group=g, animal=a, treatment=tr, denominator=den, rule=op, n=len(L), long=int(f(L).sum())))
L = pd.DataFrame(rows)
out = []
for (den, op), d in L[L.group == "SST"].groupby(["denominator", "rule"]):
    pooled = d.groupby(["animal", "treatment"])[["long", "n"]].sum()
    pooled = (100 * pooled.long / pooled.n).unstack()
    sess = d.assign(f=100 * d.long / d.n).groupby(["animal", "treatment"]).f.mean().unstack()
    for pool, m in (("c pooled", pooled), ("d session mean", sess)):
        m = m.dropna()
        tt = stats.ttest_rel(m.CNO, m.Vehicle)
        out.append(dict(denominator=den, rule=op, pooling=pool, mice=len(m), vehicle=m.Vehicle.mean(), CNO=m.CNO.mean(),
                        t=tt.statistic, p=tt.pvalue,
                        within_tol=abs(m.Vehicle.mean() - 38.5) <= 3.85 and abs(m.CNO.mean() - 49.6) <= 4.96))
out = pd.DataFrame(out)
print(out.to_string(index=False, float_format=lambda v: f"{v:.3g}"))
print("\nPV-Cre, reading (a)(c), for reference:")
d = L[(L.group == "PV") & (L.denominator == "a valid") & (L.rule == "> 100 ms")].groupby(["animal", "treatment"])[["long", "n"]].sum()
d = (100 * d.long / d.n).unstack().dropna()
print(f"vehicle {d.Vehicle.mean():.1f}%  CNO {d.CNO.mean():.1f}%  paired t p = {stats.ttest_rel(d.CNO, d.Vehicle).pvalue:.3g}  ({len(d)} mice)")
   denominator      rule        pooling  mice  vehicle  CNO    t      p  within_tol
       a valid  > 100 ms       c pooled    14     38.1 40.7 2.43 0.0304       False
       a valid  > 100 ms d session mean    14     38.3 41.4  2.2 0.0466       False
       a valid >= 100 ms       c pooled    14     39.2 41.8 2.31 0.0378       False
       a valid >= 100 ms d session mean    14     39.5 42.5 2.12 0.0537       False
b all detected  > 100 ms       c pooled    14     41.6 44.4 2.12 0.0537       False
b all detected  > 100 ms d session mean    14     41.8   45 1.98 0.0697        True
b all detected >= 100 ms       c pooled    14     42.7 45.5 2.04 0.0621       False
b all detected >= 100 ms d session mean    14       43 46.1 1.91 0.0779       False

PV-Cre, reading (a)(c), for reference:
vehicle 37.4%  CNO 35.6%  paired t p = 0.256  (14 mice)

Result: not reproduced. In SST-Cre mice the percentage of SWRs longer than 100 ms rises with CNO under every reading (paired t p from 0.030 to 0.078). With the valid SWRs (reading a) the CNO values (40.7 to 42.5%) are below the expected 49.6 +/- 4.96%. With every detected event and session means (b, d) both values are within tolerance (41.8 and 45.0%), but the paired t test gives p = 0.070, so no reading has both values in tolerance and p < 0.05. 14 SST-Cre mice are tested, not 16.

fig3f-swr-frequency-pv¶

PV+, but not SST+, interneuron suppression increases the instantaneous frequency of CA1 SWRs.

In [13]:
part_table([("freq", "PV", "up"), ("freq", "SST", "ns")])
print("\nGenotype test, reported:")
part_table([("freq", "PV vs SST", "sig")])
print("\n5 SD variant:")
part_table([("freq_5sd", "PV", "up"), ("freq_5sd", "SST", "ns")])
feature test expected reading   log    coef  stat        p  significant  holds  animals      n
   freq   PV       up       a False    4.16  16.6 4.51e-05         True   True       14  93269
   freq   PV       up       b  True  0.0265  17.1 3.64e-05         True   True       14  93269
   freq  SST       ns       a False    1.42  3.45   0.0631        False   True       14 101653
   freq  SST       ns       b  True 0.00916  3.51    0.061        False   True       14 101653

Genotype test, reported:
feature      test expected reading   log    coef  stat     p  significant  holds  animals      n  p_df5  significant_df5
   freq PV vs SST      sig       a False   -2.76  2.95 0.966        False  False       28 194922  0.708            False
   freq PV vs SST      sig       b  True -0.0174  7.73 0.562        False  False       28 194922  0.172            False

5 SD variant:
 feature test expected reading   log   coef  stat        p  significant  holds  animals     n
freq_5sd   PV       up       a False   4.34    18 2.16e-05         True   True       14 73333
freq_5sd   PV       up       b  True 0.0275  17.8 2.43e-05         True   True       14 73333
freq_5sd  SST       ns       a False   1.61  4.32   0.0377        False   True       14 77387
freq_5sd  SST       ns       b  True 0.0104  4.22   0.0399        False   True       14 77387

Result: reproduced. SWR instantaneous frequency rises with PV+ suppression (+4.2 Hz, p = 4.5e-05 untransformed; p = 3.6e-05 logged) and does not change significantly with SST+ suppression (p = 0.063 and 0.061). The genotype test, reported only, is not significant (p = 0.97 and 0.56). The 5 SD variant agrees.

fig3g-sw-amplitude-pv¶

PV+, but not SST+, suppression increases sharp-wave amplitude in CA1, and the genotypes differ.

Reading (a) one CA1-sr site (on the shank of the SWR site); (b) every CA1-sr site, one value per SWR and site.

In [14]:
part_table([("sw_amp", "PV", "up"), ("sw_amp", "SST", "ns"), ("sw_amp", "PV vs SST", "sig")])
print("\nReading (b), every CA1-sr site:")
part_table([("sw_amp_all_sr_sites", "PV", "up"), ("sw_amp_all_sr_sites", "SST", "ns"), ("sw_amp_all_sr_sites", "PV vs SST", "sig")])
print("\n5 SD variant:")
part_table([("sw_amp_5sd", "PV", "up"), ("sw_amp_5sd", "SST", "ns"), ("sw_amp_5sd", "PV vs SST", "sig")])
print("\nSW amplitude range over SWRs (file units):", round(sw.sw_amp.min(), 1), "to", round(sw.sw_amp.max(), 1),
      "; median", round(sw.sw_amp.median(), 1))
print("\nVariant: SW amplitude of the 0-30 Hz trace as filtered (no mean removed):")
part_table([("sw_amp_raw", "PV", "up"), ("sw_amp_raw", "SST", "ns"), ("sw_amp_raw", "PV vs SST", "sig")])
print("\nVariant: maximum deviation from the median of the 200 ms before the SWR:")
part_table([("sw_amp_base", "PV", "up"), ("sw_amp_base", "SST", "ns"), ("sw_amp_base", "PV vs SST", "sig")])
print("\nVehicle means over mice of each mouse's mean SW amplitude (file units), against Table S4's 375 (PV-Cre) and 385 (SST-Cre) uV:")
m = pd.concat([results[i]["swr"][["sw_amp", "sw_amp_raw", "sw_amp_base"]].assign(group=g, animal=a, treatment=t)
               for i, g, a, t in zip(S.i, S.group, S.animal, S.treatment) if "sw_amp" in results[i]["swr"]])
vm = m[m.treatment == "Vehicle"].groupby(["group", "animal"]).mean(numeric_only=True).groupby(level=0).mean()
print(vm.round(1).to_string())
print("Scaled by 0.195:"); print((vm * 0.195).round(1).to_string())
feature      test expected reading  log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
 sw_amp        PV       up       a True   0.208  28.9 7.81e-08         True   True       14  92264    NaN             NaN
 sw_amp        PV       up       b True   0.208  28.9 7.81e-08         True   True       14  92264    NaN             NaN
 sw_amp       SST       ns       a True   0.132  9.49  0.00207         True  False       14 101653    NaN             NaN
 sw_amp       SST       ns       b True   0.132  9.49  0.00207         True  False       14 101653    NaN             NaN
 sw_amp PV vs SST      sig       a True -0.0762  8.08    0.526        False  False       28 193917  0.152           False
 sw_amp PV vs SST      sig       b True -0.0762  8.08    0.526        False  False       28 193917  0.152           False

Reading (b), every CA1-sr site:
            feature      test expected reading  log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
sw_amp_all_sr_sites        PV       up       a True   0.224  31.3 2.24e-08         True   True       14 288354    NaN             NaN
sw_amp_all_sr_sites        PV       up       b True   0.224  31.3 2.24e-08         True   True       14 288354    NaN             NaN
sw_amp_all_sr_sites       SST       ns       a True   0.125  10.6  0.00111         True  False       14 277007    NaN             NaN
sw_amp_all_sr_sites       SST       ns       b True   0.125  10.6  0.00111         True  False       14 277007    NaN             NaN
sw_amp_all_sr_sites PV vs SST      sig       a True -0.0986  9.07    0.431        False  False       28 565361  0.106           False
sw_amp_all_sr_sites PV vs SST      sig       b True -0.0986  9.07    0.431        False  False       28 565361  0.106           False

5 SD variant:
   feature      test expected reading   log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
sw_amp_5sd        PV       up       a False     799  32.8 1.01e-08         True   True       14  72560    NaN             NaN
sw_amp_5sd        PV       up       b  True   0.206  28.6 8.79e-08         True   True       14  72560    NaN             NaN
sw_amp_5sd       SST       ns       a False     435  14.3 0.000159         True  False       14  77387    NaN             NaN
sw_amp_5sd       SST       ns       b  True   0.144  12.7 0.000359         True  False       14  77387    NaN             NaN
sw_amp_5sd PV vs SST      sig       a False    -366  5.86    0.754        False  False       28 149947   0.32           False
sw_amp_5sd PV vs SST      sig       b  True -0.0618  7.72    0.562        False  False       28 149947  0.172           False

SW amplitude range over SWRs (file units): 297.9 to 19714.7 ; median 3273.6

Variant: SW amplitude of the 0-30 Hz trace as filtered (no mean removed):
   feature      test expected reading  log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
sw_amp_raw        PV       up       a True   0.208  28.9 7.79e-08         True   True       14  92264    NaN             NaN
sw_amp_raw        PV       up       b True   0.208  28.9 7.79e-08         True   True       14  92264    NaN             NaN
sw_amp_raw       SST       ns       a True   0.132  9.53  0.00203         True  False       14 101653    NaN             NaN
sw_amp_raw       SST       ns       b True   0.132  9.53  0.00203         True  False       14 101653    NaN             NaN
sw_amp_raw PV vs SST      sig       a True -0.0762  8.08    0.526        False  False       28 193917  0.152           False
sw_amp_raw PV vs SST      sig       b True -0.0762  8.08    0.526        False  False       28 193917  0.152           False

Variant: maximum deviation from the median of the 200 ms before the SWR:
    feature      test expected reading  log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
sw_amp_base        PV       up       a True   0.204  36.2 1.82e-09         True   True       14  92264    NaN             NaN
sw_amp_base        PV       up       b True   0.204  36.2 1.82e-09         True   True       14  92264    NaN             NaN
sw_amp_base       SST       ns       a True   0.134  9.58  0.00197         True  False       14 101653    NaN             NaN
sw_amp_base       SST       ns       b True   0.134  9.58  0.00197         True  False       14 101653    NaN             NaN
sw_amp_base PV vs SST      sig       a True -0.0699  8.52    0.483        False  False       28 193917   0.13           False
sw_amp_base PV vs SST      sig       b True -0.0699  8.52    0.483        False  False       28 193917   0.13           False

Vehicle means over mice of each mouse's mean SW amplitude (file units), against Table S4's 375 (PV-Cre) and 385 (SST-Cre) uV:
       sw_amp  sw_amp_raw  sw_amp_base
group                                 
EV     3148.9      3148.9       2963.9
PS     3319.7      3319.7       3087.0
PV     3246.3      3246.3       3039.8
SST    2998.8      2998.8       2799.5
Scaled by 0.195:
       sw_amp  sw_amp_raw  sw_amp_base
group                                 
EV      614.0       614.0        578.0
PS      647.3       647.3        602.0
PV      633.0       633.0        592.8
SST     584.8       584.8        545.9

Result: not reproduced. SW amplitude rises with PV+ suppression (p = 7.8e-08), but it also rises with SST+ suppression (p = 0.00207, just below the first Holm threshold of 0.05/24 = 0.00208), and the genotype test is not significant (p = 0.53; p = 0.15 with 5 degrees of freedom). Every CA1-sr site (reading b, SST-Cre p = 0.0011), the 5 SD SWRs (p = 0.00016), the trace without its mean removed (p = 0.0020) and the deviation from the median of the 200 ms before the SWR (p = 0.0020) give the same pattern. The measure is not dominated by an offset: the median raw LFP at the SW site is 39 file units (data check) against SW amplitudes with a median of 3274, and removing the mean changes nothing. The vehicle means are 3246 (PV-Cre) and 2999 (SST-Cre) file units against Table S4's 375 and 385 uV, about 8 times larger, so the paper's SW measure differs from this one in a way the Methods do not explain.

figs2a-swr-size-pv¶

SWR size is smaller when PV+ interneurons are suppressed, despite no change in CA1 MUA recruitment.

In [15]:
part_table([("size", "PV", "down")])
print("\nReported: SST-Cre, genotype test, and the 5 SD variant:")
part_table([("size", "SST", "ns"), ("size", "PV vs SST", "sig"), ("size_5sd", "PV", "down")])
feature test expected reading   log    coef  stat        p  significant  holds  animals     n
   size   PV     down       a False  -0.424  18.1 2.14e-05         True   True       14 93269
   size   PV     down       b  True -0.0478  14.4 0.000144         True   True       14 93269

Reported: SST-Cre, genotype test, and the 5 SD variant:
 feature      test expected reading   log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
    size       SST       ns       a False  -0.091 0.448    0.503        False   True       14 101653    NaN             NaN
    size       SST       ns       b  True -0.0122 0.513    0.474        False   True       14 101653    NaN             NaN
    size PV vs SST      sig       a False   0.333  6.25    0.715        False  False       28 194922  0.283           False
    size PV vs SST      sig       b  True  0.0356  4.79    0.852        False  False       28 194922  0.442           False
size_5sd        PV     down       a False  -0.527  26.6 2.51e-07         True   True       14  73333    NaN             NaN
size_5sd        PV     down       b  True -0.0596  25.9 3.58e-07         True   True       14  73333    NaN             NaN

Result: reproduced. SWR size falls with PV+ suppression (-0.42 SD, p = 2.1e-05; logged p = 0.00014) and does not change with SST+ suppression (p = 0.50). The 5 SD variant agrees (p = 2.5e-07). The claim's "despite no change in CA1 MUA recruitment" matches fig3b-mua-during-swr (PV-Cre p = 0.12).

tables2-detection-unchanged¶

The SWR rate changes are not due to differences in SWR detection (ripple band mean and SD) or in baseline MUA, which do not change with treatment in either genotype.

Per mouse and treatment, means over sessions; the test as Table S2's note (paired t when the differences pass Shapiro-Wilk and the variances an F test, else Wilcoxon), p < 0.05. MUA at each region's MUA site; rest MUA rates do not depend on the spike clock offset at this scale (100 ms bins over periods of minutes).

In [16]:
rows = []
for i, g, tr, a in zip(S.i, S.group, S.treatment, S.animal):
    r = results[i]
    rows.append(dict(group=g, animal=a, cno=int(tr == "CNO"), ripple_mean=r["ripple_band"]["mean"],
                     ripple_sd=r["ripple_band"]["sd"], mua_ca1=r.get("rest_mua_ca1"), mua_ca3=r.get("rest_mua_ca3"),
                     mua_dg=r.get("rest_mua_dg")))
D = pd.DataFrame(rows)
out = []
for g in ("PV", "SST"):
    for v in ("ripple_mean", "ripple_sd", "mua_ca1", "mua_ca3", "mua_dg"):
        m = D[D.group == g].groupby(["animal", "cno"])[v].mean().unstack()
        out.append(dict(group=g, measure=v, **J.paired(m)))
out = pd.DataFrame(out)
out["significant"] = out.p < 0.05
print(out.to_string(index=False, float_format=lambda v: f"{v:.3g}"))
group     measure  n  veh  cno    diff       t    p_t  p_wilcoxon     test      p  significant
   PV ripple_mean 14 71.3 69.6   -1.69  -0.676  0.511       0.358 paired t  0.511        False
   PV   ripple_sd 14 84.2 85.6    1.45   0.334  0.744       0.903 paired t  0.744        False
   PV     mua_ca1 14  7.9  8.3   0.403   0.395  0.699       0.583 paired t  0.699        False
   PV     mua_ca3 14  8.8 11.9    3.11    2.09 0.0573       0.194 Wilcoxon  0.194        False
   PV      mua_dg 14 6.65 6.61 -0.0423 -0.0368  0.971           1 paired t  0.971        False
  SST ripple_mean 14 68.4 65.1    -3.3   -1.29  0.221       0.217 paired t  0.221        False
  SST   ripple_sd 14 76.3 74.1   -2.21  -0.557  0.587       0.583 paired t  0.587        False
  SST     mua_ca1 14   13 8.16   -4.85   -1.41  0.182      0.0494 Wilcoxon 0.0494         True
  SST     mua_ca3 14  4.3 5.13   0.833   0.615  0.549       0.855 Wilcoxon  0.855        False
  SST      mua_dg 14 6.61 9.28    2.67    1.47  0.166       0.268 Wilcoxon  0.268        False

Result: not reproduced. Of the ten tests of the claim of absence, nine are not significant, but rest CA1 MUA in SST-Cre mice is: the differences fail the normality or variance check, so the Table S2 rule takes the Wilcoxon test, which gives p = 0.049 (the paired t test gives p = 0.18; mean 13.0 against 8.2 spikes/s). The ripple band mean and SD do not change in either genotype (p from 0.22 to 0.74). The one failure is marginal and the effect is a decrease, not a change in detection.

tables2-rest-sg-pv¶

Suppressing PV+ interneurons raises SG power in CA1 across all rest and raises its variance in CA1, CA3 and DG; suppressing SST+ interneurons does not change baseline SG power.

Readings: (a) squared Hilbert envelope of the 30-50 Hz filtered trace; (b) multitaper band power (uV^2/Hz in file units). The expected values (109.51 and 127.6 uV^2) are compared under each reading in file units and with the file values scaled by 0.195 uV per unit (see the data check).

In [17]:
rows = []
for i, g, tr, a in zip(S.i, S.group, S.treatment, S.animal):
    r = results[i]
    for reading, key in (("a envelope^2", "rest_sg"), ("b multitaper", "rest_sg_mt")):
        for reg, v in r[key].items():
            rows.append(dict(group=g, animal=a, cno=int(tr == "CNO"), reading=reading, region=reg, mean=v["mean"], sd=v["sd"]))
D = pd.DataFrame(rows)
out = []
for reading in D.reading.unique():
    for g in ("PV", "SST"):
        for reg in ("ca1_sr", "ca3", "dg"):
            for v in ("mean", "sd"):
                m = D[(D.reading == reading) & (D.group == g) & (D.region == reg)].groupby(["animal", "cno"])[v].mean().unstack()
                out.append(dict(reading=reading, group=g, region=reg, measure=v, **J.paired(m)))
out = pd.DataFrame(out)
out["significant"] = out.p < 0.05
print(out.to_string(index=False, float_format=lambda v: f"{v:.4g}"))
ca1 = out[(out.group == "PV") & (out.region == "ca1_sr") & (out.measure == "mean")]
for _, r in ca1.iterrows():
    for scale in (1.0, 0.195 ** 2):
        print(f"{r.reading}, scale {scale:.4f}: PV CA1-sr vehicle {r.veh * scale:.4g}, CNO {r.cno * scale:.4g} "
              f"(expected 109.51 +/- 10.95, 127.6 +/- 12.76)")
     reading group region measure  n       veh       cno       diff       t       p_t  p_wilcoxon     test         p  significant
a envelope^2    PV ca1_sr    mean 13 1.527e+05 2.258e+05  7.313e+04   4.213  0.001203   0.0004883 Wilcoxon 0.0004883         True
a envelope^2    PV ca1_sr      sd 13 2.249e+05 6.639e+05   4.39e+05   6.425 3.277e-05   0.0002441 Wilcoxon 0.0002441         True
a envelope^2    PV    ca3    mean 14 1.551e+05 1.582e+05       3044  0.7294    0.4787      0.4631 paired t    0.4787        False
a envelope^2    PV    ca3      sd 14 2.205e+05 6.218e+05  4.013e+05   3.673  0.002811   0.0006104 Wilcoxon 0.0006104         True
a envelope^2    PV     dg    mean 14 4.888e+05  4.47e+05 -4.171e+04  -3.233  0.006538     0.02026 Wilcoxon   0.02026         True
a envelope^2    PV     dg      sd 14 6.846e+05 1.081e+06  3.964e+05   2.965   0.01095     0.01074 Wilcoxon   0.01074         True
a envelope^2   SST ca1_sr    mean 14 1.419e+05 1.493e+05       7330  0.5224    0.6102      0.8552 paired t    0.6102        False
a envelope^2   SST ca1_sr      sd 14 2.496e+05 2.974e+05  4.777e+04   2.127    0.0531     0.06763 paired t    0.0531        False
a envelope^2   SST    ca3    mean 14 1.449e+05 1.293e+05 -1.556e+04  -2.688    0.0186    0.002319 Wilcoxon  0.002319         True
a envelope^2   SST    ca3      sd 14  2.56e+05 2.974e+05  4.144e+04   1.153    0.2695      0.5416 Wilcoxon    0.5416        False
a envelope^2   SST     dg    mean 14 4.929e+05  4.54e+05 -3.892e+04  -2.252   0.04221     0.03528 paired t   0.04221         True
a envelope^2   SST     dg      sd 14 7.638e+05 7.823e+05  1.843e+04  0.3465    0.7345      0.7609 Wilcoxon    0.7609        False
b multitaper    PV ca1_sr    mean 13      3422      5060       1638   4.221  0.001187   0.0004883 Wilcoxon 0.0004883         True
b multitaper    PV ca1_sr      sd 13      1656      4196       2540   6.674 2.278e-05   0.0002441 Wilcoxon 0.0002441         True
b multitaper    PV    ca3    mean 14      3481      3556       75.2  0.7901    0.4437      0.4631 paired t    0.4437        False
b multitaper    PV    ca3      sd 14      1488      3711       2223   3.677  0.002792   0.0006104 Wilcoxon 0.0006104         True
b multitaper    PV     dg    mean 14 1.097e+04 1.004e+04     -928.2  -3.166  0.007434     0.02026 Wilcoxon   0.02026         True
b multitaper    PV     dg      sd 14      4535      6560       2025   2.717   0.01761     0.02026 Wilcoxon   0.02026         True
b multitaper   SST ca1_sr    mean 14      3181      3346      165.7  0.5257    0.6079      0.8552 paired t    0.6079        False
b multitaper   SST ca1_sr      sd 14      1854      1956      102.8  0.6327    0.5379      0.4631 paired t    0.5379        False
b multitaper   SST    ca3    mean 14      3249      2904     -345.4  -2.681   0.01885    0.002319 Wilcoxon  0.002319         True
b multitaper   SST    ca3      sd 14      1736      1803      67.64  0.3332    0.7443      0.8077 paired t    0.7443        False
b multitaper   SST     dg    mean 14 1.105e+04 1.019e+04     -864.2  -2.242   0.04301     0.04187 paired t   0.04301         True
b multitaper   SST     dg      sd 14      5320      5060     -260.3 -0.8599    0.4054      0.1726 Wilcoxon    0.1726        False
a envelope^2, scale 1.0000: PV CA1-sr vehicle 1.527e+05, CNO 2.258e+05 (expected 109.51 +/- 10.95, 127.6 +/- 12.76)
a envelope^2, scale 0.0380: PV CA1-sr vehicle 5806, CNO 8587 (expected 109.51 +/- 10.95, 127.6 +/- 12.76)
b multitaper, scale 1.0000: PV CA1-sr vehicle 3422, CNO 5060 (expected 109.51 +/- 10.95, 127.6 +/- 12.76)
b multitaper, scale 0.0380: PV CA1-sr vehicle 130.1, CNO 192.4 (expected 109.51 +/- 10.95, 127.6 +/- 12.76)

Result: partially reproduced. In PV-Cre mice SG power in CA1-sr rises across rest (Wilcoxon p = 0.0005 under both readings) and its SD rises in CA1-sr, CA3 and DG (p from 0.0002 to 0.02), as claimed. In SST-Cre mice baseline SG power does not change in CA1-sr (p = 0.61), but it falls in CA3 (p = 0.0023) and DG (p = 0.04), which the claim excludes. The expected values do not match under either reading: the multitaper power in file units scaled by 0.195^2 gives 130 and 192 against 109.5 +/- 11.0 and 127.6 +/- 12.8, and the other scalings are further off. 13 PV-Cre mice have a CA1-sr site.

fig4d-swr-sg-power-pv¶

Suppressing PV+ interneurons increases SWR-coincident SG power in CA1, CA3 and DG, while suppressing SST+ interneurons does not change it; the genotypes differ in CA1.

Per SWR and site, multitaper power (100 ms window from SWR onset, 3 tapers, time-bandwidth 2, an assumption) averaged over 30-50 Hz, z-scored by the mean and SD of the same measure over the 100 ms windows of rest: CNO sessions by the mouse's latest earlier vehicle session (Methods), vehicle sessions by their own (claims file). A region's value is the mean over its sites (CA1-sr, CA3, DG). Variants: every session z-scored by its own statistics (code), and the 5 SD SWRs (code).

In [18]:
part_table([("sg_ca1", "PV", "up"), ("sg_ca3", "PV", "up"), ("sg_dg", "PV", "up"), ("sg_ca1", "SST", "ns"),
            ("sg_ca3", "SST", "ns"), ("sg_dg", "SST", "ns"), ("sg_ca1", "PV vs SST", "sig")])
print("\nVariant: each session z-scored by its own rest statistics (code):")
part_table([("sg_ca1_own", "PV", "up"), ("sg_ca3_own", "PV", "up"), ("sg_dg_own", "PV", "up"), ("sg_ca1_own", "SST", "ns"),
            ("sg_ca3_own", "SST", "ns"), ("sg_dg_own", "SST", "ns"), ("sg_ca1_own", "PV vs SST", "sig")])
print("\nVariant: 5 SD SWRs, CA1:")
part_table([("sg_ca1_5sd", "PV", "up"), ("sg_ca1_5sd", "SST", "ns"), ("sg_ca1_5sd", "PV vs SST", "sig")])
m = TAB["sg_ca1"].groupby(["group", "animal", "cno"]).value.mean().unstack()
print("\nCA1 SWR-coincident SG power (z), mean over mice; mice whose value rose with CNO:")
print(pd.DataFrame({"vehicle": m[0].groupby(level=0).mean(), "CNO": m[1].groupby(level=0).mean(),
                    "rose": (m[1] > m[0]).groupby(level=0).sum(), "mice": m.dropna().groupby(level=0).size()}).round(3).to_string())
feature      test expected reading  log   coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
 sg_ca1        PV       up       a True  0.538  45.8 1.34e-11         True   True       13  90483    NaN             NaN
 sg_ca1        PV       up       b True  0.538  45.8 1.34e-11         True   True       13  90483    NaN             NaN
 sg_ca3        PV       up       a True  0.156  12.3 0.000456         True   True       14  93269    NaN             NaN
 sg_ca3        PV       up       b True  0.156  12.3 0.000456         True   True       14  93269    NaN             NaN
  sg_dg        PV       up       a True 0.0674  1.69    0.194        False  False       14  93269    NaN             NaN
  sg_dg        PV       up       b True 0.0674  1.69    0.194        False  False       14  93269    NaN             NaN
 sg_ca1       SST       ns       a True  0.205  6.73   0.0095        False   True       14 101653    NaN             NaN
 sg_ca1       SST       ns       b True  0.205  6.73   0.0095        False   True       14 101653    NaN             NaN
 sg_ca3       SST       ns       a True 0.0543  1.45    0.229        False   True       14 101653    NaN             NaN
 sg_ca3       SST       ns       b True 0.0543  1.45    0.229        False   True       14 101653    NaN             NaN
  sg_dg       SST       ns       a True 0.0575   2.2    0.138        False   True       14 101653    NaN             NaN
  sg_dg       SST       ns       b True 0.0575   2.2    0.138        False   True       14 101653    NaN             NaN
 sg_ca1 PV vs SST      sig       a True -0.334  14.4     0.11        False  False       27 192136 0.0134           False
 sg_ca1 PV vs SST      sig       b True -0.334  14.4     0.11        False  False       27 192136 0.0134           False

Variant: each session z-scored by its own rest statistics (code):
   feature      test expected reading  log    coef  stat        p  significant  holds  animals      n  p_df5 significant_df5
sg_ca1_own        PV       up       a True -0.0599  4.07   0.0436        False  False       14  92264    NaN             NaN
sg_ca1_own        PV       up       b True -0.0599  4.07   0.0436        False  False       14  92264    NaN             NaN
sg_ca3_own        PV       up       a True -0.0379  2.12    0.146        False  False       14  93269    NaN             NaN
sg_ca3_own        PV       up       b True -0.0379  2.12    0.146        False  False       14  93269    NaN             NaN
 sg_dg_own        PV       up       a True  0.0198 0.886    0.346        False  False       14  93269    NaN             NaN
 sg_dg_own        PV       up       b True  0.0198 0.886    0.346        False  False       14  93269    NaN             NaN
sg_ca1_own       SST       ns       a True  0.0193 0.607    0.436        False   True       14 101653    NaN             NaN
sg_ca1_own       SST       ns       b True  0.0193 0.607    0.436        False   True       14 101653    NaN             NaN
sg_ca3_own       SST       ns       a True  0.0516  3.79   0.0517        False   True       14 101653    NaN             NaN
sg_ca3_own       SST       ns       b True  0.0516  3.79   0.0517        False   True       14 101653    NaN             NaN
 sg_dg_own       SST       ns       a True   0.072  15.4 8.63e-05         True  False       14 101653    NaN             NaN
 sg_dg_own       SST       ns       b True   0.072  15.4 8.63e-05         True  False       14 101653    NaN             NaN
sg_ca1_own PV vs SST      sig       a True  0.0792  10.2    0.333        False  False       28 193917 0.0692           False
sg_ca1_own PV vs SST      sig       b True  0.0792  10.2    0.333        False  False       28 193917 0.0692           False

Variant: 5 SD SWRs, CA1:
   feature      test expected reading  log   coef  stat        p  significant  holds  animals      n   p_df5 significant_df5
sg_ca1_5sd        PV       up       a True  0.541  46.7 8.43e-12         True   True       13  71067     NaN             NaN
sg_ca1_5sd        PV       up       b True  0.541  46.7 8.43e-12         True   True       13  71067     NaN             NaN
sg_ca1_5sd       SST       ns       a True  0.206  6.99  0.00821        False   True       14  77387     NaN             NaN
sg_ca1_5sd       SST       ns       b True  0.206  6.99  0.00821        False   True       14  77387     NaN             NaN
sg_ca1_5sd PV vs SST      sig       a True -0.335  16.1   0.0657        False  False       27 148454 0.00668           False
sg_ca1_5sd PV vs SST      sig       b True -0.335  16.1   0.0657        False  False       27 148454 0.00668           False
CA1 SWR-coincident SG power (z), mean over mice; mice whose value rose with CNO:
       vehicle    CNO  rose  mice
group                            
EV       1.595  2.570     7     8
PS       1.250  3.312    12    13
PV       1.370  3.375    13    13
SST      1.151  1.824    12    14

Result: not reproduced. With CNO sessions z-scored by the mouse's previous vehicle session (Methods), SWR-coincident SG power rises with PV+ suppression in CA1 (coefficient 0.54 on the log scale, p = 1.3e-11, 13 of 13 mice) and CA3 (p = 0.00046) but not significantly in DG (p = 0.19). No SST-Cre effect is significant (CA1 p = 0.0095, CA3 0.23, DG 0.14), as claimed, but the CA1 genotype test is not significant (p = 0.11; p = 0.013 with 5 degrees of freedom, also short of Holm). The partial rule needs the CA1 genotype test. The empty vector mice also rise in CA1 (p = 1.6e-05, figs6 table below), which may come from z-scoring a CNO session by another session's statistics or from session order (every cohort 3 mouse had its vehicle sessions first); no output here separates the two; with every session z-scored by its own statistics (code) no PV-Cre effect is significant (CA1 coefficient -0.06, p = 0.044). The outcome also rests on the tapers (3, time-bandwidth 2), an assumption.

fig4e-swr-sg-coherence-pv¶

Only PV+ suppression enhances the increase in SG coherence between CA1 and CA3 and between CA1 and DG during SWRs.

Per SWR, multitaper SG (30-50 Hz) coherence between the CA1 SWR site and each CA3 or DG site in the 100 ms after onset minus that in the 100 ms from 400 ms before onset, averaged over the region's pairs; SWRs with another SWR within the 400 ms before onset are left out (Methods, paragraph 3).

In [19]:
part_table([("sgcoh_ca3", "PV", "up"), ("sgcoh_dg", "PV", "up"), ("sgcoh_ca3", "SST", "ns"), ("sgcoh_dg", "SST", "ns"),
            ("sgcoh_ca3", "PV vs SST", "sig"), ("sgcoh_dg", "PV vs SST", "sig")])
n_all = sum(len(results[i]["swr"]) for i in S.i)
n_ok = sum(int(results[i]["swr"]["sgcoh_ca3"].notna().sum()) for i in S.i if "sgcoh_ca3" in results[i]["swr"])
print(f"\nSWRs with a clean 400 ms before onset: {n_ok} of {n_all}")
m = TAB["sgcoh_ca3"].groupby(["group", "cno"]).value.mean().unstack()
print("Mean coherence change (post minus pre), CA1-CA3, by group and treatment:"); print(m.round(4).to_string())
m = TAB["sgcoh_dg"].groupby(["group", "cno"]).value.mean().unstack()
print("Mean coherence change, CA1-DG:"); print(m.round(4).to_string())
  feature      test expected reading   log     coef   stat      p  significant  holds  animals      n   p_df5 significant_df5
sgcoh_ca3        PV       up       a False  -0.0013 0.0496  0.824        False  False       14  66658     NaN             NaN
sgcoh_ca3        PV       up       b  True -0.00127 0.0271  0.869        False  False       14  66658     NaN             NaN
 sgcoh_dg        PV       up       a False 0.000633  0.022  0.882        False  False       14  66658     NaN             NaN
 sgcoh_dg        PV       up       b  True   0.0029  0.318  0.573        False  False       14  66658     NaN             NaN
sgcoh_ca3       SST       ns       a False  0.00513   4.31 0.0378        False   True       14  70486     NaN             NaN
sgcoh_ca3       SST       ns       b  True  0.00664   3.67 0.0555        False   True       14  70486     NaN             NaN
 sgcoh_dg       SST       ns       a False  0.00388   3.02 0.0824        False   True       14  70486     NaN             NaN
 sgcoh_dg       SST       ns       b  True  0.00649   3.69 0.0548        False   True       14  70486     NaN             NaN
sgcoh_ca3 PV vs SST      sig       a False  0.00641   15.5  0.077        False  False       28 137144 0.00826           False
sgcoh_ca3 PV vs SST      sig       b  True  0.00789     13  0.162        False  False       28 137144  0.0233           False
 sgcoh_dg PV vs SST      sig       a False  0.00352   7.36    0.6        False  False       28 137144   0.195           False
 sgcoh_dg PV vs SST      sig       b  True  0.00385   7.57  0.578        False  False       28 137144   0.182           False

SWRs with a clean 400 ms before onset: 207869 of 295070
Mean coherence change (post minus pre), CA1-CA3, by group and treatment:
cno         0       1
group                
EV    -0.0074 -0.0104
PS    -0.0061 -0.0023
PV    -0.0047 -0.0014
SST   -0.0110 -0.0067
Mean coherence change, CA1-DG:
cno         0       1
group                
EV    -0.0278 -0.0161
PS    -0.0130 -0.0104
PV    -0.0158 -0.0144
SST   -0.0199 -0.0171

Result: not reproduced. The SWR-related change in SG coherence does not rise with PV+ suppression, between CA1 and CA3 (coefficient -0.0013, p = 0.82) or CA1 and DG (+0.0006, p = 0.88). SST-Cre effects are not significant (p = 0.038 and 0.082), as claimed, and neither genotype test is (p = 0.077 and 0.60). 207,869 of 295,070 SWRs have no other SWR in the 400 ms before onset. The mean change, post minus pre, lies between -0.028 and -0.001 in every group and treatment.

figs2cd-sg-predicts-sw-frequency¶

Across PV-Cre mice, the CNO-induced change in CA1 SWR-coincident SG power predicts the change in SW amplitude and the change in SWR frequency.

Per PV-Cre mouse, CNO minus vehicle of CA1 SWR-coincident SG power (fig4d), SW amplitude (fig3g) and SWR instantaneous frequency (fig3f): (a) difference of the mouse's means; (b) difference of the LMM fitted conditional responses. Pearson correlation across mice. Expected R2 0.55 and 0.44.

In [20]:
rows = []
for other, label in (("sw_amp", "SW amplitude"), ("freq", "SWR frequency")):
    for reading, fn in (("a mean difference", J.mean_changes), ("b LMM conditional", J.blup_changes)):
        x, y = fn(TAB["sg_ca1"], "PV"), fn(TAB[other], "PV")
        x, y = x.align(y, join="inner")
        r, p = stats.pearsonr(x, y)
        rows.append(dict(against=label, reading=reading, mice=len(x), r=r, R2=r * r, p=p,
                         sg_change_range=f"{x.min():.3g} to {x.max():.3g}", other_change_range=f"{y.min():.3g} to {y.max():.3g}"))
print(pd.DataFrame(rows).to_string(index=False, float_format=lambda v: f"{v:.3g}"))
      against           reading  mice     r    R2     p sg_change_range other_change_range
 SW amplitude a mean difference    13 0.361  0.13 0.226   0.496 to 6.97  -87.3 to 1.76e+03
 SW amplitude b LMM conditional    13 0.364 0.133 0.221   0.525 to 6.96  -80.3 to 1.75e+03
SWR frequency a mean difference    13 0.424  0.18 0.148   0.496 to 6.97      -2.15 to 10.6
SWR frequency b LMM conditional    13 0.423 0.179  0.15   0.525 to 6.96      -2.03 to 10.5

Result: not reproduced. Across 13 PV-Cre mice the change in CA1 SWR-coincident SG power correlates positively but not significantly with the change in SW amplitude (r = 0.36, R2 = 0.13, p = 0.23) and with the change in SWR frequency (r = 0.42, R2 = 0.18, p = 0.15), under both readings of a mouse's change; the expected R2 are 0.55 and 0.44. One PV-Cre mouse has no CA1-sr site, and the paper has 16 mice.

ca3-swr-overlap¶

Only a subset of CA3 SWRs, 37.18% averaged over vehicle sessions of PV-Cre and SST-Cre mice, overlap in time with CA1 SWRs.

A CA3 SWR overlaps when a valid CA1 SWR midpoint falls within it. Readings: (a) mean over sessions; (b) pooled over events.

In [21]:
rows = []
for i, g, tr in zip(S.i, S.group, S.treatment):
    c = results[i].get("ca3_swr")
    if c is not None and g in ("PV", "SST") and tr == "Vehicle":
        rows.append(dict(group=g, n=len(c), overlap=int(c.overlap.sum())))
O = pd.DataFrame(rows)
O = O[O.n > 0]
a = (100 * O.overlap / O.n).mean()
b = 100 * O.overlap.sum() / O.n.sum()
print(f"Vehicle sessions: {len(O)}; CA3 SWRs {O.n.sum()}")
print(f"(a) mean over sessions {a:.2f}%  (b) pooled {b:.2f}%  expected 37.18 +/- 3.72")
print("Range of session percentages:", round((100 * O.overlap / O.n).min(), 1), "to", round((100 * O.overlap / O.n).max(), 1))
Vehicle sessions: 96; CA3 SWRs 75767
(a) mean over sessions 25.32%  (b) pooled 24.98%  expected 37.18 +/- 3.72
Range of session percentages: 5.8 to 49.4

Result: not reproduced. 25.3% of CA3 SWRs overlap a CA1 SWR averaged over vehicle sessions (25.0% pooled over events), against 37.18 +/- 3.72%. The session values range from 5.8% to 49.4%.

figs3-ca3-swr-pv¶

Suppressing either class increases CA3 MUA recruitment to CA3 SWRs and lengthens CA3 SWRs; PV+ suppression decreases CA3 SWR rate and CA3 SWR instantaneous frequency.

Readings: (a) all valid CA3 SWRs (Methods); (b) CA3 SWRs that hold a CA1 SWR midpoint (code). CA3 MUA uses the aligned spike times.

In [22]:
parts = [("ca3_mua", "PV", "up"), ("ca3_mua", "SST", "up"), ("ca3_length", "PV", "up"), ("ca3_length", "SST", "up"),
         ("ca3_rate", "PV", "down"), ("ca3_freq", "PV", "down")]
print("Reading (a), all CA3 SWRs:")
part_table(parts)
print("\nReading (b), CA3 SWRs overlapping a CA1 SWR:")
part_table([(f + "_overlap", g, e) for f, g, e in parts])
print("\nCA3 MUA with spike times as deposited:")
part_table([("ca3_mua_deposited", "PV", "up"), ("ca3_mua_deposited", "SST", "up")])
Reading (a), all CA3 SWRs:
   feature test expected reading   log     coef   stat        p  significant  holds  animals     n
   ca3_mua   PV       up       a  True  -0.0168 0.0927    0.761        False  False       14 55013
   ca3_mua   PV       up       b  True  -0.0168 0.0927    0.761        False  False       14 55013
   ca3_mua  SST       up       a  True  -0.0164  0.174    0.676        False  False       14 48719
   ca3_mua  SST       up       b  True  -0.0164  0.174    0.676        False  False       14 48719
ca3_length   PV       up       a  True  0.00971   1.11    0.292        False  False       14 62483
ca3_length   PV       up       b  True  0.00971   1.11    0.292        False  False       14 62483
ca3_length  SST       up       a  True   0.0149   2.11    0.146        False  False       14 67127
ca3_length  SST       up       b  True   0.0149   2.11    0.146        False  False       14 67127
  ca3_rate   PV     down       a False     -2.8   13.9 0.000193         True   True       14  3427
  ca3_rate   PV     down       b  True   -0.146   9.19  0.00246         True   True       14  3427
  ca3_freq   PV     down       a False   -0.807    1.9    0.168        False  False       14 62483
  ca3_freq   PV     down       b  True -0.00542   2.07     0.15        False  False       14 62483

Reading (b), CA3 SWRs overlapping a CA1 SWR:
           feature test expected reading   log     coef   stat     p  significant  holds  animals     n
   ca3_mua_overlap   PV       up       a  True  -0.0316  0.178 0.673        False  False       14 12542
   ca3_mua_overlap   PV       up       b  True  -0.0316  0.178 0.673        False  False       14 12542
   ca3_mua_overlap  SST       up       a  True    -0.05   0.95  0.33        False  False       14 12840
   ca3_mua_overlap  SST       up       b  True    -0.05   0.95  0.33        False  False       14 12840
ca3_length_overlap   PV       up       a  True   0.0184   1.36 0.243        False  False       14 14298
ca3_length_overlap   PV       up       b  True   0.0184   1.36 0.243        False  False       14 14298
ca3_length_overlap  SST       up       a  True   0.0142   2.16 0.142        False  False       14 17859
ca3_length_overlap  SST       up       b  True   0.0142   2.16 0.142        False  False       14 17859
  ca3_rate_overlap   PV     down       a False   -0.876   6.32 0.012        False  False       14  3427
  ca3_rate_overlap   PV     down       b  True   0.0554 0.0646 0.799        False  False       14  3427
  ca3_freq_overlap   PV     down       a False   -0.472  0.531 0.466        False  False       14 14298
  ca3_freq_overlap   PV     down       b  True -0.00299   0.49 0.484        False  False       14 14298

CA3 MUA with spike times as deposited:
          feature test expected reading  log    coef    stat       p  significant  holds  animals     n
ca3_mua_deposited   PV       up       a True     0.1    6.82 0.00902        False  False       14 62483
ca3_mua_deposited   PV       up       b True     0.1    6.82 0.00902        False  False       14 62483
ca3_mua_deposited  SST       up       a True 0.00113 0.00133   0.971        False  False       14 67127
ca3_mua_deposited  SST       up       b True 0.00113 0.00133   0.971        False  False       14 67127

Result: not reproduced. Under reading (a), all CA3 SWRs, only the PV-Cre decrease in CA3 SWR rate holds (p = 0.00019); CA3 MUA recruitment does not rise in either genotype (p = 0.76 and 0.68), CA3 SWR length does not rise significantly (p = 0.29 and 0.15), and the PV-Cre frequency decrease is not significant (p = 0.17): one of six tests. Under reading (b), CA3 SWRs overlapping a CA1 SWR, none holds. The MUA part rests on the clock alignment, an assumption.

figs3c-ca3-swr-rate-sst¶

Suppressing SST+ interneurons increases CA3 SWR rate.

In [23]:
part_table([("ca3_rate", "SST", "up"), ("ca3_rate_overlap", "SST", "up")])
         feature test expected reading   log    coef  stat      p  significant  holds  animals    n
        ca3_rate  SST       up       a False   -1.12  3.83 0.0505        False  False       14 3754
        ca3_rate  SST       up       b  True -0.0561  0.87  0.351        False  False       14 3754
ca3_rate_overlap  SST       up       a False  -0.595  4.26 0.0391        False  False       14 3754
ca3_rate_overlap  SST       up       b  True   -0.31  2.21  0.138        False  False       14 3754

Result: not reproduced. CA3 SWR rate does not increase with SST+ suppression; the coefficient is negative under both readings of which CA3 SWRs enter (-1.1 per min, p = 0.051, and -0.60 per min, p = 0.039, untransformed), and neither passes Holm. This agrees with the legend's p = 0.77 and not with the text.

figs3-dentate-spikes¶

DG MUA during dentate spikes does not change; suppressing either class decreases dentate spike rate; PV+ suppression increases dentate spike length and decreases their amplitude, while SST+ suppression has no detectable effect on these.

In [24]:
part_table([("ds_mua", "PV", "ns"), ("ds_mua", "SST", "ns"), ("ds_rate", "PV", "down"), ("ds_rate", "SST", "down"),
                ("ds_length", "PV", "up"), ("ds_amp", "PV", "down"), ("ds_length", "SST", "ns"), ("ds_amp", "SST", "ns")])
print("\nDS MUA with spike times as deposited:")
part_table([("ds_mua_deposited", "PV", "ns"), ("ds_mua_deposited", "SST", "ns")])
ds = pd.concat([results[i]["ds"].assign(rest_min=results[i]["rest_s"] / 60) for i in S.i if "ds" in results[i]])
rate = len(ds) / sum(results[i]["rest_s"] for i in S.i) 
print(f"\nDentate spikes detected: {len(ds)}, {rate:.2f} per second of rest; length {ds.length.min()*1000:.0f} to "
      f"{ds.length.max()*1000:.0f} ms; amplitude (z units) {ds.amp.min():.2f} to {ds.amp.max():.2f}")
  feature test expected reading   log      coef    stat        p  significant  holds  animals       n
   ds_mua   PV       ns       a  True   0.00103 0.00149    0.969        False   True       14 1760648
   ds_mua   PV       ns       b  True   0.00103 0.00149    0.969        False   True       14 1760648
   ds_mua  SST       ns       a  True    -0.134    1.28    0.259        False   True       14 1402302
   ds_mua  SST       ns       b  True    -0.134    1.28    0.259        False   True       14 1402302
  ds_rate   PV     down       a  True   -0.0167   0.709      0.4        False  False       14    3427
  ds_rate   PV     down       b  True   -0.0167   0.709      0.4        False  False       14    3427
  ds_rate  SST     down       a  True    0.0702    3.27   0.0706        False  False       14    3754
  ds_rate  SST     down       b  True    0.0702    3.27   0.0706        False  False       14    3754
ds_length   PV       up       a False  2.29e-05  0.0122    0.912        False  False       14 1995490
ds_length   PV       up       b  True   0.00116 0.00982    0.921        False  False       14 1995490
   ds_amp   PV     down       a  True   -0.0452    17.2 3.36e-05         True   True       14 1995490
   ds_amp   PV     down       b  True   -0.0452    17.2 3.36e-05         True   True       14 1995490
ds_length  SST       ns       a False -0.000203   0.926    0.336        False   True       14 1971768
ds_length  SST       ns       b  True   -0.0117    1.01    0.315        False   True       14 1971768
   ds_amp  SST       ns       a  True   -0.0252    5.28   0.0216        False   True       14 1971768
   ds_amp  SST       ns       b  True   -0.0252    5.28   0.0216        False   True       14 1971768

DS MUA with spike times as deposited:
         feature test expected reading  log    coef  stat     p  significant  holds  animals       n
ds_mua_deposited   PV       ns       a True -0.0111 0.328 0.567        False   True       14 1995490
ds_mua_deposited   PV       ns       b True -0.0111 0.328 0.567        False   True       14 1995490
ds_mua_deposited  SST       ns       a True -0.0167 0.662 0.416        False   True       14 1971768
ds_mua_deposited  SST       ns       b True -0.0167 0.662 0.416        False   True       14 1971768
Dentate spikes detected: 5981368, 8.58 per second of rest; length 8 to 25 ms; amplitude (z units) 0.63 to 35.13

Result: not reproduced. DG MUA during dentate spikes does not change (p = 0.97 and 0.26) and PV+ suppression lowers dentate spike amplitude (p = 3.4e-05), as claimed, and SST+ suppression leaves length and amplitude unchanged after correction. But dentate spike rate does not fall in either genotype, and PV+ suppression does not lengthen them: five of the eight parts hold, and the partial rule needs the rate decreases. The Methods' detection, as implemented here, finds 8.58 events per second of rest, close to Table S4's dentate spike rates of 9.18 (PV-Cre) and 8.45 Hz (SST-Cre), which supports this reading of the Methods. The amplitude is in z units, where Table S4 gives uV. The outcome rests on this reading of the Methods, an assumption.

tables6-sex-swr-size (rest features)¶

During vehicle treatment, females have slightly larger SWR sizes than males, with no other sex differences.

Vehicle sessions of every mouse of cohorts 2 and 3 analysed here; LMM feature ~ sex + (sex|animal), F test. The run features are tested in the linear track notebook. Reading (a) of the correction is Holm over the rest features separately (m = 22 as Table S6); (b) uncorrected p < 0.05.

In [25]:
Sv = S[S.treatment == "Vehicle"]
rows = []
for name in J.REST_FEATURES:
    d = TAB[name][TAB[name].session.isin(Sv.session)]
    if not len(d):
        continue
    sk = J.within_skew(d.assign(cno=(d.sex == "F").astype(int)))
    for log in (sk > J.SKEW_LOG,):
        dd = d.assign(cno=(d.sex == "F").astype(int))
        if log:
            dd["value"] = J.log_values(dd.value)
        cs = J.cell_stats(dd, "value")
        r = J.treatment_test(cs)
        means = d.groupby(["sex", "animal"]).value.mean().groupby(level=0).mean()
        rows.append(dict(feature=name, log=log, female_minus_male=r["coef"], p=r["p"], mean_F=means.get("F"),
                         mean_M=means.get("M"), mice_F=d[d.sex == "F"].animal.nunique(), mice_M=d[d.sex == "M"].animal.nunique()))
SEX = pd.DataFrame(rows)
SEX["holm_22"] = J.holm(SEX.p.values, 22)
SEX["p<0.05"] = SEX.p < 0.05
print(SEX.sort_values("p").to_string(index=False, float_format=lambda v: f"{v:.3g}"))
   feature   log  female_minus_male      p   mean_F   mean_M  mice_F  mice_M  holm_22  p<0.05
ca3_length  True            -0.0378 0.0327   0.0806   0.0837      22      27    False    True
    length  True            -0.0296 0.0966   0.0962   0.0989      22      27    False   False
    sw_amp  True            -0.0859  0.169 3.03e+03 3.29e+03      21      27    False   False
  ca3_freq False               0.99  0.385      147      146      22      27    False   False
    sg_ca3  True            -0.0248  0.414    0.883     0.88      22      27    False   False
      size False            -0.0825  0.523     7.15     7.23      22      27    False   False
     chain  True            -0.0439  0.531    0.181    0.187      22      27    False   False
  swr_rate False             -0.698  0.539     24.6     25.2      22      27    False   False
    ds_mua  True               0.05  0.542   0.0493   0.0691      19      27    False   False
 sgcoh_ca3 False            0.00284  0.596 -0.00405 -0.00697      22      27    False   False
   mua_ca3  True            -0.0332  0.601    0.218    0.169      19      27    False   False
  sgcoh_dg False             0.0026  0.605   -0.015  -0.0178      22      27    False   False
 ds_length False           9.66e-05  0.606    0.019   0.0189      22      27    False   False
  ca3_rate False             -0.497  0.649       17     17.4      22      27    False   False
    ds_amp  True             0.0132   0.71     1.56     1.54      22      27    False   False
   ds_rate  True            -0.0162  0.722      472      485      22      27    False   False
   mua_ca1  True            -0.0261  0.752     1.68     1.72      19      27    False   False
   ca3_mua  True             0.0106  0.793    0.253    0.119      19      27    False   False
      freq False             -0.306  0.815      154      154      22      27    False   False
    mua_dg  True            0.00781  0.923    0.323    0.293      19      27    False   False
    sg_ca1  True           -0.00148  0.965     1.32     1.31      21      27    False   False
     sg_dg  True           8.78e-05  0.997    0.652    0.638      22      27    False   False

Result (rest part): SWR size does not differ by sex in vehicle sessions (female minus male -0.08 SD, p = 0.52). No rest feature passes Holm over 22; CA3 SWR length has the smallest p (0.033, uncorrected). The run features are in the linear track notebook.

sex-stratified-effects (rest features)¶

Interneuron suppression has effects of the same direction and magnitude in both sexes on most features; the exceptions are SW amplitude with SST+ suppression (down in females, up in males), FG power with SST+ suppression (larger rise in females), and DG and CA3 MUA during movement (larger rise in females with suppression of either or both classes).

Per group, the likelihood ratio test of feature ~ treatment + (treatment|animal) against the model with treatment by sex, the same machinery as the genotype test with sex in place of genotype.

In [26]:
rows = []
for g in ("PV", "SST", "PS"):
    for name in J.REST_FEATURES:
        d = TAB[name][TAB[name].group == g].copy()
        if not len(d) or d.sex.nunique() < 2:
            continue
        if J.within_skew(d) > J.SKEW_LOG:
            d["value"] = J.log_values(d.value)
        csF, csM = J.cell_stats(d[d.sex == "F"], "value"), J.cell_stats(d[d.sex == "M"], "value")
        if csF.animal.nunique() < 2 or csM.animal.nunique() < 2:
            continue
        gt = J.genotype_test(csF, csM)
        rows.append(dict(group=g, feature=name, coef_F=gt["coef_a"], coef_M=gt["coef_b"], p=gt["p_df9"],
                         mice_F=csF.animal.nunique(), mice_M=csM.animal.nunique()))
SXR = pd.DataFrame(rows)
SXR["holm"] = False
for g, d in SXR.groupby("group"):
    SXR.loc[d.index, "holm"] = J.holm(d.p.values, len(d))
print(SXR.to_string(index=False, float_format=lambda v: f"{v:.3g}"))
print("\nSST-Cre SW amplitude:", SXR[(SXR.group == "SST") & (SXR.feature == "sw_amp")].to_string(index=False))
group    feature    coef_F    coef_M       p  mice_F  mice_M  holm
   PV   swr_rate      4.23      4.25   0.946       7       7 False
   PV      chain  -0.00641    -0.102   0.976       7       7 False
   PV     length   -0.0429  -0.00296   0.483       7       7 False
   PV       freq      3.73      4.59   0.455       7       7 False
   PV     sw_amp       833       756       1       7       7 False
   PV       size    -0.276     -0.57   0.964       7       7 False
   PV    mua_ca1    0.0898     0.131   0.336       7       7 False
   PV    mua_ca3  -0.00353   -0.0289   0.929       7       7 False
   PV     mua_dg    -0.136    -0.204   0.957       7       7 False
   PV   ca3_rate      -1.6     -3.59   0.272       7       7 False
   PV ca3_length   0.00255    0.0116 0.00208       7       7  True
   PV   ca3_freq    -0.606     -1.03   0.557       7       7 False
   PV    ca3_mua  -0.00453   -0.0278   0.982       7       7 False
   PV    ds_rate   0.00661   -0.0431    0.85       7       7 False
   PV  ds_length  2.35e-05  2.24e-05       1       7       7 False
   PV     ds_amp    -0.026   -0.0643   0.807       7       7 False
   PV     ds_mua    0.0544   0.00374   0.956       7       7 False
   PV     sg_ca1     0.704     0.394 0.00591       6       7 False
   PV     sg_ca3     0.169     0.143   0.958       7       7 False
   PV      sg_dg    0.0754    0.0588   0.924       7       7 False
   PV  sgcoh_ca3   -0.0108   0.00751  0.0882       7       7 False
   PV   sgcoh_dg -0.000868   0.00206   0.417       7       7 False
  SST   swr_rate     -1.09     -1.18   0.813       3      11 False
  SST      chain   -0.0422   -0.0877   0.101       3      11 False
  SST     length    0.0112    0.0291   0.518       3      11 False
  SST       freq      2.06      1.23   0.717       3      11 False
  SST     sw_amp     0.293    0.0877   0.401       3      11 False
  SST       size     0.184     -0.16  0.0738       3      11 False
  SST    mua_ca1   -0.0989   -0.0539   0.243       3      11 False
  SST    mua_ca3     0.132   -0.0572  0.0806       3      11 False
  SST     mua_dg     0.209    0.0824   0.169       3      11 False
  SST   ca3_rate     -1.62    -0.921   0.595       3      11 False
  SST ca3_length    0.0125    0.0165    0.18       3      11 False
  SST   ca3_freq     0.733     0.336   0.616       3      11 False
  SST    ca3_mua     0.143   -0.0166   0.125       3      11 False
  SST    ds_rate     0.097    0.0616   0.986       3      11 False
  SST  ds_length -0.000252  -0.00019       1       3      11 False
  SST     ds_amp   -0.0219   -0.0261   0.801       3      11 False
  SST     ds_mua   -0.0781    -0.165       1       3      11 False
  SST     sg_ca1     0.506     0.127  0.0375       3      11 False
  SST     sg_ca3    0.0506    0.0591   0.142       3      11 False
  SST      sg_dg    0.0339    0.0702   0.463       3      11 False
  SST  sgcoh_ca3  -0.00316   0.00657   0.883       3      11 False
  SST   sgcoh_dg -4.65e-05   0.00374   0.969       3      11 False
   PS   swr_rate     0.479      3.01   0.665       8       5 False
   PS      chain    -0.202    -0.193   0.533       8       5 False
   PS     length   0.00224   -0.0432  0.0559       8       5 False
   PS       freq      7.03      2.46   0.376       8       5 False
   PS     sw_amp  1.27e+03       322   0.162       8       5 False
   PS       size    -0.479    -0.747    0.32       8       5 False
   PS    mua_ca1     0.257   0.00172   0.724       8       5 False
   PS    mua_ca3   -0.0155    0.0348  0.0456       8       5 False
   PS     mua_dg    0.0702    -0.139   0.149       8       5 False
   PS   ca3_rate     -4.37     0.119   0.128       8       5 False
   PS ca3_length    0.0291    0.0052    0.24       8       5 False
   PS   ca3_freq     -2.04    -0.871   0.606       8       5 False
   PS    ca3_mua   -0.0617    0.0361  0.0232       8       5 False
   PS    ds_rate    0.0444    -0.041   0.693       8       5 False
   PS  ds_length -0.000143 -4.36e-05   0.999       8       5 False
   PS     ds_amp    -0.074    -0.173   0.249       8       5 False
   PS     ds_mua     0.046    -0.258  0.0253       8       5 False
   PS     sg_ca1     0.662     0.325   0.773       8       5 False
   PS     sg_ca3     0.227     0.202   0.704       8       5 False
   PS      sg_dg    0.0756     0.131   0.684       8       5 False
   PS  sgcoh_ca3   0.00901  0.000132   0.423       8       5 False
   PS   sgcoh_dg    0.0058    0.0029   0.779       8       5 False

SST-Cre SW amplitude: group feature   coef_F  coef_M        p  mice_F  mice_M  holm
  SST  sw_amp 0.293357 0.08773 0.400733       3      11 False

Result (rest part): no named exception holds. The SST-Cre SW amplitude effect does not differ by sex (p = 0.40; 3 female and 11 male SST-Cre mice are tested here). One rest feature has a significant sex interaction after Holm, PV-Cre CA3 SWR length. The run features are in the linear track notebook.

figs6 claims (rest features): double suppression and empty vector¶

figs6-double-like-pv: Suppressing both PV+ and SST+ interneurons cannot be told apart from suppressing PV+ interneurons only, except for theta modulation of SG in DG and CA3, which double suppression decreases.

figs6-double-unlike-sst: Suppressing both interneuron types has largely distinct effects from suppressing SST+ interneurons only; the exceptions are FG frequency and CA1 FG power, which follow the direction of SST+ suppression.

figs6-empty-vector-control: In mice injected with an empty vector, CNO and vehicle epochs do not differ.

Rest features computed here (22 of the 24; the two CSD features exist only for cohort 1, which has no P/S or empty vector mice); the run features are in the linear track notebook.

In [27]:
gpv = gsst = res[res.feature.isin(list(J.REST_FEATURES))]
tab = pd.DataFrame({
    "PS treatment coef": gpv[(gpv.test == "PS") & (gpv.reading == "a")].set_index("feature").coef,
    "PS treatment p": gpv[(gpv.test == "PS") & (gpv.reading == "a")].set_index("feature").p,
    "PS sig": gpv[(gpv.test == "PS") & (gpv.reading == "a")].set_index("feature").significant,
    "PV vs PS p": gpv[(gpv.test == "PV vs PS") & (gpv.reading == "a")].set_index("feature").p,
    "PV vs PS sig": gpv[(gpv.test == "PV vs PS") & (gpv.reading == "a")].set_index("feature").significant,
    "SST vs PS p": gsst[(gsst.test == "SST vs PS") & (gsst.reading == "a")].set_index("feature").p,
    "SST vs PS sig": gsst[(gsst.test == "SST vs PS") & (gsst.reading == "a")].set_index("feature").significant,
    "EV coef": res[(res.test == "EV") & (res.reading == "a") & res.feature.isin(list(J.REST_FEATURES))].set_index("feature").coef,
    "EV p": res[(res.test == "EV") & (res.reading == "a") & res.feature.isin(list(J.REST_FEATURES))].set_index("feature").p,
    "EV sig": res[(res.test == "EV") & (res.reading == "a") & res.feature.isin(list(J.REST_FEATURES))].set_index("feature").significant,
})
print("Reading (a):")
print(tab.to_string(float_format=lambda v: f"{v:.3g}"))
for name, d, col in (("PV vs PS", gpv, "PV vs PS"), ("SST vs PS", gsst, "SST vs PS")):
    b = d[(d.test == col) & (d.reading == "b")]
    print(f"Reading (b), {name}: significant in", int(b.significant.sum()), "of", len(b), ":", b[b.significant].feature.tolist())
b = res[(res.test == "EV") & (res.reading == "b") & res.feature.isin(list(J.REST_FEATURES))]
print("Reading (b), EV significant:", b[b.significant].feature.tolist())
print("Mice: PS", S[S.group == "PS"].animal.nunique(), " EV", S[S.group == "EV"].animal.nunique())
Reading (a):
            PS treatment coef  PS treatment p  PS sig  PV vs PS p  PV vs PS sig  SST vs PS p  SST vs PS sig   EV coef     EV p  EV sig
feature                                                                                                                               
swr_rate                 1.71         0.00925   False      0.0319         False         0.11          False      5.37  0.00171    True
chain                  -0.196        4.54e-09    True       0.119         False        0.623          False     0.384 2.87e-07    True
length                -0.0155           0.525   False       0.605         False          0.2          False    0.0042    0.861   False
freq                     5.27        1.59e-06    True        0.82         False        0.403          False      1.31   0.0555   False
sw_amp                  0.229        0.000164    True        0.88         False        0.679          False     0.181   0.0297   False
size                   -0.583         0.00181    True       0.372         False        0.553          False     -0.37 3.95e-05    True
mua_ca1                 0.131           0.121   False       0.968         False        0.319          False     0.357   0.0236   False
mua_ca3                -0.012           0.801   False       0.984         False        0.753          False     0.166    0.195   False
mua_dg               -0.00892           0.876   False      0.0888         False         0.78          False    0.0396    0.468   False
ca3_rate                -2.69          0.0164   False       0.946         False        0.617          False     0.622    0.277   False
ca3_length             0.0186           0.321   False       0.216         False        0.607          False -0.000765    0.973   False
ca3_freq                -1.59          0.0343   False       0.956         False       0.0198          False    -0.957    0.345   False
ca3_mua               -0.0279           0.433   False        0.91         False        0.342          False     0.163    0.163   False
ds_rate               0.00849           0.715   False       0.981         False        0.689          False    0.0417    0.385   False
ds_length           -0.000105           0.411   False       0.984         False        0.986          False -0.000105     0.67   False
ds_amp                 -0.112        0.000153    True      0.0754         False        0.245          False    0.0408    0.172   False
ds_mua                -0.0145           0.678   False           1         False        0.438          False    0.0136    0.835   False
sg_ca1                  0.524        1.58e-07    True       0.981         False        0.405          False     0.342 1.59e-05    True
sg_ca3                   0.21        1.06e-05    True       0.752         False        0.628          False      0.16   0.0194   False
sg_dg                  0.0967          0.0712   False       0.978         False        0.925          False    0.0656    0.328   False
sgcoh_ca3             0.00553           0.351   False       0.535         False        0.434          False  -0.00207    0.865   False
sgcoh_dg              0.00501           0.322   False           1         False        0.534          False    0.0118    0.268   False
Reading (b), PV vs PS: significant in 1 of 22 : ['ds_length']
Reading (b), SST vs PS: significant in 0 of 22 : []
Reading (b), EV significant: ['swr_rate', 'chain', 'size', 'sg_ca1']
Mice: PS 13  EV 8

Result (rest part). Double suppression against PV-Cre: no rest feature differs (reading a; reading b finds dentate spike length). Double suppression against SST-Cre: none of the 22 rest features differs, including SW amplitude (p = 0.68), SWR frequency (p = 0.40) and CA1 SWR-coincident SG power (p = 0.41), which the claim needs to differ. Empty vector mice change with CNO in SWR rate, chains, SWR size and CA1 SWR-coincident SG power (p from 2.9e-07 to 0.0017), where the claim says no feature changes. The two CSD comparisons exist only for cohort 1, which has no double suppression or empty vector mice, so 22 of the paper's 24 rest features enter here.

Summary¶

Claim Outcome
fig3b-mua-during-swr not reproduced (assumed clock alignment)
fig3c-swr-rate-bidirectional not reproduced
fig3d-swr-chains not reproduced
fig3e-swr-length-sst not reproduced
swr-longer-100ms-sst not reproduced
fig3f-swr-frequency-pv reproduced
fig3g-sw-amplitude-pv not reproduced
figs2a-swr-size-pv reproduced
tables2-detection-unchanged not reproduced
tables2-rest-sg-pv partially reproduced
ca3-swr-overlap not reproduced
figs3-ca3-swr-pv not reproduced (assumed clock alignment)
figs3c-ca3-swr-rate-sst not reproduced
figs3-dentate-spikes not reproduced (assumed detection)
tables6-sex-swr-size, sex-stratified-effects, figs6 claims decided with the run notebook; see the attempt record
fig1-tables1-expression, figs1ef-exvivo-cno, tables2-fast-ripples-pv blocked, data missing
fig4d-swr-sg-power-pv not reproduced (assumed tapers and z-scoring)
fig4e-swr-sg-coherence-pv not reproduced
figs2cd-sg-predicts-sw-frequency not reproduced
fig2ef-csd-sr not reproduced (csd_cohort1.ipynb)

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: 14 PV-Cre and 14 SST-Cre mice in place of 16 each (four mice have no vehicle sessions); spike times shifted per session to the SWRs for event-locked MUA; MUA at the labelled MUA sites; SWR boundaries where the envelope crosses its mean; SWR-coincident SG with 3 tapers, CNO sessions z-scored by the previous vehicle session; SW amplitude with the trace's mean removed; the genotype test fitted from cell statistics; the log transform under two readings; Holm over the comparisons computed here.

What was found about the dataset: spike times are not on the LFP clock (session-specific offsets up to about 2 s); four mice have only CNO-labelled sessions; cohort 3 has vehicle sessions before CNO sessions, not alternating, and the empty vector mice change with CNO; cohort 3 home cage sessions last 25 min, not 60; one session is deposited twice; the LFP values reach the int16 limits in 123 of 311 sessions; the SW amplitude in file units is about 8 times Table S4's; every spike train starts with a spike at 0 s.

In [28]:
print(f"notebook ran in {(time.time() - started) / 60:.1f} min")
notebook ran in 38.1 min