Combined statistical-biophysical modeling links ion channel genes to physiology of cortical neuron types
Yves Bernaerts, Michael Deistler, Pedro J. Gonçalves, Jonas Beck, Marcel Stimberg, Federico Scala, Andreas S. Tolias, Jakob Macke, Dmitry Kobak & Philipp Berens. (2023)
This repository contains the analysis code and the preprocessed data for the above manuscript.
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/
.
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.
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).
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).
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.
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.
Run ./code/without_rSS/build_simulations.ipynb
to produce Hodgkin-Huxley model simulations without the
Run ./figures/figure_x.ipynb
to produce Figure x in the manuscript.
Install the following dependencies before you run the notebook.
pip install -r requirements.txt