Oligodendrocyte Precursor Cells Sculpt the Visual System by Regulating Axonal Remodeling [protocols and analysis code]
Stytra stimuli and analysis scripts of Python-based analyses for the publication Oligodendrocyte Precursor Cells Sculpt the Visual System by Regulating Axonal Remodeling, Xiao et al, 2022. The code has ben run using python==3.8.10
.
This repo is designed to make the full Python-based analysis presented in the paper fully reproducible. Automatic testing and sample data are provided to ensure the workflow can run. The complete dataset for replicating all the paper plots(~9 GB) can be found here.
The repo contains the following module:
xiao_et_al_utils
a pip-installable module with the utility functions required by the scripts and the definition of the analysis parameters, together with the folders with the Stytra
And the following script folders:
stytra_protocols
: Stytra scripts used for running the freely swimming, omr and imaging experimentsbehavior_analysis
: scripts for running the analysis of the freely swimming experiments and the OMR experimentsot_imaging_analysis
: scripts for running the analysis of the imaging experiments
The following experiment scripts were used to run experiments with stytra==0.8.26
:
trackingfish_nostim_exp.py
: script for running the no stimulation, freely swimming larvae experiments reported in Fig.S6OMR_visual_acuity_random_grating_distance.py
: script for running the curve of contrast for the OMR response in embedded fish reported in Fig.3 and Fig.S6E0070_v04_flashing_rad_simple.py
: script used for running under the lightsheet microscope the receptive field estimation experiments reported in Fig.3
freely_swimming_analysis.py
: script for analyzing the no stimulation, freely swimming larvae experiments reported in Fig.S6omr_analysis.py
: script for analyzing the curve of contrast for the OMR response in embedded fish reported in Fig.3 and Fig.S6
Code for replicating the analysis of the functional imaging dataset can be found in the ot_imaging_analysis
folder.
- the numbered files
00_fishwise_scores.py
,01_pool_all_fish_data.py
,02_fit_rf_gauss.py
contain the preprocessing scripts that compute cell responses strengths, aggregate data, and do the receptive field fit - the
fig_[n]_[description].py
files contain the code that generate each of the panels of the paper that pertain to the imaging experiments.
There is an additional file, run_suite2p.py
, that was used to align the imaging, segment the ROI and extract their fluorescence traces using suite2p==0.7.2
. Since the raw imaging data is too big to be shared, only the results of this script are shared to reproduce the paper figures, and the script is kept here only to log the parameters used with the suite2p
algorithm.
Below are the instructions to reproduce all the Python analysis of the paper.
Download data and clone repo:
- Download the data from here
- Uncompress locally the folder
- From the terminal, clone the
xiao_et_al
repo on your computer:> git clone https://github.com/portugueslab/xiao_et_al
cd
to the package location:> cd xiao_et_al
- [Optional] Create a new environment to run the script:
> conda create -n xiaotest python==3.8.10 > conda activate xiaotest
- and install it in editable mode:
> pip install -e .
- Find you local param_conf.ini file in the repo, and change it to set the argument for data location to point to the location of the downloaded data folder. E.g.
data_path=C:\Users\...\xiao_et_al_dataset
- for the freely swimming analysis, run
> python /.../xiao_et_al/behavior_analysis/freely_swimming_analysis.py
- for the OMR analysis, run
> python /.../xiao_et_al/behavior_analysis/omr_analysis.py
- frun in order the batch processing scripts (they can take up to several tens of minutes to run):
> python /.../xiao_et_al/ot_imaging_analysis/00_fishwise_scores.py
(extract responses for every fish),> python /.../xiao_et_al/ot_imaging_analysis/01_pool_all_fish_data.py
(assemble pooled dataframe with data from all fish)> python /.../xiao_et_al/ot_imaging_analysis/02_fit_rf_gauss.py
(gaussian fit)
- At this point, running any of the figure generation scripts
fig_[figN]_[descritpion].py
will save in the figure saving location the panelfigN
from the paper.
The paper figures can also be all generated in the data folder running pytest
in the repo after having installed the [dev]
dependencies:
> pip install -e .[dev]
> pytest
Code have been developed in macOS
. Tests run on Unix
in GitHub Actions, and the workflow has been tested on a Windows
machine.