Computational Approach for the Reliable Inference of Task States Encoded by Neurons Using Calcium Imaging
- 1Department of Psychological and Brain Sciences, Johns Hopkins University, Baltimore, MD, USA
- 2The Solomon H. Snyder Department of Neuroscience, Johns Hopkins School of Medicine, Baltimore, MD, USA
- 3Kavli Neuroscience Discovery Institute, Johns Hopkins University, Baltimore, MD, USA
Abstract
Calcium imaging has become a widely used technique for measuring the activity of identified neurons during behavior. A key goal in such investigations is to determine whether, and to what extent, neurons preferentially encode one task-relevant state over another—a property referred to as neuronal selectivity. Despite the widespread use of calcium imaging for this purpose, no consensus exists on the parameter choices required to assess neuronal selectivity reliably: choices regarding neural data representation, behavioral position tracking, temporal binning, data balancing, and statistical shuffling all vary substantially across published studies. We recently developed a systematic computational approach to address this gap. Here, we describe the step-by-step protocol for implementing this computational pipeline. Starting from preprocessed calcium imaging data, the protocol guides users through all stages of the analysis: loading and aligning neural and behavioral data, deriving four metrics of neural activity, computing a selectivity index (SI), generating null distributions using four shuffling strategies, and assigning selectivity labels to individual neurons. The protocol introduces a principled, data-driven framework for evaluating the quality of any combination of parameter choices using quantitative metrics of accuracy and robustness and for identifying the optimal combination. The framework is validated using bootstrap resampling and hold-out cross-validation, and its generality is demonstrated by application to a different, regression-based approach for assessing selectivity of individual neurons. Finally, we describe the natural extension of this framework to inferences about task states encoded by populations of neurons. Thus, our protocol provides a reusable, extensible approach to identify optimal parameter settings for reliably characterizing neural encoding of two discrete task states.
Key features
• Provides a step-by-step computational pipeline for assessing the selectivity of neurons to task states from calcium imaging data.
• Introduces quantitative accuracy and robustness metrics for objectively evaluating and comparing the quality of any combination of analysis parameter choices.
• Validates the optimal parameter choices in terms of reliability, generalizability, and generality using bootstrap resampling, hold-out cross-validation, and a regression-based (GLM) approach, respectively.
• Provides modular, well-documented MATLAB code covering all pipeline stages, enabling adaptation to different cell types, brain areas, calcium indicators, two-state task designs, and ensembles.
Related
- Macrophage calcium signaling dynamics revealed using genetically-encoded sensors
- Clustered inputs engage dendritic nonlinearities and calcium signaling to support efficient place-field formation in CA1 pyramidal neurons
- A versatile set of computational tools for inference of genetic ancestry from human molecular data
- Reliable detection and continuous monitoring of memory dysfunction in mild cognitive impairment and healthy aging through adaptive computational phenotyping
- A neuro-inspired computational framework for AGI: predictive coding, active inference and free energy minimisation.
BibTeX
@article{huang2026computational,
title = {{Computational Approach for the Reliable Inference of Task States Encoded by Neurons Using Calcium Imaging}},
author = {Huixin Huang and Hita Adwanikar and Shreesh P. Mysore},
journal = {Bio-protocol},
year = {2026},
month = nov,
doi = {10.21769/bioprotoc.5867},
url = {https://doi.org/10.21769/bioprotoc.5867},
note = {CC BY-NC 4.0},
}
RIS
TY - JOUR
TI - Computational Approach for the Reliable Inference of Task States Encoded by Neurons Using Calcium Imaging
AU - Huixin Huang
AU - Hita Adwanikar
AU - Shreesh P. Mysore
PY - 2026
DA - 2026/11/05
JO - Bio-protocol
DO - 10.21769/bioprotoc.5867
UR - https://doi.org/10.21769/bioprotoc.5867
AB - Calcium imaging has become a widely used technique for measuring the activity of identified neurons during behavior. A key goal in such investigations is to determine whether, and to what extent, neurons preferentially encode one task-relevant state over another—a property referred to as neuronal selectivity. Despite the widespread use of calcium imaging for this purpose, no consensus exists on the parameter choices required to assess neuronal selectivity reliably: choices regarding neural data representation, behavioral position tracking, temporal binning, data balancing, and statistical shuffling all vary substantially across published studies. We recently developed a systematic computational approach to address this gap. Here, we describe the step-by-step protocol for implementing this computational pipeline. Starting from preprocessed calcium imaging data, the protocol guides users through all stages of the analysis: loading and aligning neural and behavioral data, deriving four metrics of neural activity, computing a selectivity index (SI), generating null distributions using four shuffling strategies, and assigning selectivity labels to individual neurons. The protocol introduces a principled, data-driven framework for evaluating the quality of any combination of parameter choices using quantitative metrics of accuracy and robustness and for identifying the optimal combination. The framework is validated using bootstrap resampling and hold-out cross-validation, and its generality is demonstrated by application to a different, regression-based approach for assessing selectivity of individual neurons. Finally, we describe the natural extension of this framework to inferences about task states encoded by populations of neurons. Thus, our protocol provides a reusable, extensible approach to identify optimal parameter settings for reliably characterizing neural encoding of two discrete task states. Key features • Provides a step-by-step computational pipeline for assessing the selectivity of neurons to task states from calcium imaging data. • Introduces quantitative accuracy and robustness metrics for objectively evaluating and comparing the quality of any combination of analysis parameter choices. • Validates the optimal parameter choices in terms of reliability, generalizability, and generality using bootstrap resampling, hold-out cross-validation, and a regression-based (GLM) approach, respectively. • Provides modular, well-documented MATLAB code covering all pipeline stages, enabling adaptation to different cell types, brain areas, calcium indicators, two-state task designs, and ensembles.
SN - 2331-8325
ER -