Reproducing Liu, Huang, Shen, Shao, Jing et al. (2026) from dandiset 001746¶

Paper: Liu, Huang, Shen, Shao, Jing et al. (2026). An atlas of primate insular cortex reveals a signal-processing strategy in von Economo neurons. Nature Cell Biology 28, 1742-1757. doi:10.1038/s41556-026-02009-4. The claims file was written from the version of record in Europe PMC (PMC13457102): main text, legends, Methods; it names the Supplementary Information as not read. This attempt also had the Supplementary Information PDF (Supplementary Figs. 1 to 17); the Supplementary Tables are not in it.

Dataset: DANDI:001746, version 0.260825.0222, 462 NWB files, one Patch-seq cell each (current-clamp step sweeps). The paper cites no version of the dandiset. This is the only published version, and the draft lists the same 462 files and size (printed below), so it is pinned.

Outside inputs. The 10x excitatory neurons with their clusters, Ext.h5ad of the h5ad archive of GEO GSE319557, streamed for fig7c. From the paper's code repository RFLiu2021/AIC_proj at commit 44cd8a6dfbb1f1ce363d73742e4f3652086b0f9d: the cell table metaInfo_ephysio_patchSeq.csv (cell type, VEN subtype and transcriptomic cluster per file, which the files lack), the per-cell feature table Ins_patchseq_ephs.xlsx and per-cell phase peak indices PeakIdx_Fig5e.xlsx (reference values for checks that do not decide), NeuronPeakIdx_summary.mat (the 62 AIS distances of Fig. 4i), and the morphological feature table morphFeatMatrix.xlsx. Feature extraction follows the Methods, with details the Methods leave open taken from the paper's MATLAB package PatchAnaLab 1.0 (doi:10.5281/zenodo.19995355), as the helper aic.py says for each.

Claim Finding Tested or blocked
patchseq-cell-table-link The recordings are the cells of the code's cell table, and their features match its feature table Tested
morph-table-link The code's morphology table matches the dandiset's cells (link claim added here) Tested
patchseq-sample 462 cells with intrinsic properties, 12 male macaques Tested
patchseq-mapping 307 typed cells, 273 excitatory in 18 types, 34 inhibitory in 17 types Tested
fig2a-subclass-counts Excitatory cells by subclass Tested
ven-map-et-ct 29 VENs map to L5 ET (14) and L5/6 CT (15) Tested
fig6f-ven-subtype-mapping VEN-L map to L5 ET (10), VEN-S to L5/6 CT (11) Tested
fig2d-l23it-small-tau L2/3 IT HPCAL1 have the smallest tau Tested
fig2f-l23it-narrow-ap L2/3 IT HPCAL1 have narrow APs Tested
supp11-rm-itrorb-l6pc IT RORB and L6 PC have a distinctive input resistance Tested
supp11-l5it-threshold-latency L5 IT FEZF2 have a higher threshold and longer latency Tested
supp11-ven-broad-ap VENs have the broadest APs Tested
supp11-l5et-deep-sag L5 ET have the deepest sag Blocked: methods underspecified
ven-firing-rate-variability VENs fire less and more irregularly than PCs Tested
l5et-vs-l5it-sag-rm-rate L5 ET against L5 IT: deeper sag, lower input resistance, higher rate Tested
fig3e-phase-peak-index VENs have the lowest phase peak index Tested
fig3d-saddle-phase-plane VEN phase plots are saddle-shaped Tested
fig4ac-ven-broader-smaller-ap 281 VENs against 306 L5 PCs: broader, smaller APs Blocked: data missing
fig4i-peak-index-ais-distance-real Peak index falls with AIS distance (62 neurons) Tested
ext9cd-ven-subtypes-ap VEN-L (85) and VEN-S (41) APs do not differ Blocked: data missing
supp8-ven-subtypes-similar-features VEN subtypes recorded without RNA do not differ Blocked: data missing
supp9-venl-more-distinct-from-ct VEN-L differ more from L5/6 CT than VEN-S do Tested
morph-more-distinct-than-ephys Morphology differs on more features than physiology Tested
fig7c-tau-rna-distance Tau distances correlate with transcriptomic distances Tested
scrna-classes, ext1d-ven-soma-density, fig3c-ais-distance-length, fig4d-sodium-current-lower, model-ais-distance-ap-shape, fig4j-eepsp-ven-larger, fig5-psc-and-connectivity, fig6-ven-subtype-morphology-markers, fig8-metabolomics Data in other archives (DANDI:001750 to 001752, GEO, MetaboLights, NeuroMorpho, the article's Source Data) Blocked: other

The elsewhere claims are tested under the claims files of the other dandisets (DANDI:001750 to 001752) and their criteria point there; this dandiset holds none of their data. The notebook streams all 462 files (about 15 GB, read whole into memory one at a time per worker) and the first 4.4 GB of the 24.7 GB GEO archive (up to the end of Ext.h5ad). In the last run the notebook took 6.5 minutes, of which reading the files took 4 and the GEO stream 1; the stream's time depends on the GEO server.

In [1]:
import time
import warnings

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
import scikit_posthocs as sp
from scipy import stats
from scipy.io import loadmat

import aic

warnings.filterwarnings("ignore")
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 300)

started = time.time()
versions = requests.get(f"{aic.API}/dandisets/{aic.DANDISET_ID}/versions/", timeout=60).json()["results"]
info = requests.get(f"{aic.API}/dandisets/{aic.DANDISET_ID}/versions/{aic.DANDISET_VERSION}/", timeout=60).json()
assets = aic.list_assets()
cells = aic.load_all(assets)
print(f"read and measured {len(cells)} files of dandiset {aic.DANDISET_ID} version {aic.DANDISET_VERSION} "
      f"in {time.time() - started:.0f} s; extraction errors: {int(cells.get('error', pd.Series(dtype=str)).notna().sum())}")

# The paper's code tables (github.com/RFLiu2021/AIC_proj at the commit the claims file read).
meta = pd.read_csv(aic.META_CSV)
xfeat = pd.read_excel(aic.FEATURE_XLSX)
print("metaInfo_ephysio_patchSeq.csv:", meta.shape, "; Ins_patchseq_ephs.xlsx:", xfeat.shape)
read and measured 462 files of dandiset 001746 version 0.260825.0222 in 138 s; extraction errors: 0
metaInfo_ephysio_patchSeq.csv: (462, 11) ; Ins_patchseq_ephs.xlsx: (276, 42)

Data check¶

Each check of the description against the values is stated under its output.

In [2]:
print("Published versions:", [(v["version"], v["asset_count"], v["size"]) for v in versions])
s = info["assetsSummary"]
print("Archive summary: files", s["numberOfFiles"], "; subjects", s["numberOfSubjects"],
      "; species", [x["name"] for x in s["species"]], "; variables", s["variableMeasured"])
print("Files in the version's asset list:", len(assets), "; size", sum(a["size"] for a in assets) / 1e9, "GB")
print("\nFiles per subject:")
print(cells.groupby("subject_id").agg(files=("filename", "size"), sessions=("session_id", "nunique"),
                                       sex=("sex", lambda x: ",".join(sorted(set(x))))).to_string())
print("\nDistinct subjects:", cells.subject_id.nunique(), "; sessions:", cells.session_id.nunique(),
      "; session_start_time values:", cells.session_start.unique().tolist())
print("Sessions whose date is not the subject's date:")
d = cells.assign(sdate=cells.subject_id.str[3:], sess=cells.session_id.str[5:11])
print(d[d.sdate != d.sess].groupby(["subject_id", "session_id"]).size().to_string())
print("\nCell IDs unique:", cells.cell_id.is_unique, "; file identifier equals cell_id:", bool((cells.identifier == cells.cell_id).all()))
Published versions: [('draft', 462, 14735339376), ('0.260825.0222', 462, 14735339376)]
Archive summary: files 462 ; subjects 10 ; species ['Macaca fascicularis - Cynomolgus monkeys'] ; variables ['CurrentClampStimulusSeries', 'CurrentClampSeries']
Files in the version's asset list: 462 ; size 14.735339376 GB

Files per subject:
            files  sessions sex
subject_id                     
Mfa180730      42         3   M
Mfa180901      19         1   M
Mfa180913      24         1   M
Mfa180920      45         3   M
Mfa181204      57         3   M
Mfa181208      42         3   M
Mfa191122      44         3   M
Mfa220407      53         3   M
Mfa220419      65         3   M
Mfa220428      71         4   M

Distinct subjects: 10 ; sessions: 26 ; session_start_time values: ["[b'2018-01-01T01:00:00.000000+08:00']"]
Sessions whose date is not the subject's date:
subject_id  session_id     
Mfa181204   sess_180920d2      15
Mfa220428   sess_220419d1HS    19

Cell IDs unique: True ; file identifier equals cell_id: True
In [3]:
print("Device against sampling rate and samples per sweep:")
print(pd.crosstab([cells.device, cells.fs.round(0)], cells.n_samples).to_string())
print("\nUnits stated: voltage", cells.v_unit.unique().tolist(), "; current", cells.i_unit.unique().tolist())
print("Voltage range over all sweeps (mV): min", cells.v_min.min().round(1), "max", cells.v_max.max().round(1),
      "; median per-file range", cells.v_min.median().round(1), "to", cells.v_max.median().round(1))
print("Current values: files by first step (pA)", cells.i_min.value_counts().to_dict(), "; maximum from", cells.i_max.min(), "to",
      cells.i_max.max(), "; increments", sorted(cells.i_step.unique()))
print("Sweeps per file:", cells.n_sweeps_file.value_counts().sort_index().to_dict())
print("Sweep numbers 1..n in order:", bool(cells.sweep_numbers_ok.all()))
print("Step duration (ms):", cells.step_ms.round(2).value_counts().to_dict())
print("Stimulus starting_time values:", cells.i_start.unique().tolist(), "; voltage starting_time:",
      cells.v_start.round(4).unique().tolist())
print("Resting potential (mV): median", cells.RMP.median().round(1), "range", cells.RMP.min().round(1), "to", cells.RMP.max().round(1))
Device against sampling rate and samples per sweep:
n_samples                      25000  27500  55000
device                fs                          
AXON recording system 25000.0      1      3      0
                      50000.0      0      0    249
Heka LIH:8+8          25000.0    208      0      0
                      50000.0      0      0      1

Units stated: voltage ['volts'] ; current ['amperes']
Voltage range over all sweeps (mV): min -197.1 max 163.9 ; median per-file range -102.1 to 52.8
Current values: files by first step (pA) {-200.0: 378, -80.0: 67, -100.0: 13, -120.0: 2, -60.0: 2} ; maximum from 100.0 to 1480.0 ; increments [np.float64(20.0)]
Sweeps per file: {9: 1, 11: 1, 12: 1, 13: 1, 15: 1, 16: 2, 17: 2, 18: 3, 19: 3, 20: 3, 21: 2, 22: 4, 23: 2, 24: 7, 25: 1, 26: 6, 27: 4, 28: 4, 29: 5, 30: 7, 31: 2, 32: 7, 33: 3, 34: 1, 35: 3, 36: 2, 37: 5, 38: 5, 39: 6, 40: 5, 41: 2, 42: 8, 43: 7, 44: 2, 45: 1, 46: 8, 47: 8, 48: 1, 49: 8, 50: 226, 51: 4, 52: 1, 53: 3, 54: 1, 55: 6, 56: 1, 58: 1, 59: 1, 60: 72, 80: 2}
Sweep numbers 1..n in order: True
Step duration (ms): {600.02: 250, 600.04: 212}
Stimulus starting_time values: [nan] ; voltage starting_time: [0.1172, 0.1]
Resting potential (mV): median -68.3 range -85.3 to -43.8

The current series are stated in amperes; their values run from -200 to 1,480 in steps of 20, which are pA (the Methods' steps from -200 pA in 20 pA increments). The voltage is in volts as stated (resting potentials near -0.068 V, printed in mV above). Most files start at -200 pA (counts above), the others at -120 to -60 pA, and the number of sweeps per file varies from 9 to 80, so the largest step varies between files. Steps last 600 ms, as stated. The device names do not always fit the sampling rate: four files named AXON recording system are sampled at 25 kHz like the HEKA files, and one Heka file at 50 kHz. Every file has the same placeholder session start (2018-01-01 01:00), and some session IDs carry the date of another subject. The subject IDs are taken as given.

In [4]:
print("Clock check. Mean voltage change (mV) from the 10 ms before to the 10 ms after a time, on the largest")
print("hyperpolarizing sweep, at the stimulus onset, at the stimulus offset, and 100 ms before the onset:")
print(cells[["resp_at_onset", "resp_at_offset", "resp_100ms_before"]].describe().round(2).to_string())
print("Files with a hyperpolarizing response at the onset:", int((cells.resp_at_onset < 0).sum()), "of", len(cells),
      "; with a depolarizing return at the offset:", int((cells.resp_at_offset > 0).sum()))
print("Files where the change 100 ms before the onset exceeds half of that at the onset:",
      int((cells.resp_100ms_before.abs() > 0.5 * cells.resp_at_onset.abs()).sum()))
dd = cells.code_on_minus_stim_on.dropna()
print("Onset found in the voltage as the paper's code does (findStimPeriod.m) minus the stimulus onset, samples:"
      f" median {dd.median():.0f}; within 10 samples in {int((dd.abs() <= 10).sum())} of {len(dd)} files")
Clock check. Mean voltage change (mV) from the 10 ms before to the 10 ms after a time, on the largest
hyperpolarizing sweep, at the stimulus onset, at the stimulus offset, and 100 ms before the onset:
       resp_at_onset  resp_at_offset  resp_100ms_before
count         462.00          462.00             462.00
mean          -10.47           10.45              -1.99
std             7.10            7.03               5.13
min           -57.33            0.13             -50.12
25%           -12.86            5.87              -2.30
50%            -8.25            8.27              -0.09
75%            -5.83           12.88               0.00
max            -0.00           57.10              19.02
Files with a hyperpolarizing response at the onset: 462 of 462 ; with a depolarizing return at the offset: 462
Files where the change 100 ms before the onset exceeds half of that at the onset: 48
Onset found in the voltage as the paper's code does (findStimPeriod.m) minus the stimulus onset, samples: median -2; within 10 samples in 352 of 458 files

In every file the voltage falls at the stimulus onset and rises at its offset, so the voltage and stimulus series share one clock. In some files a change of similar size appears 100 ms before the onset (counted above); in the 600 ms protocol this is outside the step and is consistent with a test pulse or spontaneous activity before it. It does not move the step. The paper's code finds the step in the voltage within fixed sample windows; its onset lies within a few samples of the stimulus onset in most files, and the analysis uses the stimulus onset.

In [5]:
dup = cells[cells.trace_hash.duplicated(keep=False)].merge(
    meta.drop_duplicates("filename_nwb"), left_on="filename", right_on="filename_nwb", how="left")
print("Files with identical voltage data (all sweeps), by pair:")
print(dup.sort_values("trace_hash")[["trace_hash", "filename", "cell_id", "subject_id_x", "cellType", "cellSubtype",
                                     "predictCluster", "predictCluster_label"]].to_string(index=False))
print("Pairs:", dup.trace_hash.nunique(), "; distinct recordings in the dandiset:", cells.trace_hash.nunique())
Files with identical voltage data (all sweeps), by pair:
                      trace_hash                                                 filename cell_id subject_id_x cellType cellSubtype  predictCluster predictCluster_label
17956d8b0398a64c50281a0a1448263d   sub-Mfa181204_ses-sess-181204d1_obj-7p0ibf_icephys.nwb    s640    Mfa181204      VEN         NaN             NaN                  NaN
17956d8b0398a64c50281a0a1448263d   sub-Mfa220407_ses-sess-220407d1_obj-rbzf82_icephys.nwb      n5    Mfa220407      NaN       PC_L5            18.0       Exc FEZF2 MCUB
25572946cefdc1dd5d5691f5f7fd3408  sub-Mfa191122_ses-sess-191122d3_obj-1c5hv0u_icephys.nwb    B722    Mfa191122       PC       PC_L5            16.0       Exc FEZF2 DSG2
25572946cefdc1dd5d5691f5f7fd3408   sub-Mfa191122_ses-sess-191122d3_obj-8oie4j_icephys.nwb    B726    Mfa191122       PC         NaN             NaN                  NaN
a5a90858bf05b7ce7c1d0d039872ffcd   sub-Mfa181204_ses-sess-180920d2_obj-51ja2p_icephys.nwb    s653    Mfa181204       PC         NaN             NaN                  NaN
a5a90858bf05b7ce7c1d0d039872ffcd   sub-Mfa220407_ses-sess-220407d2_obj-gamybh_icephys.nwb     n29    Mfa220407       PC         NaN            16.0       Exc FEZF2 DSG2
ae539d62481a39917b0015443bccd21c   sub-Mfa180913_ses-sess-180913d1_obj-ffckjh_icephys.nwb    s485    Mfa180913       PC     PC_L5ET            16.0       Exc FEZF2 DSG2
ae539d62481a39917b0015443bccd21c  sub-Mfa181204_ses-sess-181204d3_obj-1iru70o_icephys.nwb    s676    Mfa181204      NaN         NaN             NaN                  NaN
e35b10130cf52f825e19392e6347e4dd  sub-Mfa191122_ses-sess-191122d1_obj-19xxyn1_icephys.nwb    B289    Mfa191122       PC       PC_L5            16.0       Exc FEZF2 DSG2
e35b10130cf52f825e19392e6347e4dd sub-Mfa220428_ses-sess-220419d1HS_obj-4i5l3i_icephys.nwb    n175    Mfa220428       PC       PC_L6             8.0    Exc FEZF2 COL24A1
Pairs: 5 ; distinct recordings in the dandiset: 457

Five pairs of files hold identical voltage data in every sweep under different cell IDs, four of them under different subjects. Each pair is one recording deposited twice. In four pairs only one of the two cells has a transcriptomic type in the code's table, so the other cannot enter an analysis by type; in the fifth (B289 and n175) both have one, cluster 16 (PC, so L5 ET) and cluster 8 (PC, the L5/6 CT PCs, in none of the six Fig. 2 groups). Counts below are given for files and for distinct recordings. The copy n175 is left out of the L5/6 CT group of supp9-venl-more-distinct-from-ct, which would otherwise hold a recording also filed as an L5 ET cell.

In [6]:
paths = sorted(set().union(*cells.h5_paths))
print("HDF5 object paths over all files (digits as #):", len(paths))
print([p for p in paths if not p.startswith("specifications")])
strs = pd.DataFrame([(n, v) for t in cells.h5_strings for n, v in t], columns=["path", "value"])
print("\nString values and attributes outside the sweeps and specifications, distinct values per path:")
print(strs.groupby("path").value.nunique().to_string())
keys = r"VEN|PC_|Exc|Inh|INTER|cluster|FEZF2|RORB|HPCAL1|cell.?type|transcript"
hits = strs[strs.value.str.contains(keys, case=False, regex=True)]
print("\nValues mentioning a cell type, cluster or transcriptomic label:", len(hits))
print(hits.drop_duplicates().head(20).to_string(index=False))
desc = strs[strs.path.str.contains("description")]
print("\nDescription fields, their distinct values:")
for path, vals in desc.groupby("path").value.unique().items():
    print(f"  {path}: {[str(v)[:300] for v in vals]}")
HDF5 object paths over all files (digits as #): 67
['acquisition', 'acquisition/CurrentClampSeries###', 'acquisition/CurrentClampSeries###/data', 'acquisition/CurrentClampSeries###/gain', 'acquisition/CurrentClampSeries###/starting_time', 'analysis', 'file_create_date', 'general', 'general/devices', 'general/devices/AXON recording system', 'general/devices/Heka LIH:#+#', 'general/experiment_description', 'general/experimenter', 'general/extracellular_ephys', 'general/institution', 'general/intracellular_ephys', 'general/intracellular_ephys/IntracellularElectrode', 'general/intracellular_ephys/IntracellularElectrode/cell_id', 'general/intracellular_ephys/IntracellularElectrode/description', 'general/keywords', 'general/lab', 'general/optogenetics', 'general/optophysiology', 'general/session_id', 'general/stimulus', 'general/subject', 'general/subject/age', 'general/subject/description', 'general/subject/sex', 'general/subject/species', 'general/subject/subject_id', 'identifier', 'intervals', 'processing', 'scratch', 'session_description', 'session_start_time', 'stimulus', 'stimulus/presentation', 'stimulus/presentation/CurrentClampStimulusSeries###', 'stimulus/presentation/CurrentClampStimulusSeries###/data', 'stimulus/presentation/CurrentClampStimulusSeries###/gain', 'stimulus/presentation/CurrentClampStimulusSeries###/starting_time', 'stimulus/templates', 'timestamps_reference_time']

String values and attributes outside the sweeps and specifications, distinct values per path:
path
file_create_date                                                  462
general/devices/AXON recording system                             256
general/devices/Heka LIH:8+8                                      212
general/experiment_description                                      1
general/experimenter                                                1
general/institution                                                 1
general/intracellular_ephys/IntracellularElectrode                464
general/intracellular_ephys/IntracellularElectrode/cell_id        462
general/intracellular_ephys/IntracellularElectrode/description      1
general/keywords                                                    1
general/lab                                                         1
general/session_id                                                 26
general/stimulus                                                    1
general/subject                                                   464
general/subject/age                                                 1
general/subject/description                                         1
general/subject/sex                                                 1
general/subject/species                                             1
general/subject/subject_id                                         10
identifier                                                        462
session_description                                                 1
session_start_time                                                  1
timestamps_reference_time                                           1

Values mentioning a cell type, cluster or transcriptomic label: 0
Empty DataFrame
Columns: [path, value]
Index: []

Description fields, their distinct values:
  general/experiment_description: ['Patch-seq experiment of cell atlas investigation of the macaque anterior insular cortex,']
  general/intracellular_ephys/IntracellularElectrode/description: ['custom-made glass intracellular electrode']
  general/subject/description: ['Health animal']
  session_description: ['intracellular firing pattern recording']

Beyond the fields aic.read_nwb reads, the files hold no table, processing module or annotation: the object tree above is the same in every file, and no string value or attribute names a cell type, VEN subtype or transcriptomic cluster.

patchseq-cell-table-link¶

The dandiset's recordings are the Patch-seq cells of the paper's code table metaInfo_ephysio_patchSeq.csv, with the same subjects, expert cell types and predicted transcriptomic clusters, and the features computed from them agree with the paper's per-cell feature table.

Matched by file name. The files carry a subject and a cell ID, and no cell type or transcriptomic type, so those are the labels compared. Features are computed as the Methods define them (see the helper's docstring); the code's per-cell table is the reference.

In [7]:
link = meta.merge(cells[["filename", "cell_id", "subject_id"]], left_on="filename_nwb", right_on="filename", how="left")
found = link.filename.notna()
print("Rows of the table:", len(meta), "; rows whose file is in the dandiset:", int(found.sum()),
      f"({found.mean():.1%})")
print("Rows naming a file another row also names:")
print(meta[meta.filename_nwb.duplicated(keep=False)].to_string())
print("Dandiset files named by no row:", sorted(set(cells.filename) - set(meta.filename_nwb)))
print("Rows whose cell ID agrees with the file's:", int((link.cell_ID == link.cell_id).sum()),
      "; whose subject agrees:", int((link.subject_id_x == link.subject_id_y).sum()))
print(link[(link.subject_id_x != link.subject_id_y)][["subject_id_x", "cell_ID", "filename_nwb", "subject_id_y", "cell_id"]].to_string())
unlisted = cells[~cells.filename.isin(meta.filename_nwb)][["filename", "cell_id", "subject_id"]]
print("The unlisted file:", unlisted.to_dict("records"))
Rows of the table: 462 ; rows whose file is in the dandiset: 462 (100.0%)
Rows naming a file another row also names:
    subject_id cell_ID                                              filename_nwb cellType cellSubtype  mappingRate seq_batch  predictCluster predictCluster_label  mainClusterCorrs morphoTraced
110  Mfa220428    n172  sub-Mfa220428_ses-sess-220419d1HS_obj-1gxrou_icephys.nwb       PC         NaN          NaN       NaN             NaN                  NaN               NaN          NaN
235  Mfa180730    n172  sub-Mfa220428_ses-sess-220419d1HS_obj-1gxrou_icephys.nwb      NaN         NaN          NaN       NaN             NaN                  NaN               NaN          NaN
Dandiset files named by no row: ['sub-Mfa180730_ses-sess-180730d1_obj-1qsqh8f_icephys.nwb']
Rows whose cell ID agrees with the file's: 462 ; whose subject agrees: 461
    subject_id_x cell_ID                                              filename_nwb subject_id_y cell_id
235    Mfa180730    n172  sub-Mfa220428_ses-sess-220419d1HS_obj-1gxrou_icephys.nwb    Mfa220428    n172
The unlisted file: [{'filename': 'sub-Mfa180730_ses-sess-180730d1_obj-1qsqh8f_icephys.nwb', 'cell_id': 's172', 'subject_id': 'Mfa180730'}]
In [8]:
m1 = meta.drop_duplicates("cell_ID").set_index("cell_ID")
byfile = cells.set_index("filename")
xf = xfeat.copy()
xf["filename"] = xf.Cell_ID.map(m1.filename_nwb)
print("Rows of Ins_patchseq_ephs.xlsx:", len(xf), "; with a cell ID in the table:", int(xf.filename.notna().sum()),
      "; cluster in xlsx equals the table's:", int((xf.predictCluster.values == xf.Cell_ID.map(m1.predictCluster).values).sum()))
xm = xf.dropna(subset=["filename"]).join(byfile, on="filename", lsuffix="_xlsx")
pairs = [("half_width", "Half_Width_ms", "AP half-width (ms)"), ("amplitude", "AP_Amplitute", "AP amplitude (mV)"),
         ("max_firing_rate", "MaxFiringRate", "maximal firing rate (Hz)")]
rows = []
for mine, theirs, name in pairs + [("half_width_code", "Half_Width_ms", "half-width, code's threshold window (variant)"),
                                   ("tau_code", "Tau_ms", "tau, first sweep (code)"), ("tau_methods", "Tau_ms", "tau, all hyperpolarizing sweeps (Methods)"),
                                   ("Rm_methods", "Rm_MO", "input resistance (Methods)"), ("Rm_code", "Rm_MO", "input resistance (code)"),
                                   ("threshold", "Threshold_mV", "AP threshold"), ("latency", "Spike_Latency_ms", "spike latency"),
                                   ("rheobase", "Rheobase_pA", "rheobase"), ("sag_ratio", "Sag_Ratio", "sag ratio"),
                                   ("RMP", "RMP_mV", "RMP"), ("ISI_CV", "ISI_CV_xlsx", "ISI CV"), ("ISI_Fano", "ISI_FanoFactor", "ISI Fano factor")]:
    a, b = xm[mine].astype(float), pd.to_numeric(xm[theirs], errors="coerce")
    ok = a.notna() & b.notna()
    r = (a[ok] / b[ok] - 1).abs()
    rows.append({"feature": name, "cells": int(ok.sum()), "within_10pct": round(float((r <= 0.1).mean()), 3),
                 "median_ratio": round(float((a[ok] / b[ok]).median()), 3), "spearman": round(stats.spearmanr(a[ok], b[ok])[0], 3)})
agree = pd.DataFrame(rows)
print(agree.to_string(index=False))
print("\nThe criterion's three features (first three rows) within 10% for at least 80% of matched cells:",
      bool((agree.within_10pct[:3] >= 0.8).all()))
Rows of Ins_patchseq_ephs.xlsx: 276 ; with a cell ID in the table: 276 ; cluster in xlsx equals the table's: 273
                                      feature  cells  within_10pct  median_ratio  spearman
                           AP half-width (ms)    274         0.967         0.988     0.909
                            AP amplitude (mV)    276         0.975         1.000     0.979
                     maximal firing rate (Hz)    276         0.989         1.000     0.998
half-width, code's threshold window (variant)    274         0.967         0.988     0.909
                      tau, first sweep (code)    266         0.985         1.003     0.999
    tau, all hyperpolarizing sweeps (Methods)    275         0.095         1.263     0.933
                   input resistance (Methods)    276         0.797         1.035     0.950
                      input resistance (code)    275         0.422         1.069     0.952
                                 AP threshold    271         0.974         1.000     0.941
                                spike latency    276         0.989         0.999     0.996
                                     rheobase    276         0.989         1.000     1.000
                                    sag ratio    276         0.822         1.043     0.830
                                          RMP    276         0.822         1.053     0.841
                                       ISI CV    257         0.879         1.000     0.793
                              ISI Fano factor    254         0.866         1.000     0.791

The criterion's three features (first three rows) within 10% for at least 80% of matched cells: True
In [9]:
lab = meta.drop_duplicates("filename_nwb").merge(cells, left_on="filename_nwb", right_on="filename", suffixes=("_table", ""))
lab["group"] = [aic.code_group(c, t) for c, t in zip(lab.predictCluster, lab.cellType)]
xf["group"] = [aic.code_group(c, t) for c, t in zip(xf.predictCluster, xf.ExpertCellType)]
legend = pd.Series([30, 17, 119, 22, 16, 13], index=aic.GROUPS)
cnt = pd.DataFrame({"legend Fig. 2d": legend, "table labels, all files": lab.group.value_counts(),
                    "xlsx labels (code)": xf.group.value_counts()}).loc[aic.GROUPS]
print(cnt.to_string())
both = xf.dropna(subset=["filename"]).merge(lab[["filename", "group"]], on="filename", suffixes=("_xlsx", "_table"))
print("\nCells in the xlsx whose group differs between its labels and the table's:",
      int((both.group_xlsx.fillna("-") != both.group_table.fillna("-")).sum()))
print(pd.crosstab(both.group_xlsx.fillna("-"), both.group_table.fillna("-")).to_string())
                legend Fig. 2d  table labels, all files  xlsx labels (code)
L2/3 IT HPCAL1              30                       30                  30
IT RORB                     17                       21                  22
L5 IT FEZF2                119                      125                 122
VEN                         22                       29                  29
L5 ET                       16                       18                  17
L6 PC                       13                       14                  13

Cells in the xlsx whose group differs between its labels and the table's: 2
group_table      -  IT RORB  L2/3 IT HPCAL1  L5 ET  L5 IT FEZF2  L6 PC  VEN
group_xlsx                                                                 
-               42        0               0      1            0      0    0
IT RORB          0       21               0      0            0      1    0
L2/3 IT HPCAL1   0        0              30      0            0      0    0
L5 ET            0        0               0     17            0      0    0
L5 IT FEZF2      0        0               0      0          122      0    0
L6 PC            0        0               0      0            0     13    0
VEN              0        0               0      0            0      0   29

Result: link reproduced. All 462 rows of the cell table name a file in the dandiset, and every row's cell ID equals its file's. One file (cell s172, subject Mfa180730) is named by no row; its subject's row (row 235) instead names cell n172 and the file of n172 (subject Mfa220428), which row 110 also names, so that row is the only one whose subject disagrees (461 of 462 agree). Row 235 is read as an error of the table for the file of s172, which no row names: it is a second row for a file that has its own row, and it carries no type. Under the letter of the criterion ("not reproduced when ... labels disagree") that row would fail the link. The outcome rests on this reading, an assumption recorded in the attempt. The files carry no cell type or transcriptomic type to compare, and no other annotation (the object tree above). For the 276 cells of the feature table, AP half-width is within 10% of the table's value for 96.7% of cells, AP amplitude for 97.5% and maximal firing rate for 98.9%, all above the criterion's 80%; threshold agrees for 97.4%. The six Fig. 2 groups formed by the code's lists hold 30, 21, 125, 29, 18 and 14 files (the xlsx labels give 30, 22, 122, 29, 17 and 13) against the legend's 30, 17, 119, 22, 16 and 13; this does not decide.

patchseq-sample¶

Of 578 Patch-seq cells profiled across all layers of the AIC, 462 were characterized for their intrinsic membrane properties; the Patch-seq experiments used 12 male macaques.

In [10]:
print("Files with a current-clamp step protocol:", len(cells), "(expected 462, tolerance 46)")
print("Distinct recordings (identical pairs counted once):", cells.trace_hash.nunique())
print("Distinct subjects:", cells.subject_id.nunique(), "(expected 12, tolerance 1.2); sexes:", cells.sex.unique().tolist())
Files with a current-clamp step protocol: 462 (expected 462, tolerance 46)
Distinct recordings (identical pairs counted once): 457
Distinct subjects: 10 (expected 12, tolerance 1.2); sexes: ['M']

Result: sample partially reproduced. 462 files hold a current-clamp step protocol (457 distinct recordings, as five pairs are identical), within 462 plus or minus 46. They come from 10 subjects, outside 12 plus or minus 1.2, all male.

patchseq-mapping¶

Of the Patch-seq cells with transcriptomes, 307 were analysed; 273 excitatory neurons map to 18 of the 20 excitatory types and 34 inhibitory neurons to 17 of the 33 inhibitory types.

In [11]:
typed = lab[lab.predictCluster_label.notna()].copy()
print("Rows with a mapping rate:", int(lab.mappingRate.notna().sum()), "; of these below 30%:", int((lab.mappingRate < 0.3).sum()),
      "; mapping rate range", lab.mappingRate.min(), "to", lab.mappingRate.max())
typed = typed[typed.mappingRate >= 0.3]
cls = typed.predictCluster_label.str[:3]
res = pd.DataFrame({
    "measured, files": [len(typed), int((cls == "Exc").sum()), int((cls == "Inh").sum()),
                        typed[cls == "Exc"].predictCluster_label.nunique(), typed[cls == "Inh"].predictCluster_label.nunique()],
    "expected": [307, 273, 34, 18, 17], "tolerance": [31, 27, 3.4, 1.8, 1.7]},
    index=["with a transcriptomic type", "excitatory", "inhibitory", "excitatory types", "inhibitory types"])
uniq = typed.drop_duplicates("trace_hash")
res["measured, distinct recordings"] = [len(uniq), int((uniq.predictCluster_label.str[:3] == "Exc").sum()),
                                        int((uniq.predictCluster_label.str[:3] == "Inh").sum()),
                                        uniq[uniq.predictCluster_label.str[:3] == "Exc"].predictCluster_label.nunique(),
                                        uniq[uniq.predictCluster_label.str[:3] == "Inh"].predictCluster_label.nunique()]
res["within"] = (res["measured, files"] - res.expected).abs() <= res.tolerance
print(res.to_string())
Rows with a mapping rate: 278 ; of these below 30%: 0 ; mapping rate range 0.4039 to 0.9266
                            measured, files  expected  tolerance  measured, distinct recordings  within
with a transcriptomic type              278       307       31.0                            277    True
excitatory                              248       273       27.0                            247    True
inhibitory                               30        34        3.4                             30   False
excitatory types                         17        18        1.8                             17    True
inhibitory types                         17        17        1.7                             17    True

Result: mapping partially reproduced. 278 files have a transcriptomic type (expected 307, within tolerance), 248 excitatory (273, within) in 17 types (18, within), and 30 inhibitory (34 plus or minus 3.4, outside) in 17 types (17, within). No typed row has a mapping rate below 30% (the lowest is 0.40): the table holds only the cells kept after the mapping. Counting identical recordings once leaves 247 excitatory cells.

fig2a-subclass-counts¶

The 273 excitatory Patch-seq neurons fall in seven of the eight subclasses, L2/3 IT HPCAL1 (33), IT RORB (23), L5 IT FEZF2 (143), L5 ET (20), L5/6 CT (11), L6 IT (5) and L6b (9).

Reading (a), the code's cluster lists; VENs counted apart. Reading (b), the dataset's metadata, does not exist: the files give no subclass.

In [12]:
exc = typed[typed.predictCluster_label.str.startswith("Exc")].copy()
is_ven = exc.cellType.fillna("").str.upper().str.contains("VEN")
def subclass(c, ven):
    c = int(c)
    if ven:
        return "VEN"
    for g, cl in aic.CLUSTERS.items():
        if c in cl:
            return {"L6 PC": "L6 IT + L6b"}.get(g, g)
    return {16: "L5 ET", 8: "L5/6 CT"}.get(c, "other")
exc["subclass"] = [subclass(c, v) for c, v in zip(exc.predictCluster, is_ven)]
exp = pd.DataFrame({"expected": [33, 23, 143, 20, 11, 14], "tolerance": [3.3, 2.3, 14.3, 2, 1.1, 1.4]},
                   index=["L2/3 IT HPCAL1", "IT RORB", "L5 IT FEZF2", "L5 ET", "L5/6 CT", "L6 IT + L6b"])
exp["measured"] = exc.subclass.value_counts().reindex(exp.index).fillna(0).astype(int)
exp["within"] = (exp.measured - exp.expected).abs() <= exp.tolerance
print(exp.to_string())
print("VENs, counted apart:", int((exc.subclass == "VEN").sum()), "; excitatory cells in no subclass:", int((exc.subclass == "other").sum()))
print("Excitatory total:", len(exc), "; without VENs:", int((exc.subclass != "VEN").sum()))
print("\nVariant (does not decide), VENs counted in their cluster's subclass:")
print(pd.Series([subclass(c, False) for c in exc.predictCluster]).value_counts().reindex(exp.index).to_string())
print("\nClusters by subclass (cluster number, label, cells):")
print(exc.groupby(["subclass", "predictCluster", "predictCluster_label"]).size().to_string())
                expected  tolerance  measured  within
L2/3 IT HPCAL1        33        3.3        30    True
IT RORB               23        2.3        21    True
L5 IT FEZF2          143       14.3       125   False
L5 ET                 20        2.0        18    True
L5/6 CT               11        1.1        11    True
L6 IT + L6b           14        1.4        14    True
VENs, counted apart: 29 ; excitatory cells in no subclass: 0
Excitatory total: 248 ; without VENs: 219

Variant (does not decide), VENs counted in their cluster's subclass:
L2/3 IT HPCAL1     30
IT RORB            21
L5 IT FEZF2       125
L5 ET              32
L5/6 CT            26
L6 IT + L6b        14

Clusters by subclass (cluster number, label, cells):
subclass        predictCluster  predictCluster_label
IT RORB         0.0             Exc RORB SCN7A           7
                2.0             Exc RORB CDK2AP1        11
                13.0            Exc RORB FAP             2
                19.0            Exc RORB TRDN            1
L2/3 IT HPCAL1  1.0             Exc HPCAL1 MEPE          4
                5.0             Exc HPCAL1 FREM3        16
                15.0            Exc HPCAL1 PENK         10
L5 ET           16.0            Exc FEZF2 DSG2          18
L5 IT FEZF2     3.0             Exc FEZF2 RSPO3          7
                6.0             Exc FEZF2 LTBP3         32
                9.0             Exc RORB DEPTOR          2
                11.0            Exc RORB CHI3L1          4
                14.0            Exc RORB NRG1           42
                18.0            Exc FEZF2 MCUB          38
L5/6 CT         8.0             Exc FEZF2 COL24A1       11
L6 IT + L6b     4.0             Exc FEZF2 SMYD1          5
                17.0            Exc HPCAL1 KANK4         9
VEN             8.0             Exc FEZF2 COL24A1       15
                16.0            Exc FEZF2 DSG2          14

Result: fig2a partially reproduced. Under the code's cluster lists, with the 29 VENs counted apart, 5 of the 6 judged counts are within tolerance: L2/3 IT HPCAL1 30 (33), IT RORB 21 (23), L5 ET 18 (20), L5/6 CT 11 (11), and L6 IT with L6b 14 (14). L5 IT FEZF2 holds 125, outside 143 plus or minus 14.3. The excitatory cells total 248 against the stated 273. Reading (b) cannot be run, as the files give no subclass.

ven-map-et-ct¶

The 29 morphologically identified VENs do not map to one transcriptomic cluster; 14 map to L5 ET and 15 to L5/6 CT.

In [13]:
ven = typed[typed.cellType.fillna("").str.upper().str.contains("VEN")]
print("VENs (expert type VEN) with a transcriptomic type:", len(ven), "; distinct recordings:", ven.trace_hash.nunique())
print(ven.predictCluster_label.value_counts().to_string())
print("Expected 14 (tolerance 1.4) in Exc FEZF2 DSG2 and 15 (1.5) in Exc FEZF2 COL24A1")
print("All VENs in the table, with or without a type:", int(meta.drop_duplicates("filename_nwb").cellType.fillna("").str.upper().str.contains("VEN").sum()))
VENs (expert type VEN) with a transcriptomic type: 29 ; distinct recordings: 29
predictCluster_label
Exc FEZF2 COL24A1    15
Exc FEZF2 DSG2       14
Expected 14 (tolerance 1.4) in Exc FEZF2 DSG2 and 15 (1.5) in Exc FEZF2 COL24A1
All VENs in the table, with or without a type: 68

Result: venmap reproduced. The 29 VENs with a transcriptomic type map to Exc FEZF2 DSG2 (14) and Exc FEZF2 COL24A1 (15), and to no other cluster. The table holds 68 VENs in all.

fig6f-ven-subtype-mapping¶

VENs mapped to L5 ET (Exc FEZF2 DSG2) are VEN-Ls (n = 10) and those mapped to L5/6 CT (Exc FEZF2 COL24A1) are VEN-Ss (n = 11).

In [14]:
sub = ven.cellSubtype.fillna("no subtype").str.replace("VEN_short", "VEN_Short")
ct = pd.crosstab(ven.predictCluster_label, sub)
print(ct.to_string())
print("Expected VEN_Long in Exc FEZF2 DSG2: 10 (tolerance 1); VEN_Short in Exc FEZF2 COL24A1: 11 (1.1)")
print("Subtype spellings in the table:", sorted(meta.cellSubtype.dropna().unique()))
print("VEN subtypes, all files:", meta.drop_duplicates("filename_nwb").cellSubtype.value_counts().filter(like="VEN").to_dict())
cellSubtype           L23_PC  PC_L23  PC_L5  VEN_Long  VEN_Short  no subtype
predictCluster_label                                                        
Exc FEZF2 COL24A1          2       0      1         0         10           2
Exc FEZF2 DSG2             0       1      0        12          0           1
Expected VEN_Long in Exc FEZF2 DSG2: 10 (tolerance 1); VEN_Short in Exc FEZF2 COL24A1: 11 (1.1)
Subtype spellings in the table: ['INTER_L23', 'INTER_L5', 'L1_INTER', 'L23_INTER', 'L23_PC', 'L6_INTER', 'PC_5', 'PC_L23', 'PC_L5', 'PC_L5ET', 'PC_L6', 'VEN_Long', 'VEN_Short', 'VEN_short']
VEN subtypes, all files: {'VEN_Long': 18, 'VEN_Short': 15, 'VEN_short': 1}

Result: fig6f partially reproduced. The subtypes follow the clusters as stated: every VEN_Long with a type is in Exc FEZF2 DSG2 and every VEN_Short in Exc FEZF2 COL24A1, and none crosses. The counts are 12 VEN-L (expected 10 plus or minus 1, outside) and 10 VEN-S (11 plus or minus 1.1, within). The other VENs of the two clusters carry a PC subtype label (L23_PC, PC_L23, PC_L5) or none.

Feature comparisons between the six projection neuron groups¶

The groups are formed as calFDR_ephsio.m forms them, from the table's cluster and expert type, on the files with a transcriptomic type. The tests are two-sided Wilcoxon rank-sum tests with Benjamini-Hochberg FDR over the features of each comparison (calFDR_ephsio.m). The claims file makes the family the 39 features of Ins_patchseq_ephs.xlsx, those the Methods define computed as defined there. Nineteen of them (phase areas and perimeters, ISI phase ratios, slopes of FR and first ISI, amplitude CV and Fano factor, AHP latency and others) are defined neither in the Methods nor in PatchAnaLab, so they cannot be computed from the recordings; their values are taken from the code's table by cell ID (234 of the 237 grouped cells are in it), and the FDR over the 39 features (q39) decides. The 20 features the Methods name form the variant family (q_F20; for the ISI CV and Fano factor, which are not among them, these 20 and the two ISI measures). q39_upper is the bound on the FDR over 39 features that holds whatever the 19 other p-values are, shown as a check.

In [15]:
grp = lab[lab.predictCluster_label.notna() & (lab.mappingRate >= 0.3) & lab.group.notna()].copy()
print("Cells per group (files):", grp.group.value_counts().reindex(aic.GROUPS).to_dict(), "; legend:", legend.to_dict())
print("Cells per group per subject:")
print(pd.crosstab(grp.subject_id, grp.group)[aic.GROUPS].to_string())
F20 = ["rheobase", "threshold", "amplitude", "rise", "decay", "half_width", "latency", "AHP", "max_firing_rate",
       "sag_value", "sag_ratio", "sag_time", "sag_area", "RMP", "Rm_methods", "tau_methods", "rebound",
       "ISI_adaptation", "amp_adaptation", "latency_slope"]
# The computed features that are among the 39 of the xlsx (max spike count and maximal rate are both there).
IN39 = ["tau_methods", "sag_ratio", "Rm_methods", "RMP", "rheobase", "latency", "threshold", "amplitude", "AHP", "rise",
        "decay", "half_width", "max_spikes", "max_firing_rate", "rebound", "ISI_adaptation", "amp_adaptation", "ISI_CV",
        "ISI_Fano", "latency_slope"]
EXTRA = ["ISI_CV", "ISI_Fano", "tau_code", "Rm_code", "max_spikes", "tau_sweep_median"]
# The 19 features of the xlsx defined neither in the Methods nor in PatchAnaLab, taken from the xlsx by cell ID
# (the code's own values), so that the BH family of 39 features can be formed.
X19 = ["ReboundSpike", "aveAPwidth_maxSweep", "RisDecayTRatio", "AHP_latency", "AP_widthRatio", "amp_ratio",
       "amp_FanoFactor", "amp_CV", "ISI_ratio", "ISI_phaseT_ratio", "ISI_phaseT_ratio_CV", "FR_slope", "firstISI_slope",
       "ISI_adpIdx_slope", "ampAdpIdx_slope", "firstSpikePhaseArea", "firstSpikePhasePerimeter", "spikePhaseAreaRatio",
       "spikePhasePerimeterRatio"]
assert len(IN39) + len(X19) == 39 and set(X19) <= set(xfeat.columns)
xv = xfeat.set_index(xfeat.Cell_ID.astype(str))[X19].apply(pd.to_numeric, errors="coerce")
for d, key in ((lab, "cell_ID"), (grp, "cell_ID"), (cells, "cell_id")):
    for f in X19:
        d[f] = d[key].astype(str).map(xv[f])
print("Grouped cells with the xlsx's values for the 19 features:", int(grp[X19].notna().any(axis=1).sum()), "of", len(grp))

def upper39(p):
    """Upper bound of the BH-adjusted p-value of each known feature in a 39-feature family."""
    p = pd.Series(p).dropna()
    r = p.rank(method="first")
    bound = (p * 39 / r).clip(upper=1)
    return pd.Series({k: bound[p >= p[k]].min() for k in p.index})

def compare(df, a_groups, b_groups, features=None):
    """Rank-sum tests of a against b for every feature, with the FDR readings described above."""
    a, b = df[df.group.isin(a_groups)], df[df.group.isin(b_groups)]
    feats = sorted(set(F20 + IN39 + EXTRA + X19), key=(F20 + IN39 + EXTRA + X19).index)
    rows = {}
    for f in feats:
        x, y = a[f].astype(float).dropna(), b[f].astype(float).dropna()
        p = stats.mannwhitneyu(x, y, alternative="two-sided").pvalue if len(x) > 1 and len(y) > 1 else np.nan
        rows[f] = {"n_a": len(x), "n_b": len(y), "median_a": x.median(), "median_b": y.median(), "p": p}
    t = pd.DataFrame(rows).T
    t["q_F20"] = np.nan
    t.loc[F20, "q_F20"] = aic.bh(t.loc[F20, "p"].astype(float))
    q22 = aic.bh(t.loc[F20 + ["ISI_CV", "ISI_Fano"], "p"].astype(float))
    t.loc[["ISI_CV", "ISI_Fano"], "q_F20"] = q22[-2:]
    t["q39_upper"] = upper39(t.loc[IN39, "p"].astype(float))
    t["q39"] = np.nan
    t.loc[IN39 + X19, "q39"] = aic.bh(t.loc[IN39 + X19, "p"].astype(float))
    for var, base in {"tau_code": "tau_methods", "Rm_code": "Rm_methods", "tau_sweep_median": "tau_methods"}.items():  # a variant in its base's place
        t.loc[var, "q39_upper"] = upper39(t.loc[[var if f == base else f for f in IN39], "p"].astype(float))[var]
        fam = [var if f == base else f for f in IN39 + X19]
        t.loc[var, "q39"] = aic.bh(t.loc[fam, "p"].astype(float))[fam.index(var)]
        fam = [var if f == base else f for f in F20]
        t.loc[var, "q_F20"] = aic.bh(t.loc[fam, "p"].astype(float))[fam.index(var)]
    t["F39"] = np.where(t.q39 < 0.05, "sig", "ns")
    t.loc[~t.index.isin(IN39 + ["tau_code", "Rm_code", "tau_sweep_median"]), "F39"] = "-"
    if features is not None:
        t = t.loc[features]
    return t

def readings(df, target, features):
    """Reading (a): target against the other five pooled; (b): against each other group."""
    others = [g for g in aic.GROUPS if g != target]
    out = []
    t = compare(df, [target], others, features)
    t.insert(0, "against", "other five pooled")
    out.append(t)
    for g in others:
        t = compare(df, [target], [g], features)
        t.insert(0, "against", g)
        out.append(t)
    r = pd.concat(out)
    r.index.name = "feature"
    return r.reset_index()

def medians(df, features):
    return df.groupby("group")[features].median().reindex(aic.GROUPS)

def show(r):
    cols = ["feature", "against", "n_a", "n_b", "median_a", "median_b", "p", "q39", "q_F20", "q39_upper", "F39"]
    print(r[cols].to_string(index=False, float_format=lambda v: f"{v:.4g}"))

print("\nGroup medians of the measures used below:")
print(medians(grp, ["tau_methods", "tau_code", "half_width", "Rm_methods", "threshold", "latency", "sag_ratio",
                    "sag_value", "max_firing_rate", "ISI_CV", "ISI_Fano"]).round(3).to_string())
print("\nFeature values missing (no AP, too few APs, failed fit), cells:")
print(grp[F20 + ["ISI_CV", "ISI_Fano", "tau_code"]].isna().sum().to_string())
Cells per group (files): {'L2/3 IT HPCAL1': 30, 'IT RORB': 21, 'L5 IT FEZF2': 125, 'VEN': 29, 'L5 ET': 18, 'L6 PC': 14} ; legend: {'L2/3 IT HPCAL1': 30, 'IT RORB': 17, 'L5 IT FEZF2': 119, 'VEN': 22, 'L5 ET': 16, 'L6 PC': 13}
Cells per group per subject:
group       L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2  VEN  L5 ET  L6 PC
subject_id                                                         
Mfa180730                0        0           12    3      0      1
Mfa180901                1        0           11    2      0      0
Mfa180913                0        0           11    4      2      0
Mfa180920                5        2           17    2      0      3
Mfa181204                0        1           15    3      0      0
Mfa181208                0        0           17    2      0      1
Mfa191122                3        1           12    3      8      0
Mfa220407                3        3           18    0      4      4
Mfa220419                9        7            5    4      1      1
Mfa220428                9        7            7    6      3      4
Grouped cells with the xlsx's values for the 19 features: 234 of 237

Group medians of the measures used below:
                tau_methods  tau_code  half_width  Rm_methods  threshold  latency  sag_ratio  sag_value  max_firing_rate  ISI_CV  ISI_Fano
group                                                                                                                                     
L2/3 IT HPCAL1       32.705    24.240        2.08     182.805    -38.173   108.84      1.099     27.825           15.000   0.294     5.871
IT RORB              40.972    35.924        1.92     217.142    -41.450   157.60      1.122     33.066           15.000   0.344     8.137
L5 IT FEZF2          46.805    35.954        2.98     160.377    -39.093   203.72      1.126     27.099           11.667   0.306     8.300
VEN                  44.427    38.785        3.03     176.584    -40.891   140.16      1.157     27.056           10.000   0.332     9.563
L5 ET                42.314    31.122        2.22     115.619    -46.701   151.47      1.363     19.633           15.833   0.306     7.371
L6 PC                49.040    49.130        2.34     353.623    -44.573   157.94      1.167     56.026           15.833   0.304     4.829

Feature values missing (no AP, too few APs, failed fit), cells:
rheobase            0
threshold           0
amplitude           0
rise                0
decay              20
half_width          2
latency             0
AHP                 0
max_firing_rate     0
sag_value           0
sag_ratio           0
sag_time            0
sag_area            0
RMP                 0
Rm_methods          0
tau_methods         0
rebound             0
ISI_adaptation     21
amp_adaptation      7
latency_slope       0
ISI_CV             21
ISI_Fano           21
tau_code            2
In [16]:
print("Device by recording status, all files (typed: a transcriptomic type in the cell table):")
lab["typed"] = np.where(lab.predictCluster_label.notna(), "typed", "untyped")
lab["year"] = "20" + lab.subject_id.str[3:5]
print(pd.crosstab([lab.device, lab.typed], lab.year).to_string())
print("\nDevice by group (grouped cells):")
print(pd.crosstab(grp.device, grp.group)[aic.GROUPS].to_string())
print("\nUntyped files by expert type and device:")
print(pd.crosstab(lab[lab.typed == "untyped"].cellType.fillna("none"), lab[lab.typed == "untyped"].device).to_string())
print("\nMedians by group and device (median, then cells), for the measures that may depend on the sampling rate:")
for f in ["half_width", "phase_idx_first", "phase_idx_median", "tau_methods"]:
    t = grp.groupby(["group", "device"])[f].agg(["median", "size"]).unstack("device")
    print(f"{f}:"); print(t.reindex(aic.GROUPS).round(3).to_string())
print("\nThe code's own values (Ins_patchseq_ephs.xlsx), medians by device over the grouped cells it holds:")
xd = grp[["cell_ID", "device", "group"]].merge(xfeat.assign(cell_ID=xfeat.Cell_ID.astype(str)), on="cell_ID")
print(xd.groupby("device")[["Half_Width_ms", "Tau_ms", "AP_Amplitute", "Rm_MO"]].median().round(2).to_string())
print("\nRank-sum of a target group against the others pooled, within the files of one device:")
for target, f in [("L2/3 IT HPCAL1", "half_width"), ("L2/3 IT HPCAL1", "tau_methods"), ("VEN", "phase_idx_first")]:
    for dv in sorted(grp.device.unique()):
        d = grp[grp.device == dv]
        a, b = d[d.group == target][f].dropna(), d[d.group != target][f].dropna()
        p = stats.mannwhitneyu(a, b).pvalue if len(a) > 1 and len(b) > 1 else np.nan
        print(f"  {target} {f}, {dv}: n {len(a)} against {len(b)}, medians {a.median():.3f} against {b.median():.3f}, p {p:.3g}")

# Is the device difference one of sampling rate? 40 grouped Axon files at 50 kHz, brought to 25 kHz (the HEKA rate) by
# averaging sample pairs, and measured again.
ax = grp[(grp.device.str.startswith("AXON")) & (grp.fs.round() == 50000)].sample(40, random_state=0)
aid = {a["path"].split("/")[-1]: a["asset_id"] for a in assets}
rows = []
for fn in ax.filename:
    rec = aic.read_nwb(aid[fn])
    n2 = rec["V"].shape[1] // 2 * 2
    rec["V"] = rec["V"][:, :n2].reshape(len(rec["V"]), -1, 2).mean(axis=2)
    rec["I"] = rec["I"][:, :n2:2]
    rec["fs"] = rec["fs"] / 2
    f25 = aic.cell_features(rec)
    rows.append({"filename": fn, **{k + "_25k": f25[k] for k in ["half_width", "tau_methods", "phase_idx_first", "amplitude"]}})
dec = ax.merge(pd.DataFrame(rows), on="filename")
for k in ["half_width", "tau_methods", "phase_idx_first", "amplitude"]:
    print(f"{k}: median at 50 kHz {dec[k].median():.3f}, decimated to 25 kHz {dec[k + '_25k'].median():.3f}; "
          f"median ratio {(dec[k + '_25k'] / dec[k]).median():.3f} (40 Axon files)")
Device by recording status, all files (typed: a transcriptomic type in the cell table):
year                           2018  2019  2022
device                typed                    
AXON recording system typed     116    15     8
                      untyped   109     3     1
Heka LIH:8+8          typed       3    18   118
                      untyped     0     8    62

Device by group (grouped cells):
group                  L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2  VEN  L5 ET  L6 PC
device                                                                        
AXON recording system               6        4           93   17      6      5
Heka LIH:8+8                       24       17           32   12     12      9

Untyped files by expert type and device:
device    AXON recording system  Heka LIH:8+8
cellType                                     
INTER                         1            10
Inter                         0             1
PC                           20            28
VEN                          24            15
none                         68            16

Medians by group and device (median, then cells), for the measures that may depend on the sampling rate:
half_width:
                              median                               size             
device         AXON recording system Heka LIH:8+8 AXON recording system Heka LIH:8+8
group                                                                               
L2/3 IT HPCAL1                  2.90         1.98                     6           24
IT RORB                         3.68         1.88                     4           17
L5 IT FEZF2                     3.36         2.12                    93           32
VEN                             3.20         2.58                    17           12
L5 ET                           2.98         1.92                     6           12
L6 PC                           2.78         2.28                     5            9
phase_idx_first:
                              median                               size             
device         AXON recording system Heka LIH:8+8 AXON recording system Heka LIH:8+8
group                                                                               
L2/3 IT HPCAL1                 0.107        0.083                     6           24
IT RORB                        0.099        0.169                     4           17
L5 IT FEZF2                    0.095        0.124                    93           32
VEN                            0.037        0.037                    17           12
L5 ET                          0.300        0.227                     6           12
L6 PC                          0.117        0.250                     5            9
phase_idx_median:
                              median                               size             
device         AXON recording system Heka LIH:8+8 AXON recording system Heka LIH:8+8
group                                                                               
L2/3 IT HPCAL1                 0.239        0.323                     6           24
IT RORB                        0.150        0.245                     4           17
L5 IT FEZF2                    0.099        0.201                    93           32
VEN                            0.115        0.055                    17           12
L5 ET                          0.181        0.538                     6           12
L6 PC                          0.200        0.117                     5            9
tau_methods:
                              median                               size             
device         AXON recording system Heka LIH:8+8 AXON recording system Heka LIH:8+8
group                                                                               
L2/3 IT HPCAL1                54.232       30.297                     6           24
IT RORB                       73.372       39.953                     4           17
L5 IT FEZF2                   49.540       29.241                    93           32
VEN                           55.140       35.717                    17           12
L5 ET                         54.433       33.217                     6           12
L6 PC                         58.623       40.721                     5            9

The code's own values (Ins_patchseq_ephs.xlsx), medians by device over the grouped cells it holds:
                       Half_Width_ms  Tau_ms  AP_Amplitute  Rm_MO
device                                                           
AXON recording system           3.13   41.41         85.75  154.6
Heka LIH:8+8                    2.08   25.93         94.61  172.8

Rank-sum of a target group against the others pooled, within the files of one device:
  L2/3 IT HPCAL1 half_width, AXON recording system: n 6 against 124, medians 2.900 against 3.290, p 0.369
  L2/3 IT HPCAL1 half_width, Heka LIH:8+8: n 24 against 81, medians 1.980 against 2.040, p 0.192
  L2/3 IT HPCAL1 tau_methods, AXON recording system: n 6 against 125, medians 54.232 against 50.128, p 0.474
  L2/3 IT HPCAL1 tau_methods, Heka LIH:8+8: n 24 against 82, medians 30.297 against 34.775, p 0.128
  VEN phase_idx_first, AXON recording system: n 17 against 114, medians 0.037 against 0.111, p 0.0819
  VEN phase_idx_first, Heka LIH:8+8: n 12 against 94, medians 0.037 against 0.158, p 0.101
half_width: median at 50 kHz 3.360, decimated to 25 kHz 3.360; median ratio 1.000 (40 Axon files)
tau_methods: median at 50 kHz 50.282, decimated to 25 kHz 50.294; median ratio 1.000 (40 Axon files)
phase_idx_first: median at 50 kHz 0.088, decimated to 25 kHz 0.168; median ratio 0.952 (40 Axon files)
amplitude: median at 50 kHz 86.364, decimated to 25 kHz 86.448; median ratio 1.000 (40 Axon files)

The Methods put the recordings without RNA on a MultiClamp 700B with pClamp and the Patch-seq recordings on a HEKA amplifier with PatchMaster ("Patch-seq recording"). In the files the device follows the recording year (mostly Axon for the 2018 subjects and HEKA for the 2022 ones), and both devices hold typed and untyped cells, so the device does not mark the recordings without RNA. The groups are unevenly spread over the devices (L5 IT FEZF2 93 of 125 Axon files, L2/3 IT HPCAL1 6 of 30). Half-width and tau are longer in the Axon files in every group, in the computed values and in the code's own table (half-width 3.13 against 2.08 ms, tau 41 against 26 ms). Bringing Axon files to the HEKA rate leaves half-width and tau unchanged and changes the phase peak index, so the half-width and tau difference is one of recording conditions, not of sampling rate, while the phase peak index also depends on the rate.

fig2d-l23it-small-tau¶

Among the six projection neuron groups, L2/3 IT HPCAL1 neurons stand out with a small membrane time constant.

In [17]:
med = medians(grp, ["tau_methods", "tau_code"])
print("Median tau by group (ms):"); print(med.round(2).to_string())
print("Lowest median, Methods tau:", med.tau_methods.idxmin(), "; first-sweep tau (code):", med.tau_code.idxmin())
r = readings(grp, "L2/3 IT HPCAL1", ["tau_methods", "tau_code"])
show(r)
g2 = grp[~(grp.tau_code <= 1)]
print("\nVariant, the code's plot exclusion (tau of 1 ms or less), cells dropped:", int((grp.tau_code <= 1).sum()))
print("Per subject, median tau of L2/3 IT HPCAL1 and of the others pooled (Methods tau):")
print(grp.assign(t=np.where(grp.group == "L2/3 IT HPCAL1", "L2/3 IT", "others")).pivot_table(
    index="subject_id", columns="t", values="tau_methods", aggfunc=["median", "count"]).round(2).to_string())
print("\nFits per cell for the Methods' tau (hyperpolarizing sweeps fitted, of those there):")
print(grp.groupby("group").agg(fits_median=("tau_n_fits", "median"), fits_min=("tau_n_fits", "min"),
                               sweeps_median=("tau_n_sweeps", "median")).reindex(aic.GROUPS).to_string())
spread = grp.tau_sweep_max / grp.tau_sweep_min
print("Spread of tau across a cell's sweeps (max over min): median", round(spread.median(), 2), "; above 2 in",
      int((spread > 2).sum()), "of", len(grp), "cells")
print("Cells with a Methods tau above 150 ms:", grp[grp.tau_methods > 150][["cell_ID", "group", "tau_methods", "tau_sweep_median",
      "tau_sweep_min", "tau_sweep_max", "tau_n_fits", "tau_code"]].round(1).to_string(index=False))
print("\nVariant, the median over sweeps in place of the mean (robust to single poor fits):")
print(medians(grp, ["tau_sweep_median"]).round(2).T.to_string())
show(readings(grp, "L2/3 IT HPCAL1", ["tau_sweep_median"]).iloc[:1])
Median tau by group (ms):
                tau_methods  tau_code
group                                
L2/3 IT HPCAL1        32.70     24.24
IT RORB               40.97     35.92
L5 IT FEZF2           46.80     35.95
VEN                   44.43     38.78
L5 ET                 42.31     31.12
L6 PC                 49.04     49.13
Lowest median, Methods tau: L2/3 IT HPCAL1 ; first-sweep tau (code): L2/3 IT HPCAL1
    feature           against  n_a  n_b  median_a  median_b         p      q39    q_F20  q39_upper F39
tau_methods other five pooled   30  207      32.7     46.31   0.01055  0.03428  0.02344    0.05142 sig
   tau_code other five pooled   29  206     24.24     36.12 0.0003271 0.003189 0.001636   0.003189 sig
tau_methods           IT RORB   30   21      32.7     40.97   0.01905   0.2477    0.127     0.2477  ns
   tau_code           IT RORB   29   21     24.24     35.92  0.007084   0.1169  0.05993     0.1169  ns
tau_methods       L5 IT FEZF2   30  125      32.7      46.8   0.01315  0.03419   0.0263    0.04662 sig
   tau_code       L5 IT FEZF2   29  125     24.24     35.95  0.000493 0.002404  0.00194   0.003783 sig
tau_methods               VEN   30   29      32.7     44.43   0.05706   0.1391   0.1038     0.2023  ns
   tau_code               VEN   29   29     24.24     38.78   0.01029  0.03344   0.0294    0.05016 sig
tau_methods             L5 ET   30   18      32.7     42.31    0.4625   0.9019   0.7116          1  ns
   tau_code             L5 ET   29   17     24.24     31.12    0.1112   0.3941   0.2223     0.6193  ns
tau_methods             L6 PC   30   14      32.7     49.04   0.09885   0.2701   0.1648     0.3855  ns
   tau_code             L6 PC   29   14     24.24     49.13  0.007307    0.057  0.03654    0.07124  ns

Variant, the code's plot exclusion (tau of 1 ms or less), cells dropped: 0
Per subject, median tau of L2/3 IT HPCAL1 and of the others pooled (Methods tau):
            median          count       
t          L2/3 IT others L2/3 IT others
subject_id                              
Mfa180730      NaN  46.15     NaN   16.0
Mfa180901   217.37  59.72     1.0   13.0
Mfa180913      NaN  75.04     NaN   17.0
Mfa180920    50.77  58.40     5.0   24.0
Mfa181204      NaN  53.29     NaN   19.0
Mfa181208      NaN  30.13     NaN   20.0
Mfa191122    17.42  39.91     3.0   24.0
Mfa220407    51.36  42.89     3.0   29.0
Mfa220419    36.03  36.90     9.0   18.0
Mfa220428    27.12  35.47     9.0   27.0

Fits per cell for the Methods' tau (hyperpolarizing sweeps fitted, of those there):
                fits_median  fits_min  sweeps_median
group                                               
L2/3 IT HPCAL1         10.0         4           10.0
IT RORB                10.0         4           10.0
L5 IT FEZF2            10.0         4           10.0
VEN                    10.0         4           10.0
L5 ET                  10.0         5           10.0
L6 PC                  10.0         4           10.0
Spread of tau across a cell's sweeps (max over min): median 1.81 ; above 2 in 87 of 237 cells
Cells with a Methods tau above 150 ms: cell_ID          group  tau_methods  tau_sweep_median  tau_sweep_min  tau_sweep_max  tau_n_fits  tau_code
   s422 L2/3 IT HPCAL1        217.4             269.4            7.0          442.8           9      52.0
   s466            VEN        153.7             106.0           62.4          301.0           8      62.4
   s509    L5 IT FEZF2        159.5             107.5           67.4          371.7          10      67.4

Variant, the median over sweeps in place of the mean (robust to single poor fits):
group             L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2   VEN  L5 ET  L6 PC
tau_sweep_median           30.23    41.69        42.73  37.6  39.02  47.51
         feature           against  n_a  n_b  median_a  median_b        p     q39   q_F20  q39_upper F39
tau_sweep_median other five pooled   30  207     30.23     42.28 0.004439 0.01731 0.01268    0.02473 sig

Result: fig2d reproduced. L2/3 IT HPCAL1 has the lowest median tau of the six groups with the Methods' tau (32.7 ms; next IT RORB, 41.0) and with the code's first-sweep tau (24.2 ms). Against the other five pooled (reading a) p = 0.011, FDR 0.034 over the 39-feature family (the 19 features defined nowhere taken from the code's table) and 0.023 over the 20 Methods features. With the code's tau p = 0.0003, FDR 0.003; with the median over sweeps in place of the mean, p = 0.004, FDR 0.017. Reading (b) fails: the Methods' tau does not differ significantly from IT RORB, VEN, L5 ET or L6 PC. L2/3 IT HPCAL1 has the lower median in 4 of the 6 subjects with such cells. Within one device the difference is not significant (Axon files, 6 cells, p = 0.47; HEKA files, 24 cells, p = 0.13): 24 of the 30 L2/3 IT HPCAL1 cells are HEKA files, whose tau is shorter in every group (data check above).

fig2f-l23it-narrow-ap¶

L2/3 IT HPCAL1 neurons have a narrow AP width compared with the other projection neuron groups.

In [18]:
med = medians(grp, ["half_width", "half_width_code"])
print("Median half-width by group (ms):"); print(med.round(3).to_string())
print("Rank of L2/3 IT HPCAL1 (1 = lowest):", int(med.half_width.rank()["L2/3 IT HPCAL1"]))
r = readings(grp, "L2/3 IT HPCAL1", ["half_width"])
show(r)
g2 = grp[(grp.half_width >= 1) & (grp.half_width <= 5)]
print("\nVariant, the code's plot exclusion (widths outside 1 to 5 ms), cells kept:", len(g2), "of", len(grp))
show(readings(g2, "L2/3 IT HPCAL1", ["half_width"]).iloc[:1])
Median half-width by group (ms):
                half_width  half_width_code
group                                      
L2/3 IT HPCAL1        2.08             2.08
IT RORB               1.92             1.92
L5 IT FEZF2           2.98             2.98
VEN                   3.03             3.03
L5 ET                 2.22             2.22
L6 PC                 2.34             2.34
Rank of L2/3 IT HPCAL1 (1 = lowest): 2
   feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
half_width other five pooled   30  205      2.08      2.82 2.955e-05 0.0005762 0.0002955  0.0005762 sig
half_width           IT RORB   30   21      2.08      1.92    0.6051    0.7866    0.7563          1  ns
half_width       L5 IT FEZF2   30  124      2.08      2.98 2.889e-07 1.127e-05 5.778e-06  1.127e-05 sig
half_width               VEN   30   28      2.08      3.03 1.624e-05 0.0003166 0.0001624  0.0003166 sig
half_width             L5 ET   30   18      2.08      2.22    0.4494    0.9019    0.7116          1  ns
half_width             L6 PC   30   14      2.08      2.34    0.2954    0.5236    0.3939     0.9588  ns

Variant, the code's plot exclusion (widths outside 1 to 5 ms), cells kept: 210 of 237
   feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
half_width other five pooled   29  181      2.08      2.66 6.382e-05 0.0008296 0.0004255  0.0008296 sig

Result: fig2f partially reproduced. L2/3 IT HPCAL1 APs are narrower than those of the other five pooled (median half-width 2.08 against 2.82 ms, p = 3.0e-5; FDR 0.0006 over 39 features, 0.0003 over 20), and narrower than L5 IT FEZF2 and VEN, but not than IT RORB (1.92 ms, p = 0.61), L5 ET (2.22 ms, p = 0.45) or L6 PC (2.34 ms, p = 0.30). Its median is the second lowest, so the criterion's "lowest" fails while reading (a) is significant. With the code's plot exclusion (1 to 5 ms) the pooled comparison holds (p = 6.4e-5). Within one device the difference is not significant (Axon p = 0.37, HEKA p = 0.19); half-widths of HEKA files are shorter in every group.

supp11-rm-itrorb-l6pc¶

IT RORB and L6 PC neurons have a distinctive input resistance among projection neuron groups.

In [19]:
print("Median input resistance by group (MOhm):"); print(medians(grp, ["Rm_methods", "Rm_code"]).round(1).to_string())
for target in ["IT RORB", "L6 PC"]:
    print(f"\n{target}:")
    show(readings(grp, target, ["Rm_methods", "Rm_code"]))
Median input resistance by group (MOhm):
                Rm_methods  Rm_code
group                              
L2/3 IT HPCAL1       182.8    158.2
IT RORB              217.1    209.2
L5 IT FEZF2          160.4    173.6
VEN                  176.6    166.5
L5 ET                115.6    117.1
L6 PC                353.6    402.2

IT RORB:
   feature           against  n_a  n_b  median_a  median_b         p      q39    q_F20  q39_upper F39
Rm_methods other five pooled   21  216     217.1       166   0.02268  0.08663   0.0648     0.1474  ns
   Rm_code other five pooled   21  216     209.2     171.2  0.005511  0.03746  0.02516    0.04907 sig
Rm_methods    L2/3 IT HPCAL1   21   30     217.1     182.8    0.2969   0.6095   0.5398          1  ns
   Rm_code    L2/3 IT HPCAL1   21   30     209.2     158.2  0.006025   0.1169  0.05993     0.1169  ns
Rm_methods       L5 IT FEZF2   21  125     217.1     160.4  0.005579  0.02176   0.0186    0.03626 sig
   Rm_code       L5 IT FEZF2   21  125     209.2     173.6  0.005299  0.02067  0.01766    0.03444 sig
Rm_methods               VEN   21   29     217.1     176.6    0.1513   0.3471   0.3026     0.5901  ns
   Rm_code               VEN   21   29     209.2     166.5   0.05407   0.1506   0.1531     0.2985  ns
Rm_methods             L5 ET   21   18     217.1     115.6   0.00324  0.07178  0.02761    0.07178  ns
   Rm_code             L5 ET   21   18     209.2     117.1 0.0002365 0.009225 0.004731   0.009225 sig
Rm_methods             L6 PC   21   14     217.1     353.6    0.1174   0.3496   0.4184     0.6993  ns
   Rm_code             L6 PC   21   14     209.2     402.2    0.1727   0.3961   0.4317     0.8417  ns

L6 PC:
   feature           against  n_a  n_b  median_a  median_b         p      q39     q_F20  q39_upper F39
Rm_methods other five pooled   14  223     353.6     165.9 0.0001426 0.005559  0.002851   0.005559 sig
   Rm_code other five pooled   14  223     402.2     170.3 0.0001622 0.006327  0.003245   0.006327 sig
Rm_methods    L2/3 IT HPCAL1   14   30     353.6     182.8  0.005364   0.0523   0.03576    0.06973  ns
   Rm_code    L2/3 IT HPCAL1   14   30     402.2     158.2 0.0007013  0.01939   0.01403    0.02735 sig
Rm_methods           IT RORB   14   21     353.6     217.1    0.1174   0.3496    0.4184     0.6993  ns
   Rm_code           IT RORB   14   21     402.2     209.2    0.1727   0.3961    0.4317     0.8417  ns
Rm_methods       L5 IT FEZF2   14  125     353.6     160.4 4.569e-05 0.001782 0.0009138   0.001782 sig
   Rm_code       L5 IT FEZF2   14  125     402.2     173.6 9.552e-05 0.001782  0.001135   0.002214 sig
Rm_methods               VEN   14   29     353.6     176.6  0.004539  0.02915   0.02392    0.04664 sig
   Rm_code               VEN   14   29     402.2     166.5  0.005775  0.02915   0.02392    0.04664 sig
Rm_methods             L5 ET   14   18     353.6     115.6 0.0002859  0.01115  0.005718    0.01115 sig
   Rm_code             L5 ET   14   18     402.2     117.1 0.0002125 0.008286  0.004249   0.008286 sig

Result: rm partially reproduced. L6 PC neurons have a distinctive, higher input resistance: median 354 against 166 MOhm for the other five pooled, p = 0.00014, FDR 0.006 over 39 features and 0.003 over 20, and the same with the code's measure. IT RORB neurons have 217 against 166 MOhm, p = 0.023, FDR 0.087 over 39 features and 0.065 over 20, not significant; with the code's measure (a variant) p = 0.0055, FDR 0.037. Against each group (reading b) neither holds for all. One of the two groups holds; both have the higher resistance.

supp11-l5it-threshold-latency¶

L5 IT FEZF2 neurons have a higher AP threshold and a longer spike latency than the other projection neuron groups.

In [20]:
print(medians(grp, ["threshold", "threshold_code", "latency"]).round(2).to_string())
show(readings(grp, "L5 IT FEZF2", ["threshold", "latency"]))
                threshold  threshold_code  latency
group                                             
L2/3 IT HPCAL1     -38.17          -38.17   108.84
IT RORB            -41.45          -41.45   157.60
L5 IT FEZF2        -39.09          -39.09   203.72
VEN                -40.89          -40.89   140.16
L5 ET              -46.70          -46.70   151.47
L6 PC              -44.57          -44.57   157.94
  feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
threshold other five pooled  125  112    -39.09    -42.34   0.00117   0.00507  0.003343   0.006519 sig
  latency other five pooled  125  112     203.7     148.7 0.0001584 0.0007724 0.0005281    0.00103 sig
threshold    L2/3 IT HPCAL1  125   30    -39.09    -38.17    0.8156    0.9088    0.9595          1  ns
  latency    L2/3 IT HPCAL1  125   30     203.7     108.8  0.000582  0.002837  0.002328    0.00454 sig
threshold           IT RORB  125   21    -39.09    -41.45   0.04237    0.1033   0.07704     0.1502  ns
  latency           IT RORB  125   21     203.7     157.6   0.08486    0.1742    0.1306     0.2758  ns
threshold               VEN  125   29    -39.09    -40.89    0.2386    0.6989    0.4898          1  ns
  latency               VEN  125   29     203.7     140.2    0.0632    0.6162    0.4898          1  ns
threshold             L5 ET  125   18    -39.09     -46.7 1.711e-05 0.0003336 0.0001711  0.0003336 sig
  latency             L5 ET  125   18     203.7     151.5   0.06743    0.1461   0.09633     0.2023  ns
threshold             L6 PC  125   14    -39.09    -44.57  0.002305  0.009987  0.009219    0.01798 sig
  latency             L6 PC  125   14     203.7     157.9     0.128    0.2268    0.2133     0.3839  ns

Result: l5it reproduced. Against the other five pooled, L5 IT FEZF2 neurons have a higher AP threshold (median -39.1 against -42.3 mV, p = 0.0012, FDR 0.005 over 39 features) and a longer spike latency (203.7 against 148.7 ms, p = 0.00016, FDR 0.0008), also below 0.05 over the 20 features. Against each group (reading b) the threshold is not higher than that of L2/3 IT HPCAL1 (-38.2 mV) or VEN, and the latency is not significantly longer than that of IT RORB, VEN, L5 ET or L6 PC.

supp11-ven-broad-ap¶

VENs have a broader AP than the other Patch-seq projection neuron groups.

In [21]:
med = medians(grp, ["half_width"])
print(med.round(3).to_string()); print("Highest median:", med.half_width.idxmax())
show(readings(grp, "VEN", ["half_width"]))
                half_width
group                     
L2/3 IT HPCAL1        2.08
IT RORB               1.92
L5 IT FEZF2           2.98
VEN                   3.03
L5 ET                 2.22
L6 PC                 2.34
Highest median: VEN
   feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
half_width other five pooled   28  207      3.03      2.64   0.03481    0.2508    0.2321     0.4525  ns
half_width    L2/3 IT HPCAL1   28   30      3.03      2.08 1.624e-05 0.0003166 0.0001624  0.0003166 sig
half_width           IT RORB   28   21      3.03      1.92 0.0001285   0.00467  0.002395    0.00467 sig
half_width       L5 IT FEZF2   28  124      3.03      2.98    0.9186    0.9627    0.9558          1  ns
half_width             L5 ET   28   18      3.03      2.22   0.00714   0.02532    0.0238    0.03978 sig
half_width             L6 PC   28   14      3.03      2.34   0.00598   0.02915   0.02392    0.04664 sig

Result: venap partially reproduced. The VEN median half-width (3.03 ms) is the highest of the six, narrowly above L5 IT FEZF2 (2.98 ms). Against the other five pooled p = 0.035, FDR 0.25 over 39 features (0.23 over 20), not significant. Against each group (reading b) VENs are broader than L2/3 IT HPCAL1, IT RORB, L5 ET and L6 PC (FDR 0.0003 to 0.029) but not than L5 IT FEZF2 (p = 0.92). The median is highest without a significant reading.

supp11-l5et-deep-sag¶

L5 ET neurons have a deeper sag than the other projection neuron groups.

Deeper is read as a larger sag ratio and a larger sag value. Both are measured at each file's largest hyperpolarizing step, -200 pA in most files; the variant keeps only those files.

In [22]:
med = medians(grp, ["sag_ratio", "sag_value"])
print(med.round(3).to_string()); print("Largest median: sag ratio", med.sag_ratio.idxmax(), "; sag value", med.sag_value.idxmax())
show(readings(grp, "L5 ET", ["sag_ratio", "sag_value"]))
print("\nCells whose largest hyperpolarizing step is not -200 pA, by group:", grp[grp.i_min > -200].group.value_counts().to_dict())
print("\nVariant, cells whose largest hyperpolarizing step is -200 pA only (sag measured at the same current):")
g2 = grp[grp.sag_step_pA == -200]
print(medians(g2, ["sag_ratio", "sag_value"]).round(3).T.to_string())
show(readings(g2, "L5 ET", ["sag_ratio", "sag_value"]).iloc[:2])
show(compare(g2, ["L5 ET"], ["L5 IT FEZF2"], ["sag_ratio", "sag_value"]).assign(against="L5 IT FEZF2").reset_index(names="feature"))
                sag_ratio  sag_value
group                               
L2/3 IT HPCAL1      1.099     27.825
IT RORB             1.122     33.066
L5 IT FEZF2         1.126     27.099
VEN                 1.157     27.056
L5 ET               1.363     19.633
L6 PC               1.167     56.026
Largest median: sag ratio L5 ET ; sag value L6 PC
  feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
sag_ratio other five pooled   18  219     1.363     1.126 2.975e-06  0.000116  5.95e-05   0.000116 sig
sag_value other five pooled   18  219     19.63     27.71  0.005485       NaN   0.02085        NaN   -
sag_ratio    L2/3 IT HPCAL1   18   30     1.363     1.099 9.921e-06 0.0003869 0.0001984  0.0003869 sig
sag_value    L2/3 IT HPCAL1   18   30     19.63     27.82   0.04885       NaN    0.1221        NaN   -
sag_ratio           IT RORB   18   21     1.363     1.122  0.005521   0.07178   0.02761    0.07178  ns
sag_value           IT RORB   18   21     19.63     33.07  0.004244       NaN   0.02761        NaN   -
sag_ratio       L5 IT FEZF2   18  125     1.363     1.126 1.647e-06 6.422e-05 3.293e-05  6.422e-05 sig
sag_value       L5 IT FEZF2   18  125     19.63      27.1   0.01455       NaN   0.02645        NaN   -
sag_ratio               VEN   18   29     1.363     1.157  0.001155   0.01501   0.01155    0.02252 sig
sag_value               VEN   18   29     19.63     27.06    0.0222       NaN   0.06343        NaN   -
sag_ratio             L6 PC   18   14     1.363     1.167   0.01759    0.1372    0.1173     0.3082  ns
sag_value             L6 PC   18   14     19.63     56.03  0.004654       NaN   0.04654        NaN   -

Cells whose largest hyperpolarizing step is not -200 pA, by group: {'IT RORB': 8, 'L5 IT FEZF2': 7, 'L2/3 IT HPCAL1': 6, 'L5 ET': 4, 'L6 PC': 4, 'VEN': 3}

Variant, cells whose largest hyperpolarizing step is -200 pA only (sag measured at the same current):
group      L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
sag_ratio           1.099    1.133        1.123   1.155   1.363   1.175
sag_value          30.450   33.066       27.409  27.384  20.629  68.923
  feature           against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
sag_ratio other five pooled   14  191     1.363     1.126 4.808e-07 1.875e-05 9.617e-06  1.875e-05 sig
sag_value other five pooled   14  191     20.63     29.22   0.01089       NaN   0.03631        NaN   -
  feature     against  n_a  n_b  median_a  median_b         p     q39     q_F20  q39_upper F39
sag_ratio L5 IT FEZF2   14  118     1.363     1.123 2.256e-07 8.8e-06 4.513e-06    8.8e-06 sig
sag_value L5 IT FEZF2   14  118     20.63     27.41   0.03122     NaN   0.06938        NaN   -

Result: sag blocked (methods underspecified). The two readings of the measure disagree. By sag ratio L5 ET neurons have the deepest sag (median 1.36 against 1.13 for the other five pooled, p = 3e-6, FDR 0.0001 over 39 features). By sag value, which the Methods define as RMP minus the steady state at the largest hyperpolarizing step, L5 ET has the smallest of the six groups (19.6 against 27.7 mV, p = 0.0055). On the cells whose largest step is -200 pA only, the same holds (sag ratio 1.36, p = 5e-7; sag value 20.6 against 29.2 mV, p = 0.011), so the mixed step sizes do not cause the disagreement. The paper does not say which measure its "deeper sag" uses.

ven-firing-rate-variability¶

VENs have lower firing rates and greater variability in spike timing than PCs.

In [23]:
feats = ["max_firing_rate", "ISI_CV", "ISI_Fano"]
print(medians(grp, feats).round(3).to_string())
print("\n(a) VEN against the five PC groups pooled, and (b) against each:")
show(readings(grp, "VEN", feats))
print("\n(c) VEN against the layer 5 PC groups pooled (L5 IT FEZF2 and L5 ET):")
t = compare(grp, ["VEN"], ["L5 IT FEZF2", "L5 ET"], feats).reset_index().rename(columns={"index": "feature"})
t.insert(1, "against", "L5 IT + L5 ET")
show(t)
                max_firing_rate  ISI_CV  ISI_Fano
group                                            
L2/3 IT HPCAL1           15.000   0.294     5.871
IT RORB                  15.000   0.344     8.137
L5 IT FEZF2              11.667   0.306     8.300
VEN                      10.000   0.332     9.563
L5 ET                    15.833   0.306     7.371
L6 PC                    15.833   0.304     4.829

(a) VEN against the five PC groups pooled, and (b) against each:
        feature           against  n_a  n_b  median_a  median_b        p     q39   q_F20  q39_upper F39
max_firing_rate other five pooled   29  208        10     13.33  0.09237  0.3002  0.3656     0.6004  ns
         ISI_CV other five pooled   25  191    0.3322    0.3109    0.556  0.7335  0.7062          1  ns
       ISI_Fano other five pooled   25  191     9.563     7.514   0.1745  0.4537  0.4799     0.8508  ns
max_firing_rate    L2/3 IT HPCAL1   29   30        10        15  0.01011 0.03584  0.0337    0.05632 sig
         ISI_CV    L2/3 IT HPCAL1   25   30    0.3322    0.2942   0.1391  0.2432  0.1972     0.3729  ns
       ISI_Fano    L2/3 IT HPCAL1   25   30     9.563     5.871  0.01459  0.0474 0.04584    0.07111 sig
max_firing_rate           IT RORB   29   21        10        15  0.01969 0.07678 0.07931     0.1469  ns
         ISI_CV           IT RORB   25   21    0.3322    0.3438    0.402  0.6533  0.5528          1  ns
       ISI_Fano           IT RORB   25   21     9.563     8.137   0.8083  0.9065  0.8523          1  ns
max_firing_rate       L5 IT FEZF2   29  125        10     11.67   0.7086  0.8915  0.8337          1  ns
         ISI_CV       L5 IT FEZF2   25  109    0.3322    0.3055   0.6935  0.8915  0.8205          1  ns
       ISI_Fano       L5 IT FEZF2   25  109     9.563       8.3   0.5003  0.8131  0.7338          1  ns
max_firing_rate             L5 ET   29   18        10     15.83 0.003984 0.01674 0.01594     0.0259 sig
         ISI_CV             L5 ET   25   18    0.3322    0.3064   0.7396  0.8242  0.7748          1  ns
       ISI_Fano             L5 ET   25   18     9.563     7.371   0.2733  0.5069   0.501     0.8882  ns
max_firing_rate             L6 PC   29   14        10     15.83  0.03688  0.1027 0.08195     0.1438  ns
         ISI_CV             L6 PC   25   13    0.3322    0.3038   0.2184  0.3703  0.3432     0.6084  ns
       ISI_Fano             L6 PC   25   13     9.563     4.829  0.01507 0.05876 0.05524    0.09793  ns

(c) VEN against the layer 5 PC groups pooled (L5 IT FEZF2 and L5 ET):
        feature       against  n_a  n_b  median_a  median_b      p    q39  q_F20  q39_upper F39
max_firing_rate L5 IT + L5 ET   29  143        10     11.67 0.3849 0.6947 0.5922          1  ns
         ISI_CV L5 IT + L5 ET   25  127    0.3322    0.3055   0.68 0.8772 0.8311          1  ns
       ISI_Fano L5 IT + L5 ET   25  127     9.563     8.217 0.4179 0.6947 0.6566          1  ns

Result: venfr not reproduced. VENs have the lowest median maximal firing rate (10.0 Hz against 13.3 Hz for the five PC groups pooled), but not significantly (p = 0.092, FDR 0.30 over 39 features), nor against the layer 5 PCs pooled (p = 0.38); against each group it is significant only for L2/3 IT HPCAL1 and L5 ET. VENs have a higher ISI CV (0.33 against 0.31, p = 0.56) and Fano factor (9.6 against 7.5, p = 0.17) without significance under readings (a) and (c), and under (b) only the Fano factor against L2/3 IT HPCAL1 (FDR 0.047). The two variability measures agree.

l5et-vs-l5it-sag-rm-rate¶

L5 ET neurons have a deeper sag, a lower input resistance and a higher firing rate than L5 IT neurons.

In [24]:
t = compare(grp, ["L5 ET"], ["L5 IT FEZF2"], ["sag_ratio", "sag_value", "Rm_methods", "Rm_code", "max_firing_rate"])
t.insert(0, "against", "L5 IT FEZF2")
show(t.reset_index().rename(columns={"index": "feature"}))
        feature     against  n_a  n_b  median_a  median_b         p       q39     q_F20  q39_upper F39
      sag_ratio L5 IT FEZF2   18  125     1.363     1.126 1.647e-06 6.422e-05 3.293e-05  6.422e-05 sig
      sag_value L5 IT FEZF2   18  125     19.63      27.1   0.01455       NaN   0.02645        NaN   -
     Rm_methods L5 IT FEZF2   18  125     115.6     160.4   0.01383   0.03852   0.02645    0.05393 sig
        Rm_code L5 IT FEZF2   18  125     117.1     173.6  0.005365   0.02045   0.01341    0.02726 sig
max_firing_rate L5 IT FEZF2   18  125     15.83     11.67  0.006292   0.02231   0.01573    0.03067 sig

Result: l5et partially reproduced. Against L5 IT FEZF2, L5 ET neurons have a larger sag ratio (1.36 against 1.13, p = 1.6e-6, FDR 6e-5 over 39 features), a lower input resistance (116 against 160 MOhm, p = 0.014, FDR 0.039; the code's measure 117 against 174 MOhm, FDR 0.020) and a higher maximal firing rate (15.8 against 11.7 Hz, p = 0.0063, FDR 0.022). By sag value L5 ET is lower (19.6 against 27.1 mV, p = 0.015), the reverse of deeper. The criterion takes the two sag readings of supp11-l5et-deep-sag: under the sag ratio all three hold, under the sag value two do. The criterion gives no rule for this case. The outcome is taken as the one that holds under both readings, two of three, an assumption recorded in the attempt; if the criterion's "sag readings as in supp11-l5et-deep-sag" also carries that claim's rule (blocked when the readings disagree), the claim would be blocked as methods underspecified.

fig3e-phase-peak-index and fig3d-saddle-phase-plane¶

VENs have lower phase peak indices than any PC group.

The AP phase-plane plots of VENs show a more prominent biphasic shape than those of PCs, with the AIS phase decaying before the SD phase in a saddle-like shape.

The index is read automatically (helper docstring) on the maximal-rate sweep, (a) on its first AP and (b) as the median over its APs. Kruskal-Wallis over the six groups, then Dunn's test with Bonferroni and with Sidak correction. The code's per-cell values (PeakIdx_Fig5e.xlsx, read by hand) are compared, without deciding. An AP whose rising phase has neither a second maximum nor a shoulder gets the lowest dV/dt of its rising phase as its AIS value (the Methods' "point with the lowest derivative value"), so it counts as the least saddle-like; the synthetic APs below show the three cases, and the variant _x leaves such APs out.

In [25]:
def dunn_table(df, col):
    d = df.dropna(subset=[col])
    kw = stats.kruskal(*[d[d.group == g][col] for g in aic.GROUPS])
    out = {"KW H": kw.statistic, "KW p": kw.pvalue}
    for corr in ["bonferroni", "sidak"]:
        pt = sp.posthoc_dunn(d, val_col=col, group_col="group", p_adjust=corr)
        for g in aic.GROUPS:
            if g != "VEN":
                out[f"{corr} VEN vs {g}"] = pt.loc["VEN", g]
    return d.groupby("group")[col].agg(["count", "median"]).reindex(aic.GROUPS), out

# Synthetic APs: dV/dt with two maxima (biphasic), with a shoulder, and with a single smooth maximum (monophasic).
fs_s = 50000.0
ts = np.arange(0, 0.004, 1 / fs_s)
bump = lambda t0, w, h: h * np.exp(-0.5 * ((ts - t0) / w) ** 2)
synth = {"biphasic": bump(0.0012, 0.00015, 150) + bump(0.0018, 0.0002, 250),
         "shoulder": bump(0.0013, 0.0002, 120) + bump(0.0017, 0.0002, 250),
         "monophasic": bump(0.0016, 0.0003, 300)}
for name, dv in synth.items():  # dv in mV/ms
    v = -50 + np.cumsum(dv) / fs_s * 1000
    peak = int(np.argmax(dv)) + int(0.0004 * fs_s)
    print(f"Synthetic {name} AP: index {aic.phase_index(v, fs_s, int(0.0005 * fs_s), peak)}")

print("\nFirst AP of the maximal-rate sweep by how its AIS value was read (cells):")
print(pd.crosstab(grp.group, grp.phase_first_kind).reindex(aic.GROUPS).to_string())
print("Fraction of the sweep's APs with the AIS phase not resolved (no second maximum, no shoulder), median per cell and mean:")
print(grp.groupby("group").phase_none_frac.agg(["median", "mean"]).reindex(aic.GROUPS).round(3).to_string())

for col in ["phase_idx_first", "phase_idx_median", "phase_idx_first_x", "phase_idx_median_x",
            "phase_idx_first_p2", "phase_idx_median_p2", "phase_idx_first_p10", "phase_idx_median_p10"]:
    medtab, out = dunn_table(grp, col)
    print(f"\n{col}: medians by group"); print(medtab.round(3).T.to_string())
    print({k: float(f"{v:.3g}") for k, v in out.items()})
print("\nFraction of APs whose rising phase has two maxima (median per cell, by group):")
print(grp.groupby("group").phase_two_peaks_frac.median().reindex(aic.GROUPS).round(3).to_string())
Synthetic biphasic AP: index (np.float64(0.24427204940741218), 'two')
Synthetic shoulder AP: index (np.float64(0.21162796268859602), 'shoulder')
Synthetic monophasic AP: index (np.float64(0.8102440958689836), 'none')

First AP of the maximal-rate sweep by how its AIS value was read (cells):
phase_first_kind  none  shoulder  two
group                                
L2/3 IT HPCAL1       5        21    4
IT RORB              0        18    3
L5 IT FEZF2          3       112   10
VEN                  3        20    6
L5 ET                3        11    4
L6 PC                0        13    1
Fraction of the sweep's APs with the AIS phase not resolved (no second maximum, no shoulder), median per cell and mean:
                median   mean
group                        
L2/3 IT HPCAL1     0.0  0.031
IT RORB            0.0  0.000
L5 IT FEZF2        0.0  0.003
VEN                0.0  0.016
L5 ET              0.0  0.015
L6 PC              0.0  0.000

phase_idx_first: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.000  14.000
median           0.083    0.169        0.101   0.037   0.249   0.215
{'KW H': 19.5, 'KW p': 0.00157, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 0.29, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.00294, 'bonferroni VEN vs L6 PC': 0.0616, 'sidak VEN vs L2/3 IT HPCAL1': 0.938, 'sidak VEN vs IT RORB': 0.254, 'sidak VEN vs L5 IT FEZF2': 0.731, 'sidak VEN vs L5 ET': 0.00293, 'sidak VEN vs L6 PC': 0.0599}

phase_idx_median: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.000  14.000
median           0.259    0.245        0.111   0.081   0.357   0.159
{'KW H': 19.6, 'KW p': 0.00146, 'bonferroni VEN vs L2/3 IT HPCAL1': 0.0874, 'bonferroni VEN vs IT RORB': 0.133, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.00863, 'bonferroni VEN vs L6 PC': 1.0, 'sidak VEN vs L2/3 IT HPCAL1': 0.084, 'sidak VEN vs IT RORB': 0.125, 'sidak VEN vs L5 IT FEZF2': 0.958, 'sidak VEN vs L5 ET': 0.0086, 'sidak VEN vs L6 PC': 0.909}

phase_idx_first_x: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2    VEN   L5 ET   L6 PC
count           25.000   21.000      122.000  26.00  15.000  14.000
median           0.063    0.169        0.095   0.03   0.214   0.215
{'KW H': 26.4, 'KW p': 7.6e-05, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 0.0169, 'bonferroni VEN vs L5 IT FEZF2': 0.116, 'bonferroni VEN vs L5 ET': 0.0024, 'bonferroni VEN vs L6 PC': 0.0029, 'sidak VEN vs L2/3 IT HPCAL1': 0.998, 'sidak VEN vs IT RORB': 0.0168, 'sidak VEN vs L5 IT FEZF2': 0.11, 'sidak VEN vs L5 ET': 0.0024, 'sidak VEN vs L6 PC': 0.0029}

phase_idx_median_x: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.000  14.000
median           0.259    0.245        0.111   0.081   0.354   0.159
{'KW H': 19.3, 'KW p': 0.00167, 'bonferroni VEN vs L2/3 IT HPCAL1': 0.132, 'bonferroni VEN vs IT RORB': 0.114, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.00809, 'bonferroni VEN vs L6 PC': 1.0, 'sidak VEN vs L2/3 IT HPCAL1': 0.124, 'sidak VEN vs IT RORB': 0.108, 'sidak VEN vs L5 IT FEZF2': 0.957, 'sidak VEN vs L5 ET': 0.00806, 'sidak VEN vs L6 PC': 0.903}

phase_idx_first_p2: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.000  14.000
median           0.087    0.169        0.101   0.067   0.249   0.215
{'KW H': 13.9, 'KW p': 0.0159, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 1.0, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.0545, 'bonferroni VEN vs L6 PC': 0.387, 'sidak VEN vs L2/3 IT HPCAL1': 0.998, 'sidak VEN vs IT RORB': 0.831, 'sidak VEN vs L5 IT FEZF2': 1.0, 'sidak VEN vs L5 ET': 0.0531, 'sidak VEN vs L6 PC': 0.324}

phase_idx_median_p2: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2   VEN   L5 ET   L6 PC
count           30.000    21.00      125.000  29.0  18.000  14.000
median           0.419     0.27        0.173   0.2   0.543   0.408
{'KW H': 13.9, 'KW p': 0.0162, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 1.0, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.523, 'bonferroni VEN vs L6 PC': 0.691, 'sidak VEN vs L2/3 IT HPCAL1': 0.689, 'sidak VEN vs IT RORB': 0.978, 'sidak VEN vs L5 IT FEZF2': 1.0, 'sidak VEN vs L5 ET': 0.413, 'sidak VEN vs L6 PC': 0.507}

phase_idx_first_p10: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN   L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.000  14.000
median           0.085    0.169        0.113   0.067   0.249   0.215
{'KW H': 16.7, 'KW p': 0.00512, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 1.0, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.0138, 'bonferroni VEN vs L6 PC': 0.565, 'sidak VEN vs L2/3 IT HPCAL1': 1.0, 'sidak VEN vs IT RORB': 0.902, 'sidak VEN vs L5 IT FEZF2': 1.0, 'sidak VEN vs L5 ET': 0.0137, 'sidak VEN vs L6 PC': 0.438}

phase_idx_median_p10: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2     VEN  L5 ET   L6 PC
count           30.000   21.000      125.000  29.000  18.00  14.000
median           0.131    0.222        0.096   0.055   0.23   0.118
{'KW H': 15.7, 'KW p': 0.0079, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 0.0364, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 0.0504, 'bonferroni VEN vs L6 PC': 1.0, 'sidak VEN vs L2/3 IT HPCAL1': 0.882, 'sidak VEN vs IT RORB': 0.0358, 'sidak VEN vs L5 IT FEZF2': 0.979, 'sidak VEN vs L5 ET': 0.0492, 'sidak VEN vs L6 PC': 0.959}

Fraction of APs whose rising phase has two maxima (median per cell, by group):
group
L2/3 IT HPCAL1    0.750
IT RORB           0.778
L5 IT FEZF2       0.500
VEN               0.800
L5 ET             0.707
L6 PC             0.667
In [26]:
pk_raw = pd.read_excel(aic.PEAKIDX_XLSX, sheet_name="Sheet1")
code_n = {"L23IT_HAPCAL1": 30, "ITrorb": 22, "L5IT": 122, "VEN": 29, "L5ET": 17, "L6PC": 13}  # Fig3e_plotBoxplot_PeakIdx_cellTypes.m
rows = []
for i in range(0, 18, 3):
    name = pk_raw.columns[i]
    for c, v in zip(pk_raw.iloc[:code_n[name], i], pk_raw.iloc[:code_n[name], i + 1]):
        rows.append({"cell_ID": str(c).strip("'"), "code_group": name, "code_idx": v})
pkc = pd.DataFrame(rows)
pkc["filename"] = pkc.cell_ID.map(m1.filename_nwb)
pkc = pkc.join(byfile[["phase_idx_first", "phase_idx_median", "phase_idx_first_x", "phase_idx_median_x"]], on="filename")
print("Cells in the code's table:", len(pkc), "; found in the dandiset:", int(pkc.filename.notna().sum()))
for c in ["phase_idx_first", "phase_idx_median", "phase_idx_first_x", "phase_idx_median_x"]:
    ok = pkc[c].notna() & pkc.code_idx.notna()
    print(f"{c}: Spearman with the hand-read values {stats.spearmanr(pkc[c][ok], pkc.code_idx[ok])[0]:.2f}, "
          f"median absolute difference {(pkc[c] - pkc.code_idx).abs().median():.3f}, cells {int(ok.sum())}")
print("Code's values, medians by its groups:", pkc.groupby("code_group").code_idx.median().round(3).to_dict())
gmap = {"L23IT_HAPCAL1": "L2/3 IT HPCAL1", "ITrorb": "IT RORB", "L5IT": "L5 IT FEZF2", "VEN": "VEN", "L5ET": "L5 ET", "L6PC": "L6 PC"}
pkc["group"] = pkc.code_group.map(gmap)
medtab, out = dunn_table(pkc, "code_idx")
print("Kruskal-Wallis and Dunn on the code's per-cell values:", {k: float(f"{v:.3g}") for k, v in out.items()})
Cells in the code's table: 233 ; found in the dandiset: 233
phase_idx_first: Spearman with the hand-read values 0.39, median absolute difference 0.128, cells 231
phase_idx_median: Spearman with the hand-read values 0.20, median absolute difference 0.175, cells 231
phase_idx_first_x: Spearman with the hand-read values 0.51, median absolute difference 0.123, cells 217
phase_idx_median_x: Spearman with the hand-read values 0.21, median absolute difference 0.176, cells 231
Code's values, medians by its groups: {'ITrorb': 0.277, 'L23IT_HAPCAL1': 0.223, 'L5ET': 0.289, 'L5IT': 0.25, 'L6PC': 0.338, 'VEN': 0.117}
Kruskal-Wallis and Dunn on the code's per-cell values: {'KW H': 42.4, 'KW p': 4.92e-08, 'bonferroni VEN vs L2/3 IT HPCAL1': 0.00102, 'bonferroni VEN vs IT RORB': 1.89e-05, 'bonferroni VEN vs L5 IT FEZF2': 1.5e-07, 'bonferroni VEN vs L5 ET': 7.16e-05, 'bonferroni VEN vs L6 PC': 2.57e-05, 'sidak VEN vs L2/3 IT HPCAL1': 0.00102, 'sidak VEN vs IT RORB': 1.89e-05, 'sidak VEN vs L5 IT FEZF2': 1.5e-07, 'sidak VEN vs L5 ET': 7.16e-05, 'sidak VEN vs L6 PC': 2.57e-05}

Noise and the shoulder branch. With one maximum of dV/dt, the AIS value is read at the lowest local minimum of d2V/dt2 before it. Recording noise makes such minima everywhere on the rise, also just before the maximum, where the AIS value is close to the SD value and the index close to 0, the most saddle-like value. Below, synthetic APs with Gaussian noise added to V (200 trials each), the noise level of the recordings, where the shoulder branch places the AIS value in the recorded first APs, and the index on the first APs that have two resolved maxima, where the shoulder branch does not enter.

In [27]:
rng = np.random.default_rng(0)
def synth_ap(kind, fs):
    ts = np.arange(0, 0.006, 1 / fs)
    bump = lambda t0, w, h: h * np.exp(-0.5 * ((ts - t0) / w) ** 2)
    dv = {"biphasic": bump(0.0012, 0.00015, 150) + bump(0.0018, 0.0002, 250),
          "shoulder": bump(0.0013, 0.0002, 120) + bump(0.0017, 0.0002, 250),
          "monophasic fast": bump(0.0016, 0.0003, 300),
          "monophasic slow": bump(0.0024, 0.0006, 150)}[kind]  # mV/ms
    v = -50 + np.cumsum(dv) / fs * 1000
    thr = int(np.flatnonzero(dv > 0.02 * dv.max())[0])
    return v, thr, int(np.argmax(v[: int(np.argmax(dv)) + int(0.002 * fs)]))
rows = []
for fs_n in [50000.0, 25000.0]:
    for kind in ["biphasic", "shoulder", "monophasic fast", "monophasic slow"]:
        v, thr, peak = synth_ap(kind, fs_n)
        for sd in [0.0, 0.02, 0.03, 0.05, 0.1]:
            res = [aic.phase_index(v + rng.normal(0, sd, len(v)), fs_n, thr, peak) for _ in range(200 if sd else 1)]
            vals = np.array([r[0] for r in res]); kinds = np.array([r[1] for r in res])
            rows.append({"kHz": fs_n / 1000, "AP": kind, "noise mV": sd, "median index": np.median(vals),
                         "fraction below 0.1": np.mean(vals < 0.1), "fraction read as shoulder": np.mean(kinds == "shoulder")})
print("Synthetic APs (noiseless index: biphasic and shoulder 0.2 to 0.25, monophasic 0.8):")
print(pd.DataFrame(rows).round(3).to_string(index=False))

print("\nNoise of the raw trace before the step, maximal-rate sweep (mV, median and 90th percentile), by device and sampling rate:")
print(grp.groupby(["device", grp.fs.round(-3) / 1000]).noise_mV.agg(["count", "median", lambda x: x.quantile(0.9)])
      .set_axis(["cells", "median", "90th percentile"], axis=1).round(3).to_string())
print("Median noise by group (mV):", grp.groupby("group").noise_mV.median().reindex(aic.GROUPS).round(3).to_dict())

sh = grp[grp.phase_first_kind == "shoulder"]
print("\nFirst APs read through the shoulder branch, by group: cells, median time of the AIS value before the dV/dt maximum (ms),")
print("median AIS value over the maximum, and the fraction of cells with the AIS value at 0.9 of the maximum or above:")
print(pd.DataFrame({"cells": sh.groupby("group").size(),
                    "lead ms": sh.groupby("group").phase_first_ais_lead_ms.median(),
                    "AIS/max": sh.groupby("group").phase_first_ais_over_max.median(),
                    "AIS/max >= 0.9": sh.groupby("group").phase_first_ais_over_max.apply(lambda x: np.mean(x >= 0.9))}).reindex(aic.GROUPS).round(3).to_string())
print("Spearman of the first-AP index with the noise level, shoulder-branch cells:",
      f"{stats.spearmanr(sh.noise_mV, sh.phase_idx_first, nan_policy='omit')[0]:.2f}",
      "; with the time of the AIS value before the maximum:",
      f"{stats.spearmanr(sh.phase_first_ais_lead_ms, sh.phase_idx_first, nan_policy='omit')[0]:.2f}")
print("Median first-AP index by branch and group:")
print(grp.pivot_table(index="phase_first_kind", columns="group", values="phase_idx_first", aggfunc="median")[aic.GROUPS].round(3).to_string())

two = grp[grp.phase_first_kind == "two"].copy()
two["phase_idx_first_two"] = two.phase_idx_first
medtab, out = dunn_table(two, "phase_idx_first_two")
print("\nFirst APs with two resolved maxima only: medians by group"); print(medtab.round(3).T.to_string())
print({k: float(f"{v:.3g}") for k, v in out.items()})
Synthetic APs (noiseless index: biphasic and shoulder 0.2 to 0.25, monophasic 0.8):
 kHz              AP  noise mV  median index  fraction below 0.1  fraction read as shoulder
50.0        biphasic      0.00         0.244               0.000                      0.000
50.0        biphasic      0.02         0.244               0.000                      0.000
50.0        biphasic      0.03         0.244               0.000                      0.000
50.0        biphasic      0.05         0.244               0.000                      0.000
50.0        biphasic      0.10         0.243               0.000                      0.000
50.0        shoulder      0.00         0.212               0.000                      1.000
50.0        shoulder      0.02         0.250               0.165                      1.000
50.0        shoulder      0.03         0.214               0.375                      1.000
50.0        shoulder      0.05         0.018               0.585                      1.000
50.0        shoulder      0.10         0.009               0.765                      1.000
50.0 monophasic fast      0.00         0.810               0.000                      0.000
50.0 monophasic fast      0.02         0.666               0.250                      1.000
50.0 monophasic fast      0.03         0.698               0.375                      1.000
50.0 monophasic fast      0.05         0.006               0.755                      1.000
50.0 monophasic fast      0.10         0.008               0.850                      1.000
50.0 monophasic slow      0.00         0.813               0.000                      0.000
50.0 monophasic slow      0.02         0.003               0.980                      1.000
50.0 monophasic slow      0.03         0.005               0.925                      1.000
50.0 monophasic slow      0.05         0.011               0.755                      1.000
50.0 monophasic slow      0.10         0.100               0.500                      0.995
25.0        biphasic      0.00         0.252               0.000                      0.000
25.0        biphasic      0.02         0.252               0.000                      0.000
25.0        biphasic      0.03         0.252               0.000                      0.000
25.0        biphasic      0.05         0.252               0.000                      0.000
25.0        biphasic      0.10         0.252               0.000                      0.000
25.0        shoulder      0.00         0.200               0.000                      1.000
25.0        shoulder      0.02         0.200               0.000                      1.000
25.0        shoulder      0.03         0.200               0.000                      1.000
25.0        shoulder      0.05         0.201               0.010                      1.000
25.0        shoulder      0.10         0.202               0.110                      1.000
25.0 monophasic fast      0.00         0.800               0.000                      0.000
25.0 monophasic fast      0.02         0.800               0.000                      0.060
25.0 monophasic fast      0.03         0.800               0.000                      0.120
25.0 monophasic fast      0.05         0.798               0.000                      0.385
25.0 monophasic fast      0.10         0.477               0.055                      0.865
25.0 monophasic slow      0.00         0.810               0.000                      0.000
25.0 monophasic slow      0.02         0.698               0.210                      1.000
25.0 monophasic slow      0.03         0.667               0.445                      1.000
25.0 monophasic slow      0.05         0.009               0.685                      1.000
25.0 monophasic slow      0.10         0.007               0.870                      1.000

Noise of the raw trace before the step, maximal-rate sweep (mV, median and 90th percentile), by device and sampling rate:
                            cells  median  90th percentile
device                fs                                  
AXON recording system 25.0      2   0.130            0.183
                      50.0    129   0.023            0.026
Heka LIH:8+8          25.0    105   0.304            0.546
                      50.0      1   0.022            0.022
Median noise by group (mV): {'L2/3 IT HPCAL1': 0.228, 'IT RORB': 0.208, 'L5 IT FEZF2': 0.024, 'VEN': 0.024, 'L5 ET': 0.185, 'L6 PC': 0.147}

First APs read through the shoulder branch, by group: cells, median time of the AIS value before the dV/dt maximum (ms),
median AIS value over the maximum, and the fraction of cells with the AIS value at 0.9 of the maximum or above:
                cells  lead ms  AIS/max  AIS/max >= 0.9
group                                                  
L2/3 IT HPCAL1     21     0.12    0.865           0.381
IT RORB            18     0.18    0.701           0.111
L5 IT FEZF2       112     0.18    0.809           0.330
VEN                20     0.16    0.919           0.550
L5 ET              11     0.20    0.647           0.182
L6 PC              13     0.20    0.600           0.077
Spearman of the first-AP index with the noise level, shoulder-branch cells: 0.07 ; with the time of the AIS value before the maximum: 0.75
Median first-AP index by branch and group:
group             L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2    VEN  L5 ET  L6 PC
phase_first_kind                                                           
none                       0.778      NaN        0.774  0.750  0.731    NaN
shoulder                   0.073    0.176        0.106  0.042  0.214  0.250
two                        0.013    0.095        0.016  0.006  0.424 -0.438

First APs with two resolved maxima only: medians by group
group   L2/3 IT HPCAL1  IT RORB  L5 IT FEZF2    VEN  L5 ET  L6 PC
count            4.000    3.000       10.000  6.000  4.000  1.000
median           0.013    0.095        0.016  0.006  0.424 -0.438
{'KW H': 4.07, 'KW p': 0.54, 'bonferroni VEN vs L2/3 IT HPCAL1': 1.0, 'bonferroni VEN vs IT RORB': 1.0, 'bonferroni VEN vs L5 IT FEZF2': 1.0, 'bonferroni VEN vs L5 ET': 1.0, 'bonferroni VEN vs L6 PC': 1.0, 'sidak VEN vs L2/3 IT HPCAL1': 1.0, 'sidak VEN vs IT RORB': 1.0, 'sidak VEN vs L5 IT FEZF2': 1.0, 'sidak VEN vs L5 ET': 0.985, 'sidak VEN vs L6 PC': 0.981}

Result: fig3e blocked (methods underspecified). The automatic reading the criterion fixes would give partially reproduced, but on the analysis below it does not measure the saddle shape on these recordings, and its outcome turns on a detail the paper does not give. On the first AP of the maximal-rate sweep the VEN median index is the lowest (0.037; next L2/3 IT HPCAL1 0.083), Kruskal-Wallis p = 0.0016, and Dunn's test separates VENs from L5 ET (Bonferroni p = 0.003, Sidak 0.003) and from no other group (L6 PC 0.062). On the median over the sweep's APs the VEN median is again the lowest (0.081; next L5 IT FEZF2 0.111), Kruskal-Wallis p = 0.0015, and Dunn's test separates VENs from L5 ET only (p = 0.009 under both). APs whose AIS phase is not resolved are on average 3% or less of a group's APs, but they are the first AP of 5 of 30 L2/3 IT HPCAL1 cells, 3 of 125 L5 IT FEZF2, 3 of 29 VEN and 3 of 18 L5 ET. Leaving them out keeps the VEN medians the lowest (0.030 and 0.081) and changes the first-AP Dunn result: VENs are then separated from IT RORB, L5 ET and L6 PC. The outcome rests on the prominence guard: at 0.02 of the maximal dV/dt the median-AP reading no longer gives VENs the lowest median (0.200 against 0.173 for L5 IT FEZF2) and on the first AP Dunn's test separates no group (lowest p, L5 ET, 0.053 Sidak and 0.055 Bonferroni), which the criterion would not call partially reproduced; at 0.10 the VEN median is the lowest under both readings and VENs are separated from L5 ET on the first AP and from IT RORB on the median.

The shoulder branch reads 195 of the 237 first APs, and it does not measure the shoulder on these recordings. On synthetic APs without noise it gives 0.21 for an AP with a shoulder and 0.81 for one without an AIS phase; with Gaussian noise of 0.02 to 0.05 mV at 50 kHz, a slow-rising AP without an AIS phase gets a median index of 0.003 to 0.011, below 0.1 in 76% to 98% of trials, and the shoulder AP falls to 0.018 at 0.05 mV. At 25 kHz the AP without an AIS phase falls the same way from 0.05 mV, while the shoulder AP keeps its index. The recordings are in this range: the white noise before the step is 0.023 mV (median) in the 50 kHz Axon files and 0.30 mV in the 25 kHz HEKA files. In the recorded first APs read through this branch, the index rises with the time between the AIS value and the dV/dt maximum (Spearman 0.75), and in VENs the AIS value lies a median 0.16 ms before the maximum at 0.92 of it, at 0.9 or more of it in 55% of VEN cells (8% to 38% in the PC groups), as the noise places it in the synthetic test. On the 28 first APs with two resolved maxima, where the branch does not enter, the groups do not differ (Kruskal-Wallis p = 0.54). The code's hand-read values for 233 cells give the paper's result (VEN median 0.117, the lowest; Dunn p of 0.001 or less against every PC group, both corrections), and the automatic index agrees with them only loosely (Spearman 0.39 first AP, 0.20 median). The index also depends on the sampling rate (Axon files brought to 25 kHz change it, median 0.088 to 0.168), and within one device VENs are not significantly lower than the other groups pooled (Axon p = 0.08, HEKA p = 0.10). The paper placed the peaks by hand and gives no rule an automatic reading could follow, and the outcome changes with the choices this reading makes, so no automatic reading has a defensible basis. The claim is blocked, methods underspecified, with fig3d-saddle-phase-plane and fig4i-peak-index-ais-distance-real, which use the same index.

Limits of this analysis. The fall under noise holds for the slow-rising AP: a fast-rising AP without an AIS phase keeps a high index at 0.02 and 0.03 mV (0.666 and 0.698) and falls to 0.006 only from 0.05 mV. Among shoulder-branch cells the index does not correlate with the noise (Spearman 0.07), and the HEKA noise of 0.30 mV is above the 0.1 mV the synthetic test reaches. The p = 0.54 on two resolved maxima comes from groups of 1 to 10 cells and has little power; VENs still have the lowest median there (0.006). The criterion fixes an automatic reading and reports a disagreement with the hand-read values as a deviation, so blocking goes beyond its letter, on the grounds that the fixed reading does not measure what it stands for; a reader should confirm this.

In [28]:
pc = grp[grp.group != "VEN"]
print("Description that does not decide: median fraction of APs (maximal-rate sweep) with two maxima of dV/dt on the rise")
print("VEN", round(grp[grp.group == "VEN"].phase_two_peaks_frac.median(), 3), "; PC groups pooled", round(pc.phase_two_peaks_frac.median(), 3),
      "; rank-sum p", f"{stats.mannwhitneyu(grp[grp.group == 'VEN'].phase_two_peaks_frac.dropna(), pc.phase_two_peaks_frac.dropna()).pvalue:.3g}")
fig, ax = plt.subplots(1, 2, figsize=(9, 3))
for a, col in zip(ax, ["phase_idx_first", "phase_idx_median"]):
    a.boxplot([grp[grp.group == g][col].dropna() for g in aic.GROUPS], tick_labels=[g.split()[0] for g in aic.GROUPS])
    a.set_title(col); a.set_ylabel("phase peak index")
plt.tight_layout(); plt.show()
print("Plotted ranges:", {c: (round(grp[c].min(), 3), round(grp[c].max(), 3)) for c in ["phase_idx_first", "phase_idx_median"]})
Description that does not decide: median fraction of APs (maximal-rate sweep) with two maxima of dV/dt on the rise
VEN 0.8 ; PC groups pooled 0.6 ; rank-sum p 0.34
No description has been provided for this image
Plotted ranges: {'phase_idx_first': (np.float64(-0.897), np.float64(1.018)), 'phase_idx_median': (np.float64(-0.486), np.float64(0.793))}

Result: fig3d blocked (methods underspecified), as fig3e-phase-peak-index, whose outcome it takes. As a description that does not decide, the median fraction of APs with two maxima of dV/dt on the rise is 0.80 in VENs against 0.60 in the PC groups pooled (p = 0.34).

fig4ac-ven-broader-smaller-ap¶

APs of VENs (n = 281) are broader and lower in amplitude than those of L5 PCs (n = 306), throughout the spike train evoked by supra-threshold current.

In [29]:
allc = meta.drop_duplicates("filename_nwb").merge(cells, left_on="filename_nwb", right_on="filename", suffixes=("_table", ""))
v = allc[allc.cellType.fillna("").str.upper().str.contains("VEN")]
l5 = allc[allc.cellSubtype.isin(["PC_L5", "PC_L5ET"])]
print("Recordings with expert type VEN:", len(v), "; with L5 PC labels (PC_L5, PC_L5ET):", len(l5), "; expected 281 and 306")
for f in ["half_width", "amplitude", "penult_half_width", "penult_amplitude"]:
    x, y = v[f].dropna(), l5[f].dropna()
    print(f"{f}: VEN median {x.median():.3f} (n {len(x)}), L5 PC {y.median():.3f} (n {len(y)}), rank-sum p {stats.mannwhitneyu(x, y).pvalue:.3g}")
Recordings with expert type VEN: 68 ; with L5 PC labels (PC_L5, PC_L5ET): 138 ; expected 281 and 306
half_width: VEN median 3.080 (n 67), L5 PC 2.700 (n 138), rank-sum p 0.00924
amplitude: VEN median 86.175 (n 68), L5 PC 90.161 (n 138), rank-sum p 0.0712
penult_half_width: VEN median 5.100 (n 66), L5 PC 4.720 (n 136), rank-sum p 0.0603
penult_amplitude: VEN median 54.209 (n 66), L5 PC 57.286 (n 136), rank-sum p 0.336

Result: fig4ac blocked (data missing). The dandiset holds 68 VENs and 138 cells labelled as L5 PCs (PC_L5, PC_L5ET), the Patch-seq cells, against the 281 VENs and 306 L5 PCs of Fig. 4a-c, which the paper calls additional recordings. The 113 Axon files without a transcriptomic type are rows of the Patch-seq cell table, and every file's experiment description reads "Patch-seq experiment of cell atlas investigation of the macaque anterior insular cortex," (cell 10), so they are not taken as those recordings. As a variant on the Patch-seq cells, which does not decide, VEN APs are broader (3.08 against 2.70 ms, p = 0.009) and smaller (86.2 against 90.2 mV, p = 0.071), neither with p below the criterion's 0.001; at the penultimate AP of the maximal-rate sweep 5.10 against 4.72 ms (p = 0.060) and 54.2 against 57.3 mV (p = 0.34).

fig4i-peak-index-ais-distance-real¶

In real neurons the phase peak index decreases linearly with the distance of the AIS from the soma (n = 62).

The 62 neurons are taken as the Patch-seq cells with a reconstructed axon origin (the criterion): those with an AIS distance (axonDist) in morphFeatMatrix.xlsx, matched by cell ID. As in Fig4itop_plot_PhasePeakIdx_vs_AISd.m, the indices are averaged in 10 um bins and a line is fitted to the bin means against the bins' left edges, its slope tested by a two-tailed t-test.

In [30]:
mat = loadmat(__import__("io").BytesIO(requests.get(aic.AIS_MAT, timeout=60).content))
print("NeuronPeakIdx_summary.mat holds:", {k: v.shape for k, v in mat.items() if not k.startswith("__")})
vals = mat["phaseHeightIdx"].ravel()
allpk = []
for i in range(0, 18, 3):
    allpk += list(pd.to_numeric(pk_raw.iloc[:, i + 1], errors="coerce").dropna())
allpk = np.array(allpk)
hits = [int(np.isclose(allpk, x, rtol=0, atol=1e-6).sum()) for x in vals]
print("Of its 62 peak indices, found in PeakIdx_Fig5e.xlsx (the per-cell table with cell IDs):", sum(h > 0 for h in hits))
mx0 = pd.read_excel(aic.MORPH_XLSX, sheet_name="morphFeatMatrix")
ad = mat["axonDist"].ravel()
print("Of its 62 AIS distances, nonzero:", int((ad > 0).sum()), "; nonzero ones found among the axonDist values of morphFeatMatrix.xlsx:",
      int(sum(np.isclose(mx0.axonDist.dropna(), a, rtol=0, atol=1e-3).any() for a in ad if a > 0)))

# The criterion's reading: the 62 neurons taken as the Patch-seq cells with a reconstructed axon origin, AIS distance
# from morphFeatMatrix.xlsx (axonDist, um) by cell ID.
mx0["cell_ID"] = mx0["Unnamed: 0"].astype(str).str.strip("'")
ais = lab.merge(mx0[["cell_ID", "axonDist"]], on="cell_ID").dropna(subset=["axonDist"])
ais = ais.join(pkc.drop_duplicates("cell_ID").set_index("cell_ID")[["code_idx"]], on="cell_ID")
print("\nPatch-seq cells with an AIS distance in morphFeatMatrix.xlsx:", len(ais), "(legend 62); by group:",
      ais.group.fillna("none").value_counts().to_dict(), "; distance 0:", int((ais.axonDist == 0).sum()),
      "; range", ais.axonDist.min().round(1), "to", ais.axonDist.max().round(1), "um")
fig4i = {}
for col, nz in [(x, False) for x in ["phase_idx_first", "phase_idx_median", "phase_idx_first_x", "phase_idx_median_x", "code_idx"]] + \
        [("phase_idx_first", True), ("phase_idx_median", True), ("code_idx", True)]:
    d = ais.dropna(subset=[col])
    d = d[d.axonDist > 0] if nz else d
    b = d.assign(bin=(d.axonDist // 10) * 10).groupby("bin")[col].agg(["mean", "size"])
    lr = stats.linregress(b.index, b["mean"])
    lc = stats.linregress(d.axonDist, d[col])
    fig4i[col + (", distance > 0 (variant)" if nz else "")] = {"cells": len(d), "bins": len(b), "slope per um, bins": lr.slope, "p, bins": lr.pvalue,
                  "slope per um, cells (variant)": lc.slope, "p, cells": lc.pvalue}
print(pd.DataFrame(fig4i).T.to_string(float_format=lambda v: f"{v:.4g}"))
NeuronPeakIdx_summary.mat holds: {'axonDist': (62, 1), 'phaseHeightIdx': (1, 62)}
Of its 62 peak indices, found in PeakIdx_Fig5e.xlsx (the per-cell table with cell IDs): 0
Of its 62 AIS distances, nonzero: 41 ; nonzero ones found among the axonDist values of morphFeatMatrix.xlsx: 0

Patch-seq cells with an AIS distance in morphFeatMatrix.xlsx: 153 (legend 62); by group: {'L5 IT FEZF2': 46, 'L2/3 IT HPCAL1': 26, 'none': 25, 'VEN': 19, 'IT RORB': 14, 'L6 PC': 12, 'L5 ET': 11} ; distance 0: 106 ; range 0.0 to 418.4 um
                                          cells  bins  slope per um, bins  p, bins  slope per um, cells (variant)  p, cells
phase_idx_first                             153    12           4.842e-05   0.9214                      0.0004481    0.3644
phase_idx_median                            153    12           0.0002611   0.6193                     -0.0002164    0.6434
phase_idx_first_x                           139    12           0.0004556   0.3634                      0.0004919    0.1986
phase_idx_median_x                          153    12           0.0002664   0.6242                     -0.0001943    0.6759
code_idx                                    127     7           -0.002699  0.01792                      -0.003288 5.764e-05
phase_idx_first, distance > 0 (variant)      47    12           7.439e-05   0.8812                      0.0004841    0.4338
phase_idx_median, distance > 0 (variant)     47    12           0.0002121   0.6919                     -0.0003283    0.5395
code_idx, distance > 0 (variant)             32     7           -0.002733  0.01792                      -0.002944  0.002624

Result: fig4i blocked (methods underspecified). On the automatic index it would be not reproduced, but the reading decides the outcome, as below. The 62 AIS distances of the paper's code carry no cell IDs and match no per-cell table, so the criterion's reading is used: the Patch-seq cells with an AIS distance in morphFeatMatrix.xlsx, 153 of them (106 at 0 um) where the legend gives 62. Over 10 um bins the line through the bin means has a slope of +0.00005 per um (p = 0.92) for the first-AP index and +0.0003 (p = 0.62) for the median index, so neither reading gives the negative slope. The code's hand-read indices on the same cells (127) give a negative slope (-0.0027 per um, p = 0.018 over 7 bins), so the difference rests on the automatic peak reading, as for fig3e-phase-peak-index. Leaving out the cells at 0 um does not change this. The automatic index does not measure the saddle shape on these recordings (fig3e-phase-peak-index), so the claim is blocked as that claim is. None of the 62 values in the mat file is in the per-cell tables, so the hand-read result does not decide either.

ext9cd-ven-subtypes-ap and supp8-ven-subtypes-similar-features¶

In [31]:
vsub = allc[allc.cellType.fillna("").str.upper().str.contains("VEN")].copy()
vsub["sub"] = vsub.cellSubtype.str.replace("VEN_short", "VEN_Short")
print("VENs by expert subtype, all files:", vsub["sub"].value_counts(dropna=False).to_dict(), "; expected VEN-L 85 and VEN-S 41")
a, b = vsub[vsub["sub"] == "VEN_Long"], vsub[vsub["sub"] == "VEN_Short"]
p = [stats.mannwhitneyu(a[f].dropna(), b[f].dropna()).pvalue for f in ["half_width", "amplitude"]]
for f, pp, q in zip(["half_width", "amplitude"], p, aic.bh(p)):
    print(f"{f}: VEN-L median {a[f].median():.3f} (n {a[f].notna().sum()}), VEN-S {b[f].median():.3f} (n {b[f].notna().sum()}), "
          f"difference {a[f].median() - b[f].median():.3f}, p {pp:.3g}, FDR over the two {q:.3g}")
VENs by expert subtype, all files: {nan: 30, 'VEN_Long': 18, 'VEN_Short': 11, 'PC_L5': 4, 'L23_PC': 3, 'PC_L6': 1, 'PC_L23': 1} ; expected VEN-L 85 and VEN-S 41
half_width: VEN-L median 3.300 (n 17), VEN-S 2.980 (n 11), difference 0.320, p 0.371, FDR over the two 0.371
amplitude: VEN-L median 84.694 (n 18), VEN-S 86.381 (n 11), difference -1.687, p 0.357, FDR over the two 0.371
In [32]:
def two_group(dfa, dfb, family=F20):
    rows = {f: {"median_a": dfa[f].median(), "median_b": dfb[f].median(), "n_a": dfa[f].notna().sum(), "n_b": dfb[f].notna().sum(),
                "p": stats.mannwhitneyu(dfa[f].dropna(), dfb[f].dropna()).pvalue if dfa[f].notna().sum() > 1 and dfb[f].notna().sum() > 1 else np.nan}
            for f in IN39 + X19 + [x for x in F20 if x not in IN39]}
    t = pd.DataFrame(rows).T
    t["q_F20"] = np.nan
    t.loc[family, "q_F20"] = aic.bh(t.loc[family, "p"].astype(float))
    t["q39"] = np.nan
    t.loc[IN39 + X19, "q39"] = aic.bh(t.loc[IN39 + X19, "p"].astype(float))
    return t.sort_values("p")
tv = typed.copy()
for f in X19:
    tv[f] = tv.cell_ID.astype(str).map(xv[f])
vl, vs = tv[(tv.predictCluster == 16) & tv.cellType.eq("VEN")], tv[(tv.predictCluster == 8) & tv.cellType.eq("VEN")]
t = two_group(vl, vs)
print(f"Variant, cluster 16 VENs (n {len(vl)}) against cluster 8 VENs (n {len(vs)}), lowest p first:")
print(t.head(6).to_string(float_format=lambda v: f"{v:.4g}"))
print("Features with FDR < 0.05, 39-feature family:", int((t.q39 < 0.05).sum()), "; 20 Methods features:", int((t.q_F20 < 0.05).sum()))
t = two_group(a, b)
print(f"\nVariant, expert labels VEN_Long (n {len(a)}) against VEN_Short (n {len(b)}), lowest p first:")
print(t.head(6).to_string(float_format=lambda v: f"{v:.4g}"))
print("Features with FDR < 0.05, 39-feature family:", int((t.q39 < 0.05).sum()), "; 20 Methods features:", int((t.q_F20 < 0.05).sum()))
Variant, cluster 16 VENs (n 14) against cluster 8 VENs (n 15), lowest p first:
                     median_a  median_b  n_a  n_b        p  q_F20     q39
FR_slope               0.0275      0.06   10   13 0.001732    NaN 0.06756
ISI_phaseT_ratio_CV       0.5     0.259   10   15  0.01357    NaN  0.2242
ampAdpIdx_slope       -0.7318    -1.982   11   14  0.01725    NaN  0.2242
latency_slope       0.0001659 0.0003726   14   15  0.04706 0.3593  0.3623
sag_value               24.32     36.03   14   15  0.05212 0.3593     NaN
firstISI_slope         -0.133     -0.51   10   13  0.05448    NaN  0.3623
Features with FDR < 0.05, 39-feature family: 0 ; 20 Methods features: 0

Variant, expert labels VEN_Long (n 18) against VEN_Short (n 11), lowest p first:
                 median_a  median_b  n_a  n_b       p  q_F20   q39
FR_slope            0.028     0.055    9    9 0.01337    NaN 0.195
max_spikes              4         7   18   11  0.0174    NaN 0.195
max_firing_rate     6.667     11.67   18   11  0.0174 0.2022 0.195
ISI_adaptation      2.333     1.722   13   11 0.02385 0.2022 0.195
ISI_CV             0.4372    0.2801   13   11 0.02769    NaN 0.195
ISI_Fano            20.46     6.595   13   11 0.03206    NaN 0.195
Features with FDR < 0.05, 39-feature family: 0 ; 20 Methods features: 0

Result: venl blocked (data missing), for both claims. Among the 68 VENs of the dandiset, 18 are labelled VEN_Long and 11 VEN_Short, against the 85 VEN-L and 41 VEN-S recorded without RNA of Extended Data Fig. 9c,d and Supplementary Table 8, which are not here. As variants that do not decide: half-width 3.30 against 2.98 ms (p = 0.37, FDR 0.37 over the two features) and amplitude 84.7 against 86.4 mV (p = 0.36); no feature has FDR below 0.05 over the 39-feature family or the 20 Methods features, either for cluster 16 against cluster 8 VENs (lowest FR_slope, p = 0.0017, FDR 0.068) or for VEN_Long against VEN_Short (lowest FR_slope, p = 0.013, FDR 0.20). Some VEN-typed cells carry a PC subtype label (PC_L5 4, L23_PC 3, PC_L6 1, PC_L23 1).

supp9-venl-more-distinct-from-ct¶

VEN-L differs more from L5/6 CT neurons in physiology than VEN-S does.

In [33]:
ctc_all = tv[(tv.predictCluster == 8) & tv.cellType.eq("PC")]
# A recording filed twice with conflicting labels (cell 8) is left out: n175 (cluster 8 PC) holds the same voltage
# data as B289 (cluster 16, L5 ET).
conflict = set(cells.trace_hash[cells.trace_hash.duplicated(keep=False)])
ctc = ctc_all[~ctc_all.trace_hash.isin(conflict)]
print("VEN-L (cluster 16 VEN):", len(vl), "; VEN-S (cluster 8 VEN):", len(vs), "; L5/6 CT (cluster 8 PC):", len(ctc),
      "(legend 10); left out as a duplicate recording:", sorted(set(ctc_all.cell_ID) - set(ctc.cell_ID)))
res = {}
for ct_name, ctd in [("", ctc), (" (variant, duplicate kept)", ctc_all)]:
    for name, dfv in [("VEN-L vs L5/6 CT", vl), ("VEN-S vs L5/6 CT", vs)]:
        t = two_group(dfv, ctd)
        res[name + ct_name] = {"features FDR<0.05, 39": int((t.q39 < 0.05).sum()), "features FDR<0.05, F20": int((t.q_F20 < 0.05).sum()),
                               "median q39": round(float(t.q39.median()), 3), "median q_F20": round(float(t.q_F20.median()), 3)}
        if not ct_name:
            print(f"\n{name}, lowest p first:"); print(t.head(10).to_string(float_format=lambda v: f"{v:.4g}"))
print(pd.DataFrame(res).T.to_string())
VEN-L (cluster 16 VEN): 14 ; VEN-S (cluster 8 VEN): 15 ; L5/6 CT (cluster 8 PC): 10 (legend 10); left out as a duplicate recording: ['n175']

VEN-L vs L5/6 CT, lowest p first:
                          median_a  median_b  n_a  n_b         p    q_F20      q39
max_spikes                       5      10.5   14   10 0.0003714      NaN 0.007243
max_firing_rate              8.333      17.5   14   10 0.0003714 0.007429 0.007243
ISI_Fano                     11.41      4.05   10   10  0.001315      NaN  0.01709
ISI_CV                      0.3688    0.2611   10   10  0.002827      NaN  0.02757
FR_slope                    0.0275    0.0815   10   10  0.003548      NaN  0.02767
firstISI_slope              -0.133    -1.022   10   10  0.004586      NaN  0.02981
ISI_adaptation               2.111     1.577   10   10   0.01133  0.06213  0.05002
amp_adaptation              0.4903    0.6219   13   10   0.01202  0.06213  0.05002
decay                         9.18      5.24   11   10   0.01243  0.06213  0.05002
firstSpikePhasePerimeter     532.7     652.5   14   10   0.01283      NaN  0.05002

VEN-S vs L5/6 CT, lowest p first:
                          median_a  median_b  n_a  n_b        p  q_F20    q39
max_spikes                       8      10.5   15   10 0.008696    NaN 0.1696
max_firing_rate              13.33      17.5   15   10 0.008696 0.1739 0.1696
ISI_adaptation               1.891     1.577   15   10  0.05566 0.5566 0.6156
ISI_Fano                     9.563      4.05   15   10  0.06313    NaN 0.6156
ampAdpIdx_slope             -1.982   -0.7897   14   10   0.1354    NaN 0.7966
firstSpikePhasePerimeter     595.3     652.5   15   10   0.1572    NaN 0.7966
firstISI_slope               -0.51    -1.022   13   10   0.1629    NaN 0.7966
rise                          1.48      1.34   15   10   0.1634 0.6985 0.7966
latency                      114.6       168   15   10   0.1924 0.6985 0.8114
decay                         6.15      5.24   14   10   0.2081 0.6985 0.8114
                                            features FDR<0.05, 39  features FDR<0.05, F20  median q39  median q_F20
VEN-L vs L5/6 CT                                              6.0                     1.0       0.264         0.368
VEN-S vs L5/6 CT                                              0.0                     0.0       0.899         0.873
VEN-L vs L5/6 CT (variant, duplicate kept)                   12.0                     1.0       0.351         0.360
VEN-S vs L5/6 CT (variant, duplicate kept)                    0.0                     0.0       0.792         0.738

Result: supp9 reproduced. Against the 10 L5/6 CT PCs (legend 10; n175, a second copy of the L5 ET recording B289, is left out), VEN-L (14) differ in 6 of the 39 features at FDR below 0.05 (maximal firing rate and spike count, ISI Fano factor and CV, FR_slope and firstISI_slope) and VEN-S (15) in none; the median FDR is 0.26 against 0.90. Over the 20 Methods features the counts are 1 and 0. With n175 kept the counts are 12 and 0.

morph-table-link¶

(Link claim added by this attempt.) The rows of the paper's morphological feature table morphFeatMatrix.xlsx are cells of the dandiset, matched by cell ID, with the same transcriptomic cluster as the cell table metaInfo_ephysio_patchSeq.csv.

In [34]:
mx = pd.read_excel(aic.MORPH_XLSX, sheet_name="morphFeatMatrix").rename(columns={"Unnamed: 0": "cell_ID"})
mx["cell_ID"] = mx.cell_ID.astype(str).str.strip("'")
mfeat = [c for c in mx.columns if c not in ("cell_ID", "cellTypeID", "cellType_expert", "predictClusterID")]
print("Rows:", len(mx), "; distinct cell IDs:", mx.cell_ID.nunique(), "; morphological features:", len(mfeat), "(Methods: 40)")
mx["filename"] = mx.cell_ID.map(m1.filename_nwb)
in_ds = mx.cell_ID.isin(cells.cell_id)
print("Rows whose cell ID is a file's cell ID in the dandiset:", int(in_ds.sum()), f"({in_ds.mean():.1%})")
mx["cluster_table"] = mx.cell_ID.map(m1.predictCluster)
both_typed = mx.predictClusterID.notna() & mx.cluster_table.notna()
print("Rows with a cluster in both tables:", int(both_typed.sum()), "; agreeing:",
      int((mx.predictClusterID[both_typed] == mx.cluster_table[both_typed]).sum()))
print("Rows marked traced in the cell table:", int(mx.cell_ID.map(m1.morphoTraced).eq("traced").sum()),
      "; rows traced in the cell table:", int(meta.morphoTraced.eq("traced").sum()))
Rows: 166 ; distinct cell IDs: 166 ; morphological features: 57 (Methods: 40)
Rows whose cell ID is a file's cell ID in the dandiset: 166 (100.0%)
Rows with a cluster in both tables: 165 ; agreeing: 163
Rows marked traced in the cell table: 164 ; rows traced in the cell table: 166

Result: morphlink reproduced. All 166 rows of morphFeatMatrix.xlsx carry a cell ID that is the cell ID of a file in the dandiset, and 163 of the 165 rows with a cluster in both tables have the same cluster as the cell table. The table holds 57 morphological features, not the Methods' 40.

morph-more-distinct-than-ephys¶

Morphological differences between projection neuron groups are more pronounced than their physiological differences, with more features differing.

The comparisons of calFDR_ephsio.m (each group against the other five, and each pair), with BH FDR within each comparison. Morphological features from morphFeatMatrix.xlsx (all its features; the Methods' 40 are not listed), groups from the cell table's labels; physiological features from the dandiset's recordings (the 20 Methods features, which the criterion names, and the 39-feature family as a variant).

In [35]:
mg = mx.merge(lab[["cell_ID", "group"]], on="cell_ID", how="left").dropna(subset=["group"])
print("Morphology cells per group:", mg.group.value_counts().reindex(aic.GROUPS).to_dict(),
      "; Fig. 2h legend: 25, 16, 54, 18, 11, 13")
comparisons = [([g], [o for o in aic.GROUPS if o != g]) for g in aic.GROUPS] + \
    [([a], [b]) for i, a in enumerate(aic.GROUPS) for b in aic.GROUPS[i + 1:]]
rows = []
for A, B in comparisons:
    xa, xb = mg[mg.group.isin(A)], mg[mg.group.isin(B)]
    pm = [stats.mannwhitneyu(xa[f].dropna(), xb[f].dropna()).pvalue if xa[f].notna().sum() > 1 and xb[f].notna().sum() > 1 else np.nan
          for f in mfeat]
    qm = aic.bh(pm)
    te = compare(grp, A, B)
    rows.append({"comparison": f"{A[0]} vs {'rest' if len(B) > 1 else B[0]}",
                 "morph sig": int(np.nansum(qm < 0.05)), "morph tested": int(np.isfinite(qm).sum()),
                 "ephys F20 sig": int((te.loc[F20, "q_F20"] < 0.05).sum()),
                 "ephys 39 sig": int((te.loc[IN39 + X19, "q39"] < 0.05).sum()),
                 "ephys 39 tested": int(te.loc[IN39 + X19, "q39"].notna().sum())})
mc = pd.DataFrame(rows)
print(mc.to_string(index=False))
tot = mc.sum(numeric_only=True)
print("\nSummed over comparisons:", tot.to_dict())
print("(a) count: morph", int(tot["morph sig"]), "against ephys F20", int(tot["ephys F20 sig"]), "; 39-feature family",
      int(tot["ephys 39 sig"]))
print("(b) fraction: morph", round(tot["morph sig"] / tot["morph tested"], 3), "against ephys F20",
      round(tot["ephys F20 sig"] / (20 * len(comparisons)), 3), "; 39-feature family",
      round(tot["ephys 39 sig"] / tot["ephys 39 tested"], 3))

# The Methods count 40 morphological features without listing them; the table has 57. Random sets of 40 of the 57.
rng = np.random.default_rng(0)
pm_all = []
for A, B in comparisons:
    xa, xb = mg[mg.group.isin(A)], mg[mg.group.isin(B)]
    pm_all.append([stats.mannwhitneyu(xa[f].dropna(), xb[f].dropna()).pvalue if xa[f].notna().sum() > 1 and xb[f].notna().sum() > 1
                   else np.nan for f in mfeat])
pm_all = np.array(pm_all)
sub = []
for _ in range(500):
    k = rng.choice(len(mfeat), 40, replace=False)
    q = np.array([aic.bh(row[k]) for row in pm_all])
    sub.append((int(np.nansum(q < 0.05)), np.nansum(q < 0.05) / np.isfinite(q).sum()))
sub = np.array(sub)
print("Variant, 500 random sets of 40 of the 57 morphological features: count from", int(sub[:, 0].min()), "to", int(sub[:, 0].max()),
      "; fraction from", round(sub[:, 1].min(), 3), "to", round(sub[:, 1].max(), 3))
Morphology cells per group: {'L2/3 IT HPCAL1': 26, 'IT RORB': 16, 'L5 IT FEZF2': 53, 'VEN': 21, 'L5 ET': 11, 'L6 PC': 13} ; Fig. 2h legend: 25, 16, 54, 18, 11, 13
                   comparison  morph sig  morph tested  ephys F20 sig  ephys 39 sig  ephys 39 tested
       L2/3 IT HPCAL1 vs rest         29            57             11            13               39
              IT RORB vs rest          2            57              5             6               39
          L5 IT FEZF2 vs rest         18            57             11            15               39
                  VEN vs rest         27            57              0             0               39
                L5 ET vs rest         17            57              8             6               39
                L6 PC vs rest         28            57              7            11               39
    L2/3 IT HPCAL1 vs IT RORB          0            57              1             0               39
L2/3 IT HPCAL1 vs L5 IT FEZF2         32            57             13            16               39
        L2/3 IT HPCAL1 vs VEN         41            56              6            12               39
      L2/3 IT HPCAL1 vs L5 ET         27            56              5             4               39
      L2/3 IT HPCAL1 vs L6 PC         11            56              3             3               39
       IT RORB vs L5 IT FEZF2          9            56              9            10               39
               IT RORB vs VEN         29            57              3             7               39
             IT RORB vs L5 ET         17            56              4             0               39
             IT RORB vs L6 PC         14            56              0             0               39
           L5 IT FEZF2 vs VEN         17            57              0             0               39
         L5 IT FEZF2 vs L5 ET         10            56             12            14               39
         L5 IT FEZF2 vs L6 PC         25            56              9            13               39
                 VEN vs L5 ET         30            56              6            11               39
                 VEN vs L6 PC         40            56              5             8               39
               L5 ET vs L6 PC         22            55              2             1               39

Summed over comparisons: {'morph sig': 445, 'morph tested': 1185, 'ephys F20 sig': 120, 'ephys 39 sig': 150, 'ephys 39 tested': 819}
(a) count: morph 445 against ephys F20 120 ; 39-feature family 150
(b) fraction: morph 0.376 against ephys F20 0.286 ; 39-feature family 0.183
Variant, 500 random sets of 40 of the 57 morphological features: count from 255 to 372 ; fraction from 0.308 to 0.443

Result: morph reproduced. Summed over the 21 comparisons, 445 of 1,185 morphological tests (57 features; fraction 0.376) have FDR below 0.05, against 120 of 420 physiological tests over the 20 Methods features (fraction 0.286): more under both the count and the fraction. Over the 39-feature physiological family the count is 150 and the fraction 0.183, which leads to the same result. Over 500 random sets of 40 of the 57 morphological features, as the Methods count 40 without listing them, the count runs from 255 to 372 and the fraction from 0.308 to 0.443, above the physiological values in every set.

fig7c-tau-rna-distance¶

Across pairs of projection neuron types, distances in membrane time constant correlate with transcriptomic distances (r = 0.53), and other morphoelectric properties show similar correlations.

The transcriptomic side is the 10x excitatory neurons of GEO GSE319557 (Ext.h5ad in GSE319557_AIC_scRNA_h5ad.tar.gz, 24.7 GB), streamed until that member and read in memory. Its leiden clusters are numbered as the cell table's predictCluster. Per cluster, the mean log2(x + 1) UMI count of the 500 most variable genes (Methods, Variability analysis), selected as the Methods select them for the mapping ("The highly variable genes used here were selected using the same method as that in the previous publication", Transcriptomic mapping; aic.paper_gene_selection), with the file's dispersion ranking and the variance of log2(x + 1) as variants; the transcriptomic distance of a pair is 1 minus the Pearson r of those means; the tau distance is the absolute difference of the clusters' mean tau (Euclidean distance in one dimension), over the 12 clusters the claims file lists.

In [36]:
import itertools
t0 = time.time()
size = int(requests.head(aic.GEO_H5AD_TAR, timeout=60, allow_redirects=True).headers.get("Content-Length", 0))
print(f"GEO archive {aic.GEO_H5AD_TAR.split('/')[-1]}: {size / 1e9:.2f} GB")
buf, nread = aic.geo_member()
print(f"Streamed {aic.GEO_MEMBER} from GEO: {buf.getbuffer().nbytes / 1e9:.2f} GB, from {nread / 1e9:.2f} GB of the "
      f"compressed archive read, in {time.time() - t0:.0f} s")
gmeans, glabels, gn = aic.ext_cluster_means(buf)
print("Genes in each selection:", {k: len(v.columns) for k, v in gmeans.items()},
      "; shared with the dispersion genes:", {k: len(set(v.columns) & set(gmeans["dispersion"].columns)) for k, v in gmeans.items()})
del buf
print("10x clusters (leiden number, label, cells):")
table_labels = typed.drop_duplicates("predictCluster").set_index("predictCluster").predictCluster_label
table_labels.index = table_labels.index.astype(int)
print(pd.DataFrame({"10x label": glabels, "10x cells": gn, "cell table label": table_labels.reindex(glabels.index)}).to_string())
T7 = [0, 1, 2, 4, 5, 6, 8, 14, 15, 16, 17, 18]
ty = typed[typed.predictCluster.isin(T7)].drop_duplicates("trace_hash")
print("\nPatch-seq cells per cluster (distinct recordings):", ty.predictCluster.value_counts().sort_index().astype(int).to_dict())
rows = []
for genes, M in gmeans.items():
    C = np.corrcoef(M.loc[T7].values)
    rna = {(a, b): 1 - C[T7.index(a), T7.index(b)] for a, b in itertools.combinations(T7, 2)}
    for feat in ["tau_methods", "tau_code", "tau_sweep_median", "max_firing_rate"]:
        mt = ty.groupby("predictCluster")[feat].mean()
        x = np.array([abs(mt[a] - mt[b]) for a, b in rna])
        y = np.array(list(rna.values()))
        r, p = stats.pearsonr(x, y)
        rows.append({"genes": genes, "feature": feat, "pairs": len(x), "r": round(r, 3), "p": float(f"{p:.3g}")})
r7 = pd.DataFrame(rows)
print("\nPearson r of feature distance against transcriptomic distance over the cluster pairs (expected 0.53, tolerance 0.053):")
print(r7.to_string(index=False))
GEO archive GSE319557_AIC_scRNA_h5ad.tar.gz: 24.69 GB
Streamed AIC_scRNA_h5ad/Ext.h5ad from GEO: 3.43 GB, from 4.42 GB of the compressed archive read, in 73 s
Genes in each selection: {'dispersion': 500, 'variance': 500, 'paper': 500} ; shared with the dispersion genes: {'dispersion': 500, 'variance': 67, 'paper': 82}
10x clusters (leiden number, label, cells):
            10x label  10x cells   cell table label
0      Exc RORB SCN7A       3702     Exc RORB SCN7A
1     Exc HPCAL1 MEPE       3041    Exc HPCAL1 MEPE
2    Exc RORB CDK2AP1       1811   Exc RORB CDK2AP1
3     Exc FEZF2 RSPO3       1590    Exc FEZF2 RSPO3
4     Exc OPRK1 SMYD1       1575    Exc FEZF2 SMYD1
5    Exc HPCAL1 FREM3       1560   Exc HPCAL1 FREM3
6     Exc FEZF2 LTBP3        837    Exc FEZF2 LTBP3
7    Exc RORB CYP26B1       1310                NaN
8   Exc FEZF2 COL24A1       1155  Exc FEZF2 COL24A1
9    Exc FEZF2 DEPTOR       1107    Exc RORB DEPTOR
10    Exc FEZF2 HTR2C        976                NaN
11   Exc FEZF2 CHI3L1        747    Exc RORB CHI3L1
12    Exc HPCAL1 FRZB        319                NaN
13       Exc RORB FAP        475       Exc RORB FAP
14     Exc FEZF2 NRG1        387      Exc RORB NRG1
15    Exc HPCAL1 PENK        157    Exc HPCAL1 PENK
16     Exc FEZF2 DSG2         40     Exc FEZF2 DSG2
17   Exc HPCAL1 KANK4        200   Exc HPCAL1 KANK4
18     Exc FEZF2 MCUB        625     Exc FEZF2 MCUB
19     Exc RORB TRDN         119     Exc RORB TRDN 

Patch-seq cells per cluster (distinct recordings): {0.0: 7, 1.0: 4, 2.0: 11, 4.0: 5, 5.0: 16, 6.0: 32, 8.0: 25, 14.0: 42, 15.0: 10, 16.0: 32, 17.0: 9, 18.0: 38}

Pearson r of feature distance against transcriptomic distance over the cluster pairs (expected 0.53, tolerance 0.053):
     genes          feature  pairs      r       p
dispersion      tau_methods     66  0.105 0.39900
dispersion         tau_code     66  0.360 0.00295
dispersion tau_sweep_median     66  0.082 0.51200
dispersion  max_firing_rate     66  0.074 0.55600
  variance      tau_methods     66 -0.038 0.76200
  variance         tau_code     66  0.205 0.09910
  variance tau_sweep_median     66 -0.058 0.64400
  variance  max_firing_rate     66  0.003 0.98200
     paper      tau_methods     66  0.053 0.67400
     paper         tau_code     66  0.317 0.00959
     paper tau_sweep_median     66  0.031 0.80800
     paper  max_firing_rate     66  0.105 0.40200

Result: fig7c not reproduced. Over the 66 pairs of the 12 clusters, with the 500 genes of the Methods' selection, the Methods' tau distance correlates with the transcriptomic distance with r = 0.053 (p = 0.67), far from 0.53 and not significant. With the genes of highest dispersion r = 0.105 (p = 0.40), and with those of highest variance r = -0.04. With the code's first-sweep tau, a variant, r = 0.32 (p = 0.010) with the Methods' genes and 0.36 (p = 0.003) with dispersion, positive but outside the tolerance; with the median over sweeps r = -0.06 to 0.08. The maximal firing rate gives r = 0.00 to 0.11. Clusters 1 and 4 hold 4 and 5 Patch-seq cells, fewer than the five the criterion's rule asks, though its list includes them (a question for a reader).

Summary¶

Claim Outcome
patchseq-cell-table-link Reproduced
morph-table-link Reproduced
patchseq-sample Partially reproduced
patchseq-mapping Partially reproduced
fig2a-subclass-counts Partially reproduced
ven-map-et-ct Reproduced
fig6f-ven-subtype-mapping Partially reproduced
fig2d-l23it-small-tau Reproduced
fig2f-l23it-narrow-ap Partially reproduced
supp11-rm-itrorb-l6pc Partially reproduced
supp11-l5it-threshold-latency Reproduced
supp11-ven-broad-ap Partially reproduced
supp11-l5et-deep-sag Blocked: methods underspecified
ven-firing-rate-variability Not reproduced
l5et-vs-l5it-sag-rm-rate Partially reproduced
fig3e-phase-peak-index Blocked: methods underspecified
fig3d-saddle-phase-plane Blocked: methods underspecified
fig4ac-ven-broader-smaller-ap Blocked: data missing
fig4i-peak-index-ais-distance-real Blocked: methods underspecified
ext9cd-ven-subtypes-ap Blocked: data missing
supp8-ven-subtypes-similar-features Blocked: data missing
supp9-venl-more-distinct-from-ct Reproduced
morph-more-distinct-than-ephys Reproduced
fig7c-tau-rna-distance Not reproduced
nine elsewhere claims Blocked: other

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

How the analysis differs from the paper's. The features are computed from the deposited traces with the Methods' definitions and PatchAnaLab's details, not taken from the paper's feature table; they match it closely for the AP measures (about 97% of cells within 10%), rheobase, latency and the first-sweep tau. The Methods' tau (averaged over all hyperpolarizing sweeps) is about 26% longer than the table's, which holds the code's first-sweep tau. Of the claims file's FDR family (39 features), 19 features are defined nowhere in the paper or its package; their values are taken from the paper's feature table, as an assumption. The phase peak index is read automatically, where the paper clicked the peaks by hand; it agrees with the hand-read values only loosely, and the hand-read values give the paper's results for Fig. 3e and 4i where the automatic ones give them in part or not at all, and these claims are blocked. Groups come from the cell table, which differs from the paper's feature table for two cells. The transcriptomic distances use the 500 genes that the Methods' gene selection picks in the 10x data, with two other rankings as variants. No outcome rests on these two choices: the variants give the same outcomes. Two outcomes rest on assumptions: the cell table link (its row 235 read as the row of s172) and l5et-vs-l5it-sag-rm-rate (the outcome common to both sag readings, where the criterion gives no rule for their disagreement).

Changed after the third verification round: fig3e-phase-peak-index, fig3d-saddle-phase-plane and fig4i-peak-index-ais-distance-real are blocked (methods underspecified). The shoulder branch of the automatic index, which reads most first APs, puts the AIS value next to the SD peak for a slow-rising AP at the noise level of the Axon files, so the index does not measure the saddle shape, and the outcome changes with the prominence guard. The criterion fixes the automatic reading, so this block goes beyond its letter, and a reader should confirm it. Half-width and tau differ between the two amplifiers' files in every group, in the computed values and in the paper's table, and the groups are unevenly spread over them; the narrow APs and short tau of L2/3 IT HPCAL1 are not significant within either device.

What was found about the dataset. The files hold the Patch-seq electrophysiology and no cell types, transcriptomic types or VEN subtypes, which come only from the paper's code repository. Five pairs of files hold identical recordings under different cell IDs, four of them under different subjects. The cell table names one file twice and omits another (s172). The archive lists 10 subjects, where the paper used 12. Every session start time is the same placeholder, some session IDs carry another subject's date, the stimulus unit is stated as amperes for values in pA, the stimulus series have no starting time, and five files have a device name that does not fit their sampling rate. The device follows the recording year, not the RNA status, where the Methods put the Patch-seq recordings on the HEKA amplifier. The additional recordings of Fig. 4a-c and Extended Data Fig. 9c,d are not in the dandiset.

In [37]:
print(f"Notebook run time: {(time.time() - started) / 60:.1f} min")
Notebook run time: 4.9 min