This software package identifies firing rate modulation between two conditions. It was used for:
Effects of visual inputs on neural dynamics for coding of location and running speed in medial entorhinal cortex by Holger Dannenberg, Hallie Lazaro, Pranav Nambiar, Alec Hoyland, and Michael E. Hasselmo (2020, in review at eLife).
https://www.biorxiv.org/content/10.1101/2020.04.06.027466v1
A mouse freely explores a 1-meter-square arena in conditions of normal light and total darkness. Neural recordings are taken and the start and stop times of the light/dark epochs are also recorded.
Statistically and graphically analyze whether cells are modulated by illumination condition.
This package assumes that the data exist as CMBHOME.Session
objects
(see CMBHOME).
Here, we use the RatCatcher framework
to process the data.
- Download this repository.
- Download RatCatcher.
- Download CMBHOME.
- Download mtools.
- Add them to your MATLAB path.
This analysis is split into two steps.
In the first step, cells are identified which are responsive to illumination level (that is, they are modulated by light). This is determined by comparing the mean firing rate between epochs for adjacent light/dark epoch pairs. Statistical significance is determined using paired t-tests.
In the second step, the resultant data set from the first step is filtered for significance by p-value and for direction of modulation. Positively-modulated cells are defined as cells which fire statistically significantly more frequently on average in dark conditions. Negatively-modulated cells are defined as cells which fire statistically significantly more frequently on average in light conditions. Paired light/dark epochs are concatenated and spike times are binned. Since the epochs may be of varying length, spike count vectors are NaN-padded.
The analysis can be performed light-epoch first (LightDark) and dark-epoch first (DarkLight).
In the first step, cells are identified which are modulated by illumination level.
The following steps are recorded in
light-dark/scripts/runHolgerDataFirstPass.m
.
Decide on the correct protocol (light-epoch first or dark-epoch first).
Then create the RatCatcher
object r
.
protocol = 'LightDark';
% protocol = 'DarkLight';
r = getFirstPassRatCatcher(protocol);
Check the RatCatcher
object to make sure that it is what you want.
The getFirstPassRatCatcher
function has hardcoded paths and other shortcuts
(it assumes that your high-performance computing cluster is mounted at a certain location, etc.).
Then, generate the cluster files:
r = r.batchify();
and submit the jobs to the cluster, e.g. using qsub
.
See here for an example.
Once the cluster jobs have run, you can gather them normally,
data_table = r.gather();
data_table = r.stitch(data_table);
and save them normally.
The second-pass identifies modulated cells by p-value and modulation type and then collects binned spike times over all epochs in a NaN-padded matrix and over all cells in a table.
The following steps are recorded in
light-dark/scripts/runHolgerDataSecondPass.m
.
The workflow for the second-pass is much like the first.
For convenience, filtering of the data table has been written into several utility functions.
You can use getSecondPassRatCatcher
to set up a RatCatcher
object
and include analysis over only cells which exhibit statistically significant modulation.
Four options are built-in:
- p = 0.01, modulation = positive
- p = 0.05, modulation = positive
- p = 0.01, modulation = negative
- p = 0.05, modulation = negative
protocol = 'LightDark'; % or 'DarkLight';
r = getSecondPassRatCatcher(protocol, this_index);
Then, batch the jobs
r = r.batchify();
and submit the jobs to the cluster, e.g. using qsub
.
See here for an example.
The jobs cannot be gathered normally. Instead, use the following syntax:
data_table = LightDark2.gather(r);
data_table = r.stitch(data_table);
Working with NaN-padded matrices takes special care as NaNs have a tendency to pollute computations.
For a single cell,
you can use the averageOverNaNs
function
to get the mean and standard deviation,
accounting for the varying durations of epochs.
[vec_mean, vec_std] = averageOverNaNs(padded_spike_counts);
To average over an entire population of cells,
use the averageOverEpochsCells
function.
Since cells can have differing basal firing rates,
each cell's binned spike count averaged over epochs is z-scored first.
[zscored_spike_counts, zscored_timestamps] = averageOverEpochsCells(data_table, bin_size)
The script
light-dark/scripts/make_figures.m
includes code for sample plots.
Optogenetic modulation works exactly the same was as the light/dark modulation.
The scripts and classes are contained within laser-control/
.