Code Monkey home page Code Monkey logo

hh_sbi's Introduction

Hybrid statistical-mechanistic modeling links ion channel genes to physiology of cortical neuron types

NPE_vs_NPE-N

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 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 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. Otherwise one can change the number of available resources by changing the

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

hh_sbi's People

Contributors

ybernaerts avatar huangziwei avatar jnsbck avatar

Stargazers

Paul Pfeiffer avatar

Watchers

Philipp Berens avatar  avatar pedro goncalves avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.