Tracking developmental trajectories at the organismal and cellular level.

Postnatal development in mammals is not a strictly stereotyped process (left) but rather shows variability across individual organisms as well as across individual cells of the same organism (right). Performing an acute experiment (dashed grey line) only provides a single snapshot of the developmental trajectory of an individual organism (or cell). Alternatively, a longitudinal experiment (grey arrow) allows to track the properties of the same individual (or cell) throughout development, which is especially important in the case of variability in developmental trajectories (right).

The Track2p pipeline for tracking cells across recordings.

A: Schematic overview of the Track2p algorithm and the GUI capabilities. Dashed squares represent optional steps in the pipeline. B: The transformation (T) between two consecutive days is computed by registering the mean FOV images. Top: An overlay of the reference (red, s0) and the moving (green, s1) images before registration. Bottom: Same two images after registration. Scale bar: 50 μm. C: Applying the transform to ROIs from Suite2p segmentation. The ROI color code is the same as in B, the intersection of the ROIs is shown in yellow. Top: Overlap before T. Bottom: Overlap after T. Note: Only a few example ROIs are displayed for explanation purposes. D: Cell matching using linear sum assignment. ROIs are the same as C with indexes for the two recordings added for illustrative purposes. Cells from one recording are matched to cells from another maximising the sum of the intersection over union (IoU) across all matches. E: Filtering putative false and true matches by thresholding the IoU distribution. Top: The distribution of IoU values for matched ROI pairs shows a bimodal distribution, which is used to reject putative false positive matches. Bottom: Final result of the cell linking for a pair of recordings. F: Top: In the case of tracking across more than 2 imaging sessions, the steps from B to D are repeated sequentially to link the cells across all days. Bottom: Example matches for five cells (rows) successfully tracked across five consecutive days (columns). Note: The figures shown are for illustrative purposes only, see Fig. 3 for application to real data.

Track2p tracks hundreds of cells throughout the second postnatal week of development in the mouse neocortex despite substantial brain growth.

A: Top left and right: Mean images of the ‘anatomical’ channel (tdTomato in GABAergic cells) for the first two imaging days (P8 and P9). Scale bar: 100 μm. Bottom left: Overlay of the two images after registration (pseudocolored as red and green respectively). Bottom middle: Overlay of the ROIs after registration (same colour code for P8 and P9). Bottom right: Distribution of IoU values for matched pairs showing the automatic threshold (grey dashed line). B: Same as A but for the last two imaging days (P13 and P14). C: Nine representative examples of matches visualised in the mean ‘functional’ channel (signal from pan-neuronal GCaMP8m expression) on the first and last days of recording (P8 and P14). The blue dot indicates the centroid of the ROI. D: Overlay of all ROIs successfully tracked across all days (N=728) on the mean ‘functional’ channel image of the first (P8, left) and last (P14, right) imaging days. Each tracked ROI is shown in the same color across the plots. Note the expansion of the FOV at P14 compared to P8. Scale bar: 100 μm. E: Graph plotting the proportion (y-axis) and absolute number (grey text) of cells successfully tracked from the first day of imaging onwards. F: Brain growth quantified as the relative increase in pairwise distances between tracked cells normalised to the first day. Grey dots represent the mean for each recording. Note: For visualisations in panels A, B, C and D across all days see Extended Data Fig. 2.

Evaluation of tracking performance on a manually tracked ground truth dataset during the second postnatal week of development in the mouse neocortex.

A: A schematic representation of possible cases when comparing ground truth tracks (GT, solid lines) with those reconstructed by Track2p (T2P, dashed lines). The CT metric favours perfect matches (top row) and penalises all types of mismatches (bottom four rows). B: Graph showing the CT score for all three GT datasets across evaluated conditions. Mean CT scores of 0.93, 0.91, 0.22 and 0.00 for ‘Anatomical’, ‘Functional’, ‘Rigid’ and ‘CellReg’ respectively. Blue denotes the example mouse illustrated in Fig. 3. C: Proportion of fully correctly reconstructed GT traces for increasing time spans starting from P8 for the baseline (‘Anatomical’) condition. D, E and F: Same as C but for the ‘Functional’, ‘Rigid’ and ‘CellReg’ conditions respectively.

Evolution of neuronal activity statistics from hundreds of tracked neurons during the second postnatal week of mouse development.

A: Raster plots showing the activity of all 728 tracked neurons as a function of time for the example mouse at P8 (top) and P14 (bottom). Each row in the raster corresponds to the trace of a single cell with the sorting determined by their Rastermap embedding computed at P14. Grey traces underneath the raster show a metric of global motion of the mouse computed from videography (see Methods). B: Overview of the full dataset, indicating the imaging days for each mouse (left) and the total number of cells successfully tracked (with Track2p) across all recording days (right); * indicates mice used in the evaluation of the algorithm (Fig 3); blue denotes the example mouse. C: Graphs plotting the mouse weight (left) and the mean pairwise distance between tracked neurons (right; normalized to P9 which corresponds to the earliest common day across all mice) as a function of imaging days t. D: Graphs plotting the distribution of calcium fluorescence event rates in all tracked neurons from the example mouse as a function of age (left), the mean value across days for all mice (middle) and a statistical comparison between the early (≤ P11) and late (> P11) epochs (right). Example mouse is shown in blue; same in E, F and G. *: Mann–Whitney U test, p = 7.6 x 10-6. For standard deviation see Extended Data Fig. 5G. E: Same as D but for pairwise correlations. *: Mann–Whitney U test, p = 1.8 x 10-6. For standard deviation see Extended Data Fig. 5H. F: Graphs plotting pairwise correlations as a function of anatomical distance for all pairs of tracked neurons across all ages in the example mouse (left), the estimated pairwise correlation of neighbouring neurons as a function of age for all mice (middle) and a statistical comparison across the two epochs (right). *: Mann–Whitney U test, p = 2.7 x 10-7. G: Cumulative distribution plot of the explained variance as a function of the number of principal components (PCs) for the example mouse across ages (left), number of PCs accounting for 90% of the variance as a function of age for all mice (right) and a statistical comparison across the two epochs (right). *: Mann–Whitney U test, p = 4.0 x 10-6.

Transition between two stable functional network structures during the second postnatal week of barrel cortex development.

A: Schematic explanation of the framework to compare functional connectivity across days; grey nodes represent neurons, strength of a functional connection is denoted by the opacity of the blue edge between two nodes. For a network of 4 neurons and a given connectivity Cd (16 connections, top) we can imagine that the connectivity on the next day (Cd+1) could be ‘conserved’ (middle left) or it could be ‘reorganised’ (middle right). A scatter plot comparing all 16 functional connections between Cd and Cd+1 would indicate a high correlation in the ‘conserved’ case (bottom left) and low correlation in the reorganised case (bottom right). We refer to this correlation as ‘FC similarity’. B: Scatter plots of FC for three different pairs of recording days: a pair of early sessions (P8 to P9, top left), an early and a late session (P8 to P14, top middle) and a pair of late sessions (P13 to P14, top right). Within-session FC similarity (bottom scatter plots) i.e. comparing the first and second half of an imaging session at early (P81/2 to P82/2, bottom left) and late ages (P141/2 to P142/2, bottom right). For visualisation purposes a random subset of 200 pairs is displayed; Linear fit and r (pearson correlation or ‘FC similarity’) are computed on all pairs; Symbols next to r values indicate the same values in panels C and D. C: FC similarity between P8 and all other days for the example mouse (left). Sigmoid fit: solid grey line; inflection point (‘transition age’, see Methods): dotted grey vertical line; linear portion of the sigmoid (‘transition time’, see Methods: two dashed grey vertical lines). Transition age (middle) and transition time (right) as a function of initial weight at P7 are plotted for all mice. D: FC similarity matrix (left) for all pairs of recording days (off diagonal), with within-session FC similarity on the diagonal for the example mouse (left) and average FC similarity across all mice for the same period (right). E: Box plots comparing within day (left) or across-day (right) FC similarity for early (≤ P11) and late (> P11) developmental epochs pooled across all mice. *: statistically significant; ns: not statistically significant (Kruskall-Wallis test: p = 3.6 x 10-22; post-hoc Mann–Whitney U tests with Bonferroni correction, early within - late within: p = 3.3 x 10-3, early to early - late to late: p = n. s., early to early - early to late: p = 1.7 x 10-12, late to late - early to late: p = 4.2 x 10-5, for all possible comparisons see Extended Data Fig. 6K).

Regression analysis to study the development and stability of neural representations.

A: Left: A decoding model is fitted on each day to predict a behavioural variable (y, mouse motion) from the simultaneously recorded calcium imaging data (X, activity raster). Right: The model is then tested on the same day (using cross-validation) to assess the encoding of the variable on that given day. B: Overlay of animal’s motion (grey) and the predicted signal from neural activity (green) fit on the same day for example early (P8, top) and late recordings (P14, bottom). Symbols indicate the corresponding R2 values in panels C and G. Only the first 5 min of the recording are shown for visualisation purposes, for full traces of all recordings see Extended Data Fig. 7. C: Graphs indicating R2 values for same-day cross-validated decoding performance as a function of mouse age. Green indicates the example mouse (also in D). D: Graph plotting the correlation between the animal’s motion and the first principal component signal across days (left) and a statistical comparison of the early (≤ P11) and late (> P11) epochs (right). *: Mann–Whitney U test, p = 1.2 x 10-3. E: Left: Same as in A an individual model is fitted on each day. Right: To assess the stability of the representation, each model is tested across different days, which is only possible when tracking neurons across sessions. F: Same as B but for examples of cross-day decoding early to early (P9 to P8), late to late (P13 to P14) and early to late (P8 to P14). Symbols indicate the corresponding R2 values in panel G. G: Full prediction performance matrix showing R2 values for all combinations of fit and test datasets (rows and columns respectively) for the example mouse (left) and average across all mice for the same period (right). Diagonal entries correspond to same-day decoding, off-diagonal entries to cross-day recording. H: Box plots comparing R2 values for same day (left) or across-day (right) decoding for early (≤ P11) and late (> P11) developmental epochs pooled across all mice.*: statistically significant; ns: not statistically significant (Kruskall-Wallis test: p = 4.5 x 10-10; post-hoc Mann–Whitney U tests with Bonferroni correction, early within - late within: p = 1.6 x 10-3, early to early - late to late: p = 6.5 x 10-6, early to early - early to late: p = n. s., late to late - early to late: p = 2.4 x 10-5, for all possible comparisons see Extended Data Fig. 7I).

Overview of the graphical user interface for interactive visualisation and curation of tracked cells.

A. The menu bar allows the users to run the Track2p algorithm (under ‘Run’), import the results of a previous run (under ‘File’) or to visualise population activity (under ‘Visualisation’; opens the raster window in F) B. The interface displays the mean image for each day of the recording (the channel can be chosen by the user), with ROIs of the cells tracked across all days overlaid. This plot allows the user to select which cell to visualise across days. This visualisation corresponds to Fig. 3D. C. Once a cell is selected this section provides a high magnification image of the FOV for all days. Underneath each high magnification image the Suite2p index on that day (i) and the Suite2p cell probability (p) are displayed. This visualisation corresponds to Fig. 2E. D. The activity traces are presented in order from the first (top) to the last (bottom) session of the tracking. (The type of traces can be chosen by the user). E. Curation bar on the bottom of the window allows browsing all tracked cells to perform the manual curation. If a track is considered faulty during the manual inspection, its state can be set to zero (by clicking on the cross). (The ‘Apply curation’ is used to update the FOV visualisations by coloring all contours of tracks assigned as bad in white.) F. Raster visualisation window allows the users to visualise the time series of the whole population and sorting the rasters to show population level features and their stability across days.

Track2p outputs across all days for the example mouse.

A. Top: Mean FOV of the sparse anatomical marker (tdTomato) expressed in GABAergic neurons for all days. Middle: Overlay of two neighbouring days before registration. Red: reference image, green: moving image. Bottom: Overlay after registration. B. Histogram of IoU values for all assigned ROI matches in each pair of subsequent recordings. Statistical threshold for filtering matches is shown with a dashed line. C. Overlay of all ROIs successfully tracked across all days on the mean FOV image of the GCaMP8m channel for all imaging days. Each tracked ROI is shown with the same contour color across all days.

Generating a ground truth dataset for Track2p evaluation.

A: Overlay of ROIs selected for manual tracking on top of the mean image of the GCaMP8m channel on the first day of the recording for all three datasets used in the evaluation. Blue crosses indicate an 8x8 grid of equidistant points used to select ROIs for manual tracking. Contours are denoting the closest ROI to each of the points from the grid, with the number denoting the index of this ROI in the first dataset. Green ROIs denote ROIs that were manually tracked across all days, orange shows those that could not be manually tracked in at least one of the sessions. Note that green cells show a relatively homogenous distribution across the FOV. B. Example showing the manual tracking procedure. Left: A ROI chosen for manual tracking (index 141, green circle) visualised in the Suite2p GUI on the first day of recording (P8). Right: The same ROI identified manually on the next day (purple circle). Surrounding contours denote other surrounding ROIs detected on that imaging day.

Activity of tracked cells across all days for the example mouse.

A. Raster plots and simultaneously recorded mouse movements (blue traces) for all tracked neurons on each subsequent day from P8 (top) to P14 (bottom) for the example mouse (related to Fig. 4A). B. Representative example dF/F traces of individual tracked neurons, with the trace of each neuron displayed in the same color across days. Neurons were chosen in equal increments along the rows of the corresponding raster plots in A.

Development of neuronal activity statistics in the tracked population of neurons for the full dataset.

A. Distributions of calcium event rates (related to Fig. 5D). B. Distributions of pairwise correlations (related to Fig. 5E). C. Pairwise correlations as a function of distance (related to Fig. 5F). D. Cumulative proportion of total variance explained by PCA (related to Fig. 5G). E: Relationship between the initial weight of each mouse and its brain growth estimated as the slope of the line of pairwise cell distances (Fig. 5C). F: Statistical comparison of mouse weight (left) and normalised mean distance between cells (right) between the two developmental epochs (related to Fig. 5C). G: Standard deviation of the calcium fluorescence event rates population of tracked neurons across days for all mice (left) and a statistical comparison between the early and late epochs (right) (related to Fig. 5D). H: Same as G but for pairwise correlations (related to Fig. 5E).

Stability of neural activity statistics for all mice in the dataset.

A: Scatter plots of FC values for all combinations of recordings for the example mouse (related to Fig. 5B). B. FC stability matrices for all mice in the dataset. Asterisk denotes the example mouse (related to Fig. 5D). C. Mean FC stability matrix averaged across all mice in the dataset. D. Box plots of the distribution of individual FC stability values in different conditions pooled across mice (same as Fig. 5E). E. Statistical significance of pairwise comparisons of data from D. F-J: Same as A-E but for stability of calcium event rates. K: P values for all statistical comparisons between FC stability of different developmental epochs (related D and E in this figure and Fig 6E). L: Same as K but for calcium event rate stability.

Relationship between spontaneous behaviour and neural activity for all mice in the dataset.

A. Cross-validated same day prediction for all recording days in the example mouse (related to Fig. 6B and C). B: Prediction of a decoder fit on P14 across all days (related to Fig. 6F and G). C. Prediction of a decoder fit on P8 across all days (related to Fig. 6F and G). D. Example dF/F trace of a highly predictive neuron for a model fit at P14. Notice that the activity closely corresponds to the movement trace also on two earlier days (P12 and P13). E. Full matrices of R2 values for all combinations of train and test recordings in each mouse. Example mouse (*). F. Mean R2 matrix averaged across all mice in the dataset. G. Box plots of the distribution of individual R2 values in different conditions pooled across mice (same as Fig. 5E). H. Statistical significance of pairwise comparisons of data from G. I: P values for all statistical comparisons of decoder performance for all comparisons (related D and E in this figure and Fig. 7H).