Danylo Lavrentovich de Bivort Lab 2022
Computational model of the Drosophila antennal lobe (AL) for Neural correlates of individual odor preference in Drosophila.
This GitHub repository contains Jupyter notebooks and Python scripts for setting up, running, and analyzing a leaky-integrate-and-fire model of 3,062 Drosophila olfactory receptor neurons (ORNs), local neurons (LNs), and projection neurons (PNs). Neurons and connections between them are retrieved from the hemibrain Python API. Odors are presented to the simulated AL by activating ORNs using DoOR, a database of glomerulus - odor responses. The model is used to study how circuit variation is linked to physiological variation in PN odor responses that is relevant to olfactory preference behavior. A complete repository, with added data files too large for sharing via GitHub, is also available at the first link.
A brief walkthrough of the directories in this repository:
utilities/ contains helpful auxiliary functions used in setting up, running, and plotting outputs of AL circuit models
run_model/ contains shell and Python scripts for running circuits or batches of circuits, either manually or using a computing cluster. See next section for more details
analysis/ contains Jupyter notebooks used for selecting a model from a parameter sweep, plotting model outputs, and performing PCA on odor responses of simulated flies to compare to PCA on calcium responses in real flies
sensitivity_analysis/ contains a Jupyter notebook and Python scripts used to perform a sensitivity analysis around the cell-type specific sensitivity parameters
odor_imputation/ contains Jupyter notebooks/MATLAB scripts for imputing missing glomerulus-odor responses for odors used to calibrate and run the model
datasets/ contains downloaded literature files for model tuning and evaluation
connectomics/ contains a Jupyter notebook that retrieves AL neurons from the hemibrain Python API and sets the list of neurons / synapses used in the model
Quick AL simulation demo:
run_model/run_example_simulation.ipynb
is a Jupyter notebook that includes a short antennal lobe simulation, running in less than a minute, featuring key circuit execution code and visualizations. You can use this demo to compare model outputs on your end before starting longer simulations
More detailed instructions for AL simulations:
run_model/export_resampling_sim_settings.py
is the key file for setting up a model before it is run. Edit this file directly to set desired parameters, such as the names + durations of odor stimuli, the cell populations to bootstrap, which LNs to set as excitatory, etc.- Once you are done adding desired model settings, be sure to edit the
run_tag
string inrun_model/export_resampling_sim_settings.py
to set the name of a new directory that will 1) store the input parameters for the desired model and 2) be where the model is actually run. Executepython run_model/export_resampling_sim_settings.py
to create that new directory with the name set inrun_tag
- The created model directory will contain a Python pickled dictionary,
sim_params_seed.p
, that contains the input parameters of the model - The created model directory will also contain a Python script,
run_sim.py
. If you navigate to the created model directory and runpython run_sim.py
, this script integrates the leaky-integrate-and-fire equations and runs the model based on the input parameters set insim_params_seed.p
run_sim.py
is a Python script that is a copy ofrun_model/run_sim_template.py
. This template script is not meant to be heavily editable for individual jobs. Rather, once a copy of this template is in a model directory with input parameters defined insim_params_seed.p
, this script reads in those input parameters, loads them into an instance of theSim
class (defined inutils/simulation_class.py
), then usesrun_LIF
to run the model and saves model outputs such as the spike times, voltage traces, firing rates, etc.
- To replace manually running Python scripts, you can run
run_model/autolaunchsim.sh
to perform all of the above steps (executeexport_resampling_sim_settings.py
to create a new model directory with input parameters and executerun_sim.py
within that new directory to run the model and save outputs) - If you are on a research computing cluster, instead of executing
python run_sim.py
within the model directory, you can submit it as a job by executing./submit_job.sh
. Similar torun_sim.py
,submit_job.sh
is a copy ofrun_model/submit_to_cluster_template.sh
that is outputted byrun_model/export_resampling_sim_settings.py
- For running a series of jobs, for instance when doing multiple cell-type bootstraps, a script like
run_model/launch_resamples.sh
will feed desired input arguments intoexport_resampling_sim_settings.py
, run it, navigate to the created directory, and run the model on a computing cluster viasubmit_job.sh
This software has been tested on Windows 10 and Linux CentOS 7.9.2009.
Python 3.6 was used for all Jupyter notebooks and Python scripts. You can install the Anaconda environment used for the project using alvar.yml
in this repository (takes about 10 minutes to fully download):
conda env create -f alvar.yml