https://github.com/berenslab/hh_sbi
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: sciencedirect.com, nature.com, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.6%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: berenslab
- License: gpl-3.0
- Language: Jupyter Notebook
- Default Branch: master
- Size: 211 MB
Statistics
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Combined statistical-biophysical modeling links ion channel genes to physiology of cortical neuron types

Yves Bernaerts, Michael Deistler, Pedro J. Gonalves, Jonas Beck, Marcel Stimberg, Federico Scala, Andreas S. Tolias, Jakob Macke, Dmitry Kobak & Philipp Berens. (2025)
This repository contains all the code for the (pre)processing and analysis of data as well as the production of figures in this manuscript.
Raw data
Raw electrophysiological recordings can be publicly downloaded here corresponding to a study published in Nature. Instructions on how to do so with dandi are also found there. Make sure you download the data in ./data/raw_data.
You will also need SmartSeq_cells_AIBS.pickle in ./data/ that can be downloaded from here.
Unzip file code/save_model_parameters/favourite_training_schedule.zip and put it in the same folder as favourite_training_schedule.pickle.
You can also download our synthetic data sets full_batch.npz, best_1000_Euclidean_sims.npz and full_batch_without_rSS.npz from here with which we built amortized posteriors and produced main and supplementary figures, in case you do not intend to run simulations on your infrastructure. Please put full_batch.npz and best_1000_Euclidean_sims.npz in code/save_sims/M1_chunks/ and full_batch_without_rSS.npz in code/without_rSS/save_sims/M1_chunks/.
The rest of the (preprocessed) data can be found in ./data/.
Analysis and figures
1. Preprocess data
Run ./code/preprocess.ipynb (optionally) to automatically extract summary statistics of the raw electrophysiological recordings. Results can be found in ./code/pickles/M1_features.pickle. Inspired by work found here and here.
2. Build simulations
Run ./code/build_simulations.ipynb to produce Hodgkin-Huxley-based model simulations with the simulation package Brian2 (see Requirements). We also used the parallel processing package pathos (see Requirements) that you can use if your station has multiple cpu's available. You can also set the amount of cpu's and turn off parallel processing manually (intuitively in the notebook).
3. Build amortized posteriors with neural posterior estimation
Run ./code/build_amortized_posteriors.ipynb to produce amortized posteriors set up with different training schedules. Two of the posteriors will be NPE and NPE-N discussed in the mansucript. We use the simulator-based inference package sbi (see Requirements).
4. Report performance
Run ./code/report_performances.ipynb to compare the closeness of model simulations, especially based on maximum a posteriori estimates derived from the different posteriors, to experimental observations.
5. Deploy sparse reduced-rank regression and sparse bottleneck neural networks
Run ./code/deploy_sRRR_and_sBNN/cross-validation.ipynb to run linear and nonlinear regression analyses that predict maximum a posteriori estimates from NPE-N, i.e. fitted Hodgkin-Huxley model parameters, from gene expression levels. This work is inspired by code found here and here.
7. Model without scaling $r_{SS}$ parameter
Run ./code/without_rSS/build_simulations.ipynb to produce Hodgkin-Huxley model simulations without the $r_{SS}$ parameter.
8. Figures
Run ./figures/figure_x.ipynb to produce Figure x in the manuscript.
Usage
Install the following dependencies before you run the notebook.
pip install -r requirements.txt
Update (2025)
The entire pipeline has been tested on mouse visual cortex data too from this study. See the manuscript and code for details. Figures can be reproduced in ./figures/V1/*.ipynb notebooks.
Contact
Lead contact: philipp.berens@uni-tuebingen.de
First author: yves.bernaerts@research.fchampalimaud.org
Owner
- Name: Berens Lab @ University of Tübingen
- Login: berenslab
- Kind: organization
- Email: philipp.berens@uni-tuebingen.de
- Location: Tübingen, Germany
- Website: https://hertie.ai/data-science
- Repositories: 60
- Profile: https://github.com/berenslab
Department of Data Science at the Hertie Institute for AI in Brain Health, University of Tübingen
GitHub Events
Total
- Release event: 1
- Watch event: 1
- Push event: 56
- Create event: 1
Last Year
- Release event: 1
- Watch event: 1
- Push event: 56
- Create event: 1
Dependencies
- brian2 ==2.6.0
- dandi *
- glmnet_py *
- ipywidgets *
- jupyter *
- jupyter-black *
- matplotlib *
- numpy *
- opentsne ==1.0.2
- pandas *
- pathos ==0.2.8
- pynwb ==2.8.3
- sbi ==0.22.0
- scikit-learn *
- seaborn *
- watermark *