\documentclass{article}
\usepackage{fullpage}
\usepackage{parskip}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\usepackage[natbibapa]{apacite}
\usepackage{eso-pic}
\AddToShipoutPictureBG{\AtPageLowerLeft{\includegraphics[scale=0.7]{powered-by-Authorea-watermark.png}}}
\renewenvironment{abstract}
{{\bfseries\noindent{\abstractname}\par\nobreak}\footnotesize}
{\bigskip}
\titlespacing{\section}{0pt}{*3}{*1}
\titlespacing{\subsection}{0pt}{*2}{*0.5}
\titlespacing{\subsubsection}{0pt}{*1.5}{0pt}
\usepackage{authblk}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage{latexsym}
\usepackage{textcomp}
\usepackage{longtable}
\usepackage{tabulary}
\usepackage{booktabs,array,multirow}
\usepackage{amsfonts,amsmath,amssymb}
\providecommand\citet{\cite}
\providecommand\citep{\cite}
\providecommand\citealt{\cite}
% You can conditionalize code for latexml or normal latex using this.
\newif\iflatexml\latexmlfalse
\AtBeginDocument{\DeclareGraphicsExtensions{.pdf,.PDF,.eps,.EPS,.png,.PNG,.tif,.TIF,.jpg,.JPG,.jpeg,.JPEG}}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{natbib}
\bibliographystyle{plainnat}
\DeclareMathOperator{\corr}{corr}
\DeclareMathOperator{\sig}{sig}
\DeclareMathOperator{\len}{len}
\begin{document}
\title{Supplementary Materials}
\author[ ]{eva pastalkova}
\author[ ]{zjroth}
\affil[ ]{}
\vspace{-1em}
\date{}
\begingroup
\let\center\flushleft
\let\endcenter\endflushleft
\maketitle
\endgroup
\section{Order of supplementary
materials}\label{order-of-supplementary-materials}
\begin{itemize}
\tightlist
\item
Materials and Methods
\item
Tables
\item
Figures
\item
References
\item
Movies
\end{itemize}
\section{Methods}
All procedures were approved by the Janelia Farm Research Campus Institutional Animal Care and Use Committee. All data used in this study were previously used in Wang et al., 2015. All experimental procedures were described in detail in Wang et al., 2015. Here we describe data analysis methods specific for this work. No statistical methods were used to predetermine sample sizes, but our sample sizes are similar to those reported in previous publications. We used non-parametric statistical methods to reduce the effect of the small sample size.
\subsection{Sequence detection}
A sequence was defined to be the spike train generated by a collection of neurons within a time window. We used the spikes of all pyramidal cells that were identified during spike sorting. For this analysis, we had three main sequence types: arm-run sequences, wheel-run sequences, and SPW sequences.
An arm-run sequence contains all of the neuronal spiking that occurred while an animal was traveling between the running wheel and the opposite end of a maze arm. The start (resp., end) time of an arm run was determined to be the moment when the animal crossed into (resp., out of) the arm. Similarly, a wheel-run sequence contains all of the neuronal spiking that occurred while an animal's was running in the wheel. The specific start and end times of a wheel run were determined by thresholding the wheel's angular speed. A wheel run was only considered if its duration was long enough (approximately 8--12 seconds) to open the mechanical doors separating the delay area from the track's arms.
SPW events were identified in the local-field potential (LFP) based on their signature shape: positive-going wave in the deep CA1 pyramidal layer and negative-going wave in the superficial CA1 pyramidal layer (Fig.~1B). Specifically, we subtracted the raw LFP traces from the deep and superficial parts of the CA1 layer. Then we calculated the average LFP in a 0.5 sec time window around each time point and subtracted the running average from the signal. We smoothed the resulting signal with a Gaussian kernel (SD = 5ms) and computed z-score. We detected individual SPW events by tresholding the smoothed signal at 4 SD, and we detected the start and the end time point of each event by thresholding at 1.25 SD. Finally, we extended the start and end times of each detected event in case the mean firing rate of the multiunit activity was above 70Hz. All SPW events that were shorter than 25 ms or longer than 250 ms were excluded. All SPW events with fewer than 5 active neurons were also excluded.
\subsection{Correlation of spiking sequences}
For any two neurons $i$ and $j$ that spike within a sequence $\mathbf{s}$, the \textit{firing bias} $b_{ij}(\mathbf{s})$ is a recentered, rescaled probability that captures the tendency for neuron $i$ to fire before neuron $j$ within the sequence $\mathbf{s}$. Let $c_{ij}(\mathbf{s})$ be the count of times that any spike of $i$ occurs before any spike of $j$ in $\mathbf{s}$:
\begin{align*}
c_{ij}(\mathbf{s})
&= |\{(t_i, t_j) \in T_{s}^{(i)} \times T_{s}^{(j)} : t_i < t_j\}| \\
&= \sum_{t_i \in T_{s}^{(i)}} \sum_{t_i < t_j \in T_{s}^{(j)}} 1,
\end{align*}
where $T_{\mathbf{s}}^{(k)} \subseteq \mathbb{R}$ is the set of firing times of neuron $k$ in sequence $\mathbf{s}$. Note that $c_{ij}(\mathbf{s}) = 0$ if either neuron $i$ or $j$ did not fire in sequence $\mathbf{s}$. The count $c_{ij}(\mathbf{s})$ can also be computed as the cross-correlation between spike trains. For any finite set $F \subseteq \mathbb{R}$ of firing times, define $\chi_F(t) = \sum_{f \in F} \delta(t - f)$ to be spike train represented by $F$, where $\delta(t) = \begin{cases} +\infty, & t = 0; \\ 0, & t \neq 0; \end{cases}$ is the Dirac delta function. For finite sets $F_1, F_2 \subseteq \mathbb{R}$ of firing times, we define the function $F_1 \star F_2$ to be the cross-correlation function $(F_1 \star F_2)(\tau) = \int_{-\infty}^{\infty} \chi_{F_1}(t) \chi_{F_2}(t + \tau)\; dt$. With these definitions, $c_{ij}(\mathbf{s}) = \int_0^\infty [T_{\mathbf{s}}^{(i)} \star T_{\mathbf{s}}^{(j)}](\tau)\; d\tau$. The firing bias $b_{ij}(\mathbf{s})$ was then computed as \[ b_{ij}(\mathbf{s}) = \frac{c_{ij}(\mathbf{s}) - c_{ji}(\mathbf{s})}{c_{ij}(\mathbf{s}) + c_{ji}(\mathbf{s})} \] whenever neurons $i$ and $j$ both fired in sequence $\mathbf{s}$. If either neuron $i$ or $j$ did not fire in sequence $\mathbf{s}$, then we defined $b_{ij}(\mathbf{s}) = 0$. Each firing bias lies in the interval $[-1, 1]$ and is skew-symmetric with respect to the order of the neurons: $b_{ij}(\mathbf{s}) = -b_{ji}(\mathbf{s})$. Because of this, the bias between $i$ and $j$ can be completely captured using only $b_{ij}(\mathbf{s})$ for ordered pairs $(i, j)$ with $i < j$. The bias vector of $\mathbf{s}$ is defined to be the $\binom{n}{2}$-dimensional vector $B(\mathbf{s}) = [b_{ij}(\mathbf{s})]_{i < j}$.
The definition for $b_{ij}(\mathbf{s})$ guarantees that $b_{ij}(\mathbf{s})$ is positive if $i$ tends to precede $j$ and negative if $j$ tends to precede $i$ in $\mathbf{s}$. This characteristic ensures that the direction of the bias vector $B(\mathbf{s})$ captures the tendency for each pair of neurons to spike in a particular order. In a sequence where each neuron spikes exactly one time, the order of the spikes can be completely recovered from the sequence's bias vector. Thus, the direction of $B(\mathbf{s})$ is a generalization of the concept of a neuronal ordering. This property leads us to use a form of the cosine similarity as our correlation measure:
\[
\corr(\mathbf{u}, \mathbf{s}) :=
\frac{B(\tilde{\mathbf{u}}) \cdot B(\tilde{\mathbf{s}})}
{\|B(\tilde{\mathbf{u}})\| \|B(\tilde{\mathbf{s}})\|},
\]
where $\cdot$ and $\|\ \|$ are the standard Euclidean dot-product and norm operations and where $\tilde{\mathbf{u}}$ and $\tilde{\mathbf{s}}$ are the restrictions of $\mathbf{u}$ and $\mathbf{s}$ to the set of neurons active in both sequences. Given any lists $\mathcal{S}$ and $\mathcal{S}'$ of sequences, the \textit{correlation matrix} $C(\mathcal{S}, \mathcal{S}')$ is defined to be $C(\mathcal{S}, \mathcal{S}') = [\corr(\mathbf{s}, \mathbf{s}')]_{\mathbf{s} \in \mathcal{S}, \mathbf{s}' \in \mathcal{S}'}$.
\subsection{Significance of correlation}
Although the sign of a correlation value is easy to interpret as similarity (positive value) or anti-similarity (negative value), its magnitude does not readily indicate the statistical significance of the value. To properly address this, the \emph{significance of correlation} of sequence $\mathbf{s}$ to sequence $\mathbf{u}$ is defined as follows. For any sequence $\mathbf{s} = (s_1, \dots, s_\ell)$, the length of $\mathbf{s}$ is the number of spikes in $\mathbf{s}$, denoted $\len(\mathbf{s}) = \ell$. The collection of permutations of the set $\{1, \dots, \len(\mathbf{s})\}$ is denoted by $\Sigma_{\mathbf{s}}$. Given a sequence $\mathbf{s}$ and a permutation $\sigma \in \Sigma_{\mathbf{s}}$, the sequence $\mathbf{s}^\sigma := (s_{\sigma(1)}, \dots, s_{\sigma(\len(\mathbf{s}))})$ is a shuffling of $\mathbf{s}$. Each shuffling of a sequence $\mathbf{s}$ has the same number of spikes for each neuron as $\mathbf{s}$ does. The significance of the correlation of sequence $\mathbf{s}$ to sequence $\mathbf{u}$ is
\[ \sig_{\mathbf{u}}(\mathbf{s}) = \frac{1}{\len(\mathbf{s})!} \Big|\big\{\sigma \in \Sigma_{\mathbf{s}} :
|\corr(\mathbf{u}, \mathbf{s})| > |\corr(\mathbf{u},
\mathbf{s}^\sigma)|\big\}\Big| . \]
Note here that sequence $\mathbf{u}$ remains fixed in this definition. In doing this, we are comparing $\mathbf{s}$ to $\mathbf{u}$ relative to the different possible sequences formed by permuting the spikes of $\mathbf{s}$.
In our analysis, we approximated the significance of correlation using Monte Carlo simulations. Let $T$ be be the number of trials in a Monte Carlo simulation. We chose $T = 10,000$. Let $\mathcal{S} = (\mathbf{s}_1, \dots, \mathbf{s}_n)$ be the list of all observed sequences within a recording. Define $\Sigma(\mathcal{S})$ to be the Cartesian product $\Sigma_{\mathbf{s}_1} \times \cdots \times \Sigma_{\mathbf{s}_n}$. For any $\vec{\sigma} = (\vec{\sigma}[1], \dots, \vec{\sigma}[n]) \in \Sigma(\mathcal{S})$, let $\mathcal{S}^{\vec{\sigma}} = (\mathbf{s}_1^{\vec{\sigma}[1]}, \dots, \mathbf{s}_n^{\vec{\sigma}[n]})$ be a list of shufflings of the sequences in $\mathcal{S}$. We then randomly chose $T$ lists of permutations $\vec{\sigma}_1, \dots, \vec{\sigma}_T \in \Sigma(\mathcal{S})$ and generated the corresponding list $C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_1}), \dots, C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_T})$ of \textit{shuffled correlation matrices}. For sequences $\mathbf{s}_{m_1}, \mathbf{s}_{m_2} \in \mathcal{S}$ and trial $k \leq T$, the $(m_1, m_2)$ entry of the correlation matrix $C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_k})$ is $\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_k[m_2]})$. Hence, for any sequences $\mathbf{s}_{m_1}, \mathbf{s}_{m_2} \in \mathcal{S}$, we can extract a list $\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_1[m_2]}), \dots, \corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_T[m_2]})$ of correlation values between $\mathbf{s}_{m_1}$ and shufflings of $\mathbf{s}_{m_2}$ from the list of correlation correlation matrices $C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_1}), \dots, C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_T})$. We computed the significance $\sig_{\mathbf{s}_{m_1}}(\mathbf{s}_{m_2})$ as
\begin{equation*}
\sig_{\mathbf{s}_{m_1}}(\mathbf{s}_{m_2})
= \frac{1}{T} \Big|\big\{k :
|\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2})|
> |\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_k[m_2]})|\big\}\Big| .
\end{equation*}
Similarly,
\begin{equation*}
\sig_{\mathbf{s}_{m_1}}(\mathbf{s}_{m_2}^{\vec{\sigma}_k[m_2]})
= \frac{1}{T} \Big|\big\{k' \in \{0, \dots, T\} \setminus \{k\} :
|\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_k[m_2]})|
> |\corr(\mathbf{s}_{m_1}, \mathbf{s}_{m_2}^{\vec{\sigma}_{k'}[m_2]})|\big\}\Big| ,
\end{equation*}
where $\mathbf{s}_{m_2}^{\vec{\sigma}_0[m_2]} := \mathbf{s}_{m_2}$.
Because each shuffled correlation matrix $C(\mathcal{S}, \mathcal{S}^{\vec{\sigma}_k})$ is computed using the raw sequences $\mathcal{S}$ and a fixed list of shufflings $\mathcal{S}^{\vec{\sigma}_k}$ of the raw sequences, we can compute a distribution of the number of significant entries expected between the raw sequences and their shufflings. For $\mathcal{M} = \{m_1, \dots, m_k\} \subseteq \{1, \dots, n\}$ with $m_1 < \dots < m_k$, define $\mathcal{S}_N := (\mathbf{s}_{m_1}, \dots, \mathbf{s}_{m_k})$. Given $\mathcal{M}_1, \mathcal{M}_2 \subseteq \{1, \dots, n\}$, the \textit{global significance} between $\mathcal{S}_{\mathcal{M}_1}$ and $\mathcal{S}_{\mathcal{M}_2}$ is \[ \frac{1}{T}|\{k : f(\mathcal{S}_{\mathcal{M}_1}, \mathcal{S}_{\mathcal{M}_2}) > f(\mathcal{S}_{\mathcal{M}_1}, [\mathcal{S}^{\vec{\sigma}_k}]_{\mathcal{M}_2})\}| ,\] where $f(\mathcal{S}_{\mathcal{M}_1}, [\mathcal{S}^{\vec{\sigma}_k}]_{\mathcal{M}_2}) = |\{(m_1, m_2) \in \mathcal{M}_1 \times \mathcal{M}_2 : \sig_{\mathbf{s}_{m_1}}(\mathbf{s}_{m_2}^{\vec{\sigma}_k[m_2]}) < 0.05\}|$ is the number of significant correlations in the correlation matrix $C(\mathcal{S}_{\mathcal{M}_1}, [\mathcal{S}^{\vec{\sigma}_k}]_{\mathcal{M}_2})$.
\textbf{Supplementary Figures}\\\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.70\columnwidth]{figures/supp-figure-spw-info/supp-figure-spw-info}
\caption{{\label{fig:spw-info}
\textbf{A.} Locations where SPW sequences occur. Most SPW sequences occur in the reward areas (dark blue areas on the right side) or in the delay area (light blue area on the left side). Marginal distributions are shown along the top and right sides. \textbf{B.} Histogram of durations of all SPW sequences. \textbf{C.} Relationship between the number of active neurons in a sequence and the total number of spikes in that sequence. Each point represents a sequence. Marginal distributions of active neurons (right) and spike counts (top) are also shown. \textbf{D.} The relationship between correlation ($x$ axis) and significance ($y$ axis). Significance is shown on a logarithmic scale. Correlations between all comparable sequences are included. Marginal distributions for correlation (top) and significance (right). \textbf{E.} Same as panel D but using only sequence pairs with a significance value below $0.05$.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.42\columnwidth]{figures/supp-figure-corr-matrices/supp-figure-corr-matrices}
\caption{{\label{fig:example-matrices}
Examples of significance matrices. Each example matrix is partitioned with three groups: arm-run sequences, wheel-run sequences, and SPW sequences. Only every third SPW sequence is displayed.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.42\columnwidth]{figures/supp-figure-sequences/supp-figure-sequences}
\caption{{\label{fig:example-sequences}
Examples of significantly correlated sequence pairs. Each panel shows one SPW sequence (left) and one wheel-run sequence (right). For display purposes, the timescale of the SPW sequence plots is not the same as the timescale for the wheel-run sequence plots. \textbf{A.} Correlation: $0.6812$; significance: $0.0007$. \textbf{B.} Correlation: $-0.8523$; significance: $0.0000$. \textbf{C.} Correlation: $-0.7223$; significance: $0.0010$. \textbf{D.} Correlation: $-0.8694$; significance: $0.0000$.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.42\columnwidth]{figures/supp-figure-coactive/supp-figure-coactive}
\caption{{\label{fig:overlap}
Overlap of neurons between various sequence types. \textbf{A.} An example matrix indicating which sequences meet our minimum requirement for comparison (purple) and which sequences do not (white). The labels indicate the sequence type: "Wheel" are running sequences from the running wheel; "Pos." are forward-replay SPW sequences; "Neg." are backward-replay SPW sequences; "Other" are all other SPW sequences. Labels the same in panels B and C. \textbf{B.} Box plots indicating the percentage of comparable sequence pairs that have the given number of neurons in common. A collection of series of box plots (designated by color) is shown for each of several collections of pairs of sequences. \textbf{C.} The box plot series from panel B are combined to show the overall percentage of sequence pairs meeting our minimum requirement for comparison.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.70\columnwidth]{figures/SupplFig-SeqVectorSpaceCartoons-04/SupplFig-SeqVectorSpace-example3seq-04}
\caption{{\label{fig:minimal-example}
Spatial representation of bias vectors from the main figure 4C. Left: example sequences from 4C. Middle: Bias vectors of the sequences from 4C. Right: spatial representation of the bias vectors b\textsubscript{1}-b\textsubscript{3}. Note, b\textsubscript{1} and b\textsubscript{2} are positive correlated, b\textsubscript{2} and b\textsubscript{3} are positively correlated but b\textsubscript{1} and b\textsubscript{3} are negatively correlated.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.70\columnwidth]{figures/SupplFig-SeqVectorSpace-SPWbehSeq-1/SupplFig-SeqVectorSpace-SPWbehSeq-1}
\caption{{\label{fig:vector-perspective}
Spatial representation of bias vectors derived from SPW (orange) and running (green) sequences. All SPW sequences bias vectors are either mutually positively correlated or are orthogonal with respect to each other. In contrast, correlations values between SPW and running sequence bias vectors are positive as well as negative.%
}}
\end{center}
\end{figure}\selectlanguage{english}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.70\columnwidth]{figures/sFig-networkSeqCartoon-02/sFig-networkSeqCartoon-02}
\caption{{\label{fig:network-perspective}
Cartoon of proposed relationships between running and SPW sequences. \textbf{A.} A neuronal network with embedded running sequence (gray arrows) and three SPW sequences (orange, blue, pink). \textbf{B.} It is assumed that the running sequence is a forward going sequence and that SPW sequences can travel the trajectory of the running sequence in either forward (orange and pink) or backward (blue) direction. Given this assumption, SPW sequences should be mutually positively and negatively correlated. \textbf{C.} In contrast, our data show that SPW sequences are, statistically speaking, only mutually positively correlated. Thus, our data contradict the assumption that running sequences serve as a unidirectional and forward going template that is being stored in memory.%
}}
\end{center}
\end{figure}
\selectlanguage{english}
\FloatBarrier
\end{document}