Skip to content

berenslab/CBC_inference

Repository files navigation

Information

This is the code for the paper "Bayesian inference for biophysical neuron models enables stimulus optimization for retinal neuroprosthetics" by Oesterle et al. 2020 (DOI: 10.7554/eLife.54997).

This repo can be used to reproduce the data and figures shown in the paper. It also provides a python wrapper for some of the NeuronC functionality.

Code-structure

While the core python code can be found here, the experiments performed in the paper are described in jupyter notebooks (see below). The experiments' code is structured similar to the paper. Since most experiments depend on the previous steps, they should be run in order. However, the data can also be loaded from zenodo, which allows to skip experiments or single (time-consuming) steps in single experiments. Either way you have to download the data to get full functionality.

Setup

Download this repo and install the requirements. You may not have to install the specified package versions.
Execute the makefile in NeuronC and in Retsim to compile NeuronC and Retsim.
In addition, if you want to generate rendered cell images, you need to install povray.
Follow the experiments in the indicated order, starting with the download of the data.

Experiments

The experiments are ordered as follows:

After running the experiments or downloading the data, you can generate the figures and the animations animations.

NeuronC

The NeuronC [1] version (6.3.14) used here was downloaded from http://retina.anatomy.upenn.edu/~rob/neuronc.html and used with minor modifications.

Electrical stimulation

The simulation of the electrical stimulation in the paper uses the software COMSOL Multiphysics. The notebooks clearely indicate when a step requires COMSOL. If you don't have access to COMSOL, you can skip these steps and use the precomputed data.

Stimulus optimization

To optimize the stimuli we created a pipeline such that COMSOL can be run on a machine where it is installed, while SNPE and NeuronC can be run on a different machine. For this we created two directories COMSOL2retsim_COMSOL and COMSOL2retsim_interface. The former should be moved to a computer that can run both COMSOL and jupyter notebooks. The notebook run on this computer will communicate with COMSOL and save the COMSOL output to the COMSOL2retsim_interface, i.e. it needs read and write permission. Then you can run step4_optimize_stimulus.ipynb on the second machine, that also needs read and write permission for COMSOL2retsim_interface. It will load the COMSOL output, use it to run SNPE and NeuronC, and tell the other notebook when and how to create new COMSOL outputs.

Similarily, this can be done for the optimization of the electrical parameters of the retina.

References

[1] Smith, Robert G. (1992). NeuronC: a computational language for investigating functional architecture of neural circuits. J. Neurosci. Methods 43: 83-108.