This repository contains the code for the paper "Functional connectomics reveals general wiring rule in mouse visual cortex".
https://doi.org/10.1038/s41586-025-08840-3.
You can set up this project in several ways:
The easiest way to get started is to use our pre-built Docker container which includes all required dependencies.
- Docker
- Docker Compose (included in Docker Desktop for Mac/Windows)
-
Clone the repository:
git clone https://github.com/cajal/microns-funconn-2025.git cd microns-funconn-2025 -
Start the Docker container:
./run-docker-container.sh
-
Access Jupyter Lab: Open your browser and navigate to
http://localhost:8888Note: It may take a few seconds for the content to become accessible.
- Python 3.8 or higher
- R 4.0.0 or higher (for statistical analysis)
-
Clone the repository:
git clone https://github.com/cajal/microns-funconn-2025.git cd microns-funconn-2025 -
Install the package and its Python dependencies:
# Install in development mode pip install -e .
-
Install required R packages:
# Run the R package setup script Rscript setup_r_packages.RThis script will install the following R packages:
- glmmTMB
- tidyverse
- broom.mixed
- emmeans
- performance
- DHARMa
The intermediate results files are already included in the results folder. Notebooks to load these files and reproduce the figures in the paper are under the figures folder.
- Navigate to the
figuresdirectory - Run the Jupyter notebooks:
like2like.ipynb- Figures related to the like-to-like connectivity analysiscommon_input.ipynb- Figures related to the common input analysis
To reproduce the intermediate results, you can run the following scripts:
funconnect/compute/like2like.py- Script to generate the like-to-like connectivity analysis resultsfunconnect/compute/common_inputs.py- Script to generate the common input analysis results
To run the scripts, open a terminal inside the ./funconnect/compute/ directory and run:
python3 ./common_inputs.py
python3 ./like2like.pyIntermediate results are stored in funconnect/results and should match the results in the results folder.
To access the datasets analyzed in this study, please see the data availability section of the manuscript.
They are also downloaded inside the Docker container at /data.
If you find this repository useful, please cite using this BibTeX:
@article{ding2025functional,
title={Functional connectomics reveals general wiring rule in mouse visual cortex},
author={Ding, Zhuokun and Fahey, Paul G and Papadopoulos, Stelios and Wang, Eric Y and Celii, Brendan and Papadopoulos, Christos and Chang, Andersen and Kunin, Alexander B and Tran, Dat and Fu, Jiakun and others},
journal={Nature},
volume={640},
number={8058},
pages={459--469},
year={2025},
publisher={Nature Publishing Group UK London}
}