Abstract
Head-mounted miniscopes have allowed for functional fluorescence imaging in freely moving animals. However, current capabilities of state-of-the-art technology can record only up to two, spectrally distinct fluorophores. This severely limits the number of cell types identifiable in a functional imaging experiment. Here we present a pipeline that enables the distinction of nine neuronal subtypes from regions defined by behaviorally relevant cells during in vivo GCaMP imaging. These subtypes are identified utilizing unique fluorophores that are co-expressed with GCaMP, unmixed by spectral imaging on a confocal microscope and co-registering these spectral fingerprints with functional data obtained on miniaturized microscopes. This method facilitates detailed analyses of circuit-level encoding of behavior.
Miniaturized head-mounted microscopes have enabled functional calcium imaging in freely moving animals, greatly enhancing our understanding of neural encoding of behavior and experience1. In the past decade these “miniscopes”2 have evolved rapidly, becoming lighter and in some cases wireless3, adding features such as increased field of view4,5, two-photon capability6–8, multiple focal planes9, and the ability to optogenetically stimulate as well as record10. The size and weight constraints of head-mountable microscopes severely limit their capabilities, however, restricting the amount of information obtainable by any given experiment utilizing a miniscope as the sole imaging source. One of these fundamental constraints is the number of fluorophores that can be distinguished in each experiment. Space constraints within the miniscope body for filter sets and other components limit the excitation and emission capabilities. In addition, the gradient-index (GRIN) lens induces stark chromatic aberrations along the optical z-axis, causing the focal plane to shift depending on wavelength, often surpassing the physical distance the miniscope can travel for focusing11. The current state-of-the-art techniques in miniscope imaging can distinguish two spectrally distinct fluorophores, typically using the GCaMP functional sensor fluorescing in the green wavelength domain and a second static or functional marker in the red wavelength domain11, though studies utilizing these systems have yet to be published. Until now, experiments observing more than two cell types used different sets of mice using replicable behavioral tasks to observe unique cell populations12,13. However, the ability to identify a larger number of neuronal cell types in the imaged field of view would enable detailed analyses of circuit coding of behavior through direct comparisons of neural activation patterns occurring simultaneously. Indeed, several groups have recognized the importance of simultaneous recordings for circuit dynamics studies and have undergone the herculean task of using post-hoc profiling to identify previously recorded neurons14–17. Here we present a streamlined pipeline, named Neurocipher, that enables in vivo multispectral deciphering of functionally relevant neurons. Using Neurocipher, we have identified nine fluorescent cell-type markers expressed in addition to GCaMP by co-registering miniscope functional data with spectral data obtained by multiplexed spectral imaging on a confocal microscope (Fig. 1). Either type of imaging session can be repeated without causing damage to the labeled cells, nor involving the animal to be sacrificed, thus allowing for longitudinal studies or reuse of valuable animal subjects. Using this method, we imaged neural activity in the medial prefrontal cortex (mPFC) during a social learning task and identified nine excitatory pyramidal subtypes based on their projection regions, constituting 70% of the functionally identified neurons.
Fig. 1: Experimental pipeline for identifying 9 neuronal subtypes within behaviorally relevant ROIs determined by GCaMP6s imaging.
a, Surgical paradigm. In a TetO-GCaMP6s x CaMKII-tTa mouse, 9 AAVretro viruses are injected into downstream brain regions and GRIN lens implanted into target region. b, Simultaneous recording of GCaMP6s (top) and behavior (bottom) during a social memory task. c, GCaMP6s recordings are processed. CNMF-defined ROIs (top) and df/f traces (bottom) are exported. Scale bar = 100 μm. d, Mice are head fixed and FOV under the GRIN lens imaged using the multiplexed lambda method. e, Transformations are determined using anatomical background images to co-register the two imaging platforms. The transformations are applied to CNMF-defined ROIs. Scale bar = 100 μm. f, Multispectral data is collected for each ROI (top) and an average spectral fingerprint for all ROIs is generated (bottom). Mean +/− 1.5*std. Scale bar = 100 μm. g, A linear model is performed to determine fluorophore components of each ROI. h, Fluorophore matches are applied to ROIs. Scale bar = 100 μm. i, Neural activity is sorted by cell type. Scale bars = 20 df/f vertical, 20 seconds horizontal.
Results
Correcting for GRIN-induced chromatic aberration
To perform functional imaging of the prelimbic region (PL) of the medial prefrontal cortex (mPFC), we surgically implant GRIN lenses. Imaging through a GRIN lens, however, introduces significant optical aberrations in the field of view (FOV), including the most severe astigmatism and axial chromatic aberrations19. Before imaging in vivo, we characterized these aberrations for the most utilized GRIN lens types and sizes. These types consisted of glass doped with either silver or lithium and encompassed sizes of 1 mm width by 4 mm length, and 0.6 mm width by 7 mm length. For the longer lenses we compared both silver and lithium doped glass variants, but the shorter 1×4 mm lenses are currently only manufactured with silver-doped glass. Silver-doped lenses have a higher numerical aperture (NA) and are the most often used glass type, though lithium-doped lenses have been utilized more frequently in simultaneous dual-color experiments.
We measured the optical aberrations of each GRIN lens using a fluorescent calibration slide containing a pattern of equally spaced rings (each 1.8 μm in diameter, spaced 50 μm apart) that were both excitable and emitted throughout the entire visible spectrum20. A custom-made GRIN lens holder allowed for the precise positioning of each GRIN lens above the calibration slide. We observed substantial chromatic aberrations along the optical axial (z) axis, which increased with the length of the GRIN lens (Fig. 2). These aberrations caused a downwards shift of the focal plane for higher wavelengths, which could be fit with a second-order polynomial (Fig. 2a, b and Supp. Fig. 2a). The axial chromatic shift was significantly smaller for lithium-doped lenses as opposed to the more common silver (Supp. Fig. 1b). Despite being severe in the axial direction, chromatic aberrations in the lateral (x, y) plane were negligible for all tested lenses (Fig. 2c).
Fig. 2: GRIN lens induced chromatic aberrations.
a, Multicolor image obtained through 1×4 mm silver-doped GRIN lens of the calibration slide highlighting the z-plane chromatic aberration. b, Shift in z-focal plane as a function of excitation laser wavelength. Second order polynomial R2 = 0.9976. c, Multicolor image obtained through 1×4mm silver-doped GRIN lens of the calibration slide. d, Percent transmission through the GRIN lens as a function of excitation laser wavelength. Second order polynomial R2 = 0.9751. e, Orthogonal projection of calibration slide imaged through 1×4mm silver-doped GRIN lens overlaid (in cyan) with rectilinear grid lines. Almost perfect overlap of fluorescent rings from the grid highlights lack of discernible field distortions. f, Excerpt from (e) showing the rings focused in the sagittal plane (z= +20 μm), the circle of least confusion (z= 0 μm), and the tangential focal plane (z= −17.5 μm) g, Curvature of the Petzval field as a function of radial distance from center of the GRIN lens. Astigmatism results in three axially separated focal planes. Second order polynomial R2 = 0.9845. Scale bars = 100 μm.
To overcome the axial chromatic aberrations when imaging through GRIN lenses in vivo, we adopted a dual approach. First, we compensated the wavelength-dependent shifting of the focal plane by obtaining a z-stack image: we set the upper focal plane using 405 nm excitation and 450 nm emission, and the lower focal plane using the 639 nm excitation laser and emissions in 700 nm range, thus including all relevant focal planes of the labeled brain region for the entire visible spectrum. These z-stacks were later flattened to nullify the shift in z focal planes. Second, we opened the confocal pinhole to 350 μm to prevent rejecting the seemingly out-of-focus fluorescence from red-shifted emission wavelengths.
In addition to the axial chromatic aberrations, light transmission through GRIN lenses is also strongly wavelength dependent. Transmission peaks at 71% between 550–600 nm and declines sharply below 500 nm, falling to 53% at 405 nm (Fig.2d). This is most apparent in silver-doped lenses and is exacerbated with increasing lens length (Supp. Fig. 2c, d). After fitting a second order polynomial to the transmission curves, we determined a formula to adjust the excitation laser powers to compensate for the wavelength-dependent transmission of light through the GRIN lenses during confocal imaging. For in vivo experiments, laser powers were set by first identifying the brightest spectral bin out of all the excitation lasers, and then adjusting the power of that specific excitation laser together with the detector gain to use the full dynamic range of the detectors without risking saturation. All other excitation lasers were adjusted according to the reference laser power and the wavelength-dependent transmission factor, to ensure equal illumination intensities on the sample.
Apart from the chromatic distortions, GRIN lenses also exhibited profound lateral aberrations, clearly visible especially in the outer third of the FOV. There were no discernable field distortions (Fig. 2e) in any direction,_very prominent instead were a rotationally symmetrical astigmatism and a curvature of the focal plane, both growing more severe with increasing distance from the center of the lens (Fig. 2f, g). Despite their severity, the lateral aberrations proved to be achromatic, thus requiring no additional chromatic corrections in the xy plane.
Fluorophore selection and optimization
We analyzed published spectral profiles of available genetically encoded fluorophores, and identified a combination of fluorescent proteins that could be uniquely separated by considering both their excitation and their emission spectra18. We determined that more spectra could be separated by employing a multiplexed spectral imaging technique where excitation lasers are sequentially activated, and the entire emission spectra recorded using spectral detection. Next, we simulated the multiplexed spectral imaging approach of various fluorophore combinations in silico and selected ten fluorophores in addition to GCaMP6s for testing, each with a unique spectral fingerprint. These fluorophores included: mTagBFP2, mTurquoise2, T-Sapphire, mVenus, mPapaya, mOrange2, mScarlet, FusionRed, mCyRFP1, and mNeptune2.5. After transfecting each of these fluorophores individually in HEK cell samples, we recorded their spectral fingerprints during multiplexed spectral imaging for later use during linear unmixing of experimental data (Fig S1). mPapaya was found to induce considerable amounts of cell death and was therefore excluded from further study. The nine remaining fluorophores were used to make retrograde adeno-associated viruses (AAVretro) for in vivo application.
Identification of behaviorally relevant neurons
Next, we sought to discern ten colors through GRIN lenses in behaviorally relevant neurons projecting to up to 9 different brain regions. Mice stably expressing GCaMP6s in pyramidal neurons21 were injected with the nine different AAVretro viruses following two different fluorophore-region maps, each in a region known to receive projections from the mPFC. These regions included the dorsal periaqueductal gray (dPAG), basolateral amygdala (BLA), claustrum (Cla), nucleus accumbens (NAc), striatum (Str), locus coeruleus (LC), ventral tegmental area (VTA), lateral habenula (lHb), lateral hypothalamus (lHyp), and the contralateral prefrontal cortex (c-mPFC). AAVretro viruses are taken up by axon terminals and the contained genetic sequences are transported back to the nucleus where the fluorophore is synthesized22. During the same surgery, a 1×4 mm silver-doped GRIN lens with an integrated baseplate and head-bar was implanted directly above the prelimbic region of the mPFC (Fig. 1a). After allowing five weeks for recovery, mice underwent a social memory task with simultaneous behavioral and GCaMP6s recording (Fig. 1b). Regions of interest (ROIs) for neurons active during this task were defined using a constrained non-negative matrix factorization algorithm (CNMF)23. The number of these behaviorally relevant ROIs ranged from 105 – 435 between subjects. These ROIs were exported together with an averaged fluorescence image of the FOV for use in co-registration and spectral detection (Fig. 1c).
Following functional imaging of GCaMP6, we perform spectral imaging using a confocal microscope and unmix the fluorophores. To minimize the time-dependent changes of GCaMP during this protocol, we silenced the cortex by anesthetizing the animal with ketamine, and to minimize any motion, head-fixed the animal under the confocal microscope. Using the parameters determined when measuring GRIN-related chromatic effects, multiplexed spectral z-stack images were taken for the entire FOV under the GRIN lens (Fig. 1d, e, 3a). We performed a rolling ball background subtraction on the individual z-planes to reduce neuropil interference and subsequently summed the slices along the z-axis to nullify the effect of chromatic z-aberration. Next, we determined the linear transformations (xy-shift and rotation) necessary to co-register the two imaging platforms (Fig. 1f) using the 512 nm emission spectral bin from the 405 nm excitation laser as the confocal reference image together with the temporally averaged GCaMP miniscope image. After applying these transformations to the GCaMP ROIs from the behavioral recordings, we used the resulting coordinates to extract localized multiplexed spectral data for each ROI, averaging the pixels to create a unique spectral curve for each.
Spectral unmixing of in vivo ROI fingerprints
We then unmix the spectral data to identify which of the ten different fluorescent proteins were present in each ROI. To do so, we modeled the ROI spectral curve by a simple linear regression algorithm, which determines the contribution of each fluorophore by best fitting a multiplier (beta) for each of the known spectral fingerprints (Fig. 1h, Fig. 3b). After fitting beta multipliers for each ROI, the spectral baseline was calculated by averaging the beta multipliers for each fluorophore over all ROIs in the FOV. This was done individually for each animal subject, as the spectral background depended strongly on varying expression of fluorophores within the FOV (Supp. Fig. 3a–e). A ROI was considered a hit for a fluorophore if the beta multiplier was 1.5 standard deviations above the mean beta multiplier for that fluorophore (Fig. 1h, 3c). In the case of multiple hits, the fluorophore matching the highest deviating beta multiplier was regarded as the primary hit.
Fig. 3: Identification of 9 fluorophores through GRIN lenses in vivo.
a, In vivo multiplexed lambda imaging paradigm. Schematic of multiplexed lambda imaging (left). Depiction of overlapping fluorophore spectral emissions for each excitation laser wavelength (middle). Depiction of multiplexed lambda spectral images which create a 204-dimensional set (right). b, Linear regression modelling. Spectral fingerprints from single fluorophore samples are fed to the linear model where best-fit beta multipliers are determined for each fluorophore to ascertain the fluorophore makeup of each experimentally collected ROI. c, Beta multiplier values (shown as standard deviations above the mean) for example ROI 28 from animal subject YAS21272R, which is a positive hit for FusionRed (top). The spectral fingerprint for ROI 28 compared to the average spectral fingerprint from all ROIs from the same animal subject (bottom). n=435 ROIs. d, Beta contribution for a modeled condition where fluorophores were equally distributed compared to experimentally derived beta contributions. e, Modeled condition where fluorophores were over-represented to compare hit accuracy in both the single and dual pass approach. f, Hit accuracy broken down by fluorophore to compare correct hit, false negative, and false positive rates. Hit accuracy is shown for the two approaches using mNeptune as an example: the single pass is shown for a condition where 60% of ROIs are mNeptune2.5 and the dual pass is shown with 80% of ROIs as mNeptune2.5. g, Thresholds used to assign positive fluorophore hits for the first and second pass of analysis, shown using ROI 245 as an example which becomes a hit for mOrange2 after the threshold is lowered during the second pass. h, Representation of the modeled experimental conditions where ROIs of known spectra are distributed to mimic the distribution in YAS21272R and actual background, GCaMP background, and white noise is added. i, Breakdown of correct, false positive, and false negative hits using the dual pass approach in an experimentally modeled condition.
We then unmix the spectral data to identify which of the ten different fluorescent proteins were present in each ROI. To do so, we modeled the ROI spectral curve by a simple linear regression algorithm, which determines the contribution of each fluorophore by best fitting a multiplier (beta) for each of the known spectral fingerprints (Fig. 1h, Fig. 3b). After fitting beta multipliers for each ROI, the spectral baseline was calculated by averaging the beta multipliers for each fluorophore over all ROIs in the FOV. This was done individually for each animal subject, as the spectral background depended strongly on varying expression of fluorophores within the FOV (Supp. Fig. 3a–e). A ROI was considered a hit for a fluorophore if the beta multiplier was 1.5 standard deviations above the mean beta multiplier for that fluorophore (Fig. 1h, 3c). In the case of multiple hits, the fluorophore matching the highest deviating beta multiplier was regarded as the primary hit.
Assessment of spectral unmixing approach
To determine the accuracy and robustness of our fluorophore identification algorithm component of Neurocipher and to test for any weaknesses, we created a control dataset with well-known fluorophore status. For this, we expressed each fluorophore individually in HEK293T wells and measured spectral fingerprints from a multitude of cells within each well. Test datasets were then created by combining spectral fingerprints from randomly sampled HEK293T cells, allowing for any composition of fluorophores, as well as the addition of specific perturbations, such as white noise, increased GCaMP background fluorescence, or the combination of multiple spectral fingerprints in one ROI.
For test datasets comprising equal distributions of single-fluorophore expressing cells, the algorithm determined the baseline beta contribution (percent of total) to be approximately 10% for each of the ten fluorophores, reflecting the actual composition. The accuracy of correctly identifying each fluorophore was close to 100%, with negligible differences between individual fluorophores. As expected, however, under true experimental conditions the spectral background was not evenly distributed and varied from animal to animal (Fig 3d). Therefore, we next modeled conditions where ROIs of a single fluorophore made up an increasingly higher percent of the population. Notably, once a single fluorophore surpassed 30% of the population, the algorithm’s ability to correctly identify ROIs of the over-represented fluorophore drastically reduced (Fig. 3e, Supp. Fig. 4a). Upon further investigation, we found that although the algorithm retained a near perfect accuracy identifying the other fluorophores, it could no longer pick out the over-represented fluorophore and instead returned a false negative (no match) for most of these ROIs (Fig. 3f).
To recover these false negatives without sacrificing the high identification accuracy of the other fluorophores, we implemented a dual-pass approach. Any ROI that the algorithm cannot match during the first pass undergoes a second, almost identical, identification step, where the static identification threshold of 1.5 standard deviations above the mean are modified to reflect the measured contribution of each fluorophore’s beta values (Fig. 3g). We tested this dual-pass approach by analyzing modeled data of differing concentrations of fluorophores and were able to correctly identify over 90% of ROIs expressing over-represented fluorophores, even for single fluorophore concentrations of 80%, while retaining the single-pass accuracy to detect all other fluorescent labels (Fig 3e, f, Sup. Fig. 4a).
Next, we tested the impact of spectral background on the robustness of the algorithm. Interestingly, the effects on the single- and dual-pass algorithms were almost identical. First, we modeled conditions in which the fluorophore signal was tainted with increasing amounts of GCaMP background (Supp. Fig 4b). The identification accuracy declined only slowly and remained above 80% even when GCaMP was the same intensity as the co-expressing fluorophore. Importantly, the increasing GCaMP signal only obscured the primary fluorophore signal without leading to an increase in false positives (incorrect identification). We then modeled conditions where cells with different fluorophores overlapped to varying degrees (Supp. Fig. 4c). As expected, when fluorophore background reached 50%, our ability to correctly identify hits was reduced to approximately 50% with the error being almost always a false negative. Next, we modeled increasing levels of Gaussian white noise (Supp. Fig. 4d). The identification accuracy declined slowly, however, this condition also led to an increasing number of misidentified (false positive) fluorophores, with about 10% of false positives and an overall accuracy of 80%, even at poor signal to noise levels.
Finally, we estimated our fluorophore identification accuracy within an actual experiment by simulating a condition that mimicked an animal subject: known fluorophore ROIs were randomly sampled at the experimentally measured distribution, and we added experimentally measured spectral background and GCaMP signal at an average rate of 30%, and Gaussian white noise set at 6 signal to noise ratio (Fig. 3h). Overall, the dual pass analysis correctly identified 87% of all ROIs and had less than 5% false positive cases with some fluorophores having higher fidelity than others (Fig. 3i).
Detection of two fluorophores within the same ROI
So far, we have focused on identifying a single fluorophore alongside the GCaMP signal. But considering that excitatory neurons rarely innervate only one downstream region and can have axons with en passent boutons to synapse along a single route or bifurcating axons to reach spatially distinct areas, then certain neurons may express additional labels. To determine whether the algorithm would be able to identify two fluorophores within the same ROI, we simulated a dataset with ROIs expressing all combinations of two different fluorophores, alongside ROIs containing only a single fluorophore (Supp. Fig. 5a). Overall, the algorithm was able to correctly identify at least one fluorophore in 98% of the ROIs, and both fluorophores in 44% of the cases. As could be expected, the algorithm was less able to distinguish two spectrally similar fluorophores, such as mScarlet and FusionRed, but was more successful with spectrally distinct fluorophore combinations, like mScarlet and mVenus. When errors did occur, the algorithm almost exclusively returned false negatives (unmatched) as opposed to misidentifying the fluorophores present and returning false positives. Finally, we modelled the case of dual-expressing ROIs under approximated experimental conditions by adding experimentally measured spectral background, GCaMP co-expression, and Gaussian white noise (Supp. Fig. 5b). Even under these conditions, our identification algorithm remained robust and successfully identified at least one correct fluorophore of the pair in 91% of the ROIs and, in ROIs where two should be present, both fluorophores in 25%. In ROIs where no second fluorophore existed, a false positive was found at a rate of 17%. The overall false positive rate was 14%, with 5% of those false positive results occurring within the primary hit and 9% in the secondary hit.
Fluorophore distribution in behaviorally relevant ROIs
To better assess and distinguish between the influence of injected brain region and specific fluorophore on number of positive fluorophore matches, we split the five mice into two distinct groups (Fig. 4a–b). Both groups were injected with the same nine AAVretro fluorophores, but we altered the pairing between fluorophore and brain region. Fluorophores with low match rates in the first group (Fig. 4a) were subsequently injected in well-performing brain regions in the second group (Fig. 4b).
Fig. 4: Distribution of fluorophore-positive functionally defined ROIs.
a, Identified fluorophores for injection Paradigm A. Viral Injection Paradigm A consisted of mTagBFP2 into the dPAG, mTurquoise2 into the BLA, T-Sapphire into the Cla, mVenus into the NAc, mOrange2 into the Str, mScarlet into the LC, FusionRed into the VTA, mCyRFP1 into the LHb, and mNeptune 2.5 into the c-mPFC (left). Spatial distribution of ROIs and respective fluorophore matches overlayed on anatomical images from the same mouse (right). Distribution of identified fluorophores per mouse (inset). b, Identified fluorophores for injection Paradigm B. Viral Injection Paradigm B consisted of mTagBFP2 into the c-mPFC, mTurquoise2 into the LHyp, T-Sapphire into the Str, mVenus into the VTA, mOrange2 into the LC, mScarlet into the dPAG, FusionRed into the BLA, mCyRFP1 into the NAc, and mNeptune 2.5 into the Cla (left). Spatial distribution of ROIs and respective fluorophore matches overlayed on anatomical images from the same mouse (right). Distribution of identified fluorophores per mouse (inset). Color and letter codes for fluorophores and injection regions, respectfully (far right). c, Percent of ROIs with a fluorophore match. Animal n = 5, ROI n = 1,271. d, Percent of cells identified for each fluorophore. Letter insets on individual data points correspond to injected regions. N = 954. One-way ANOVA p = 0.0001. e, Percent of cells identified for each injected region. Number insets on individual data points correspond to injected fluorophore. N = 954. Mean +/− SEM. One-way ANOVA p = 0.0349. Scale bars = 100 μm.
Across animal subjects, the Neurocipher matched 70% of ROIs to one of the AAVretro fluorophores (Fig. 4c), identifying between seven to nine of the injected AAVretro fluorophores in each, with no correlation to injection paradigm (Fig 4, Supp. Fig 3). There was some variability in the detection frequency of the fluorophores which could not completely be explained by the injected brain region. For example, mVenus and T-Sapphire were detected at the highest frequencies, though while T-Sapphire was injected into brain regions which were populous regardless of fluorophore pair, mVenus was detected at a higher rate when directly compared to the other fluorophore injected into the same brain region. Alternatively, FusionRed and mCyRFP1 were detected at the lowest frequency which is most likely due to their quantum efficiency as they were injected into brain regions which had high detection frequency with their other fluorophore pair (Fig. 4d). Fluorophores depicting projections to the Cla, Str, and VTA were the most identified projection neuron types, unsurprising as these regions are known to have dense innervation by the PL. However, fluorophores depicting c-mPFC and lHB projection neurons were identified at a lower frequency than expected, perhaps due to low quantum efficiency of their fluorophore pairs. Fluorophores depicting dPAG projection neurons were also detected at a low frequency, though this may be accounted for by the distinct localization of these projection neurons in deeper layer 5 of the cortex which was on the outer edge of GRIN implant and therefore subject to the most severe area of GRIN induced astigmatism and Petzval aberration (Fig. 4e).
When we explored the frequency of secondary hits, we found that 40% of the functionally determined ROIs had beta multipliers above threshold for an additional fluorophore (Supp. Fig. 5c). Fluorophores which most had secondary hits were those on the far ends of the spectrum including mTagBFP2, mTurquoise, mCyRFP, and mNeptune2.5 (Supp. Fig. 5d). When considering experimental conditions with large background, it is likely that these fluorophores were the most permitting of secondary signals as they produced less peak interference for the identification algorithm. Regarding brain regions, dPAG, c-mPFC, and BLA-projecting neurons had the most occurrence of secondary hits (Supp. Fig. 5e). The distribution of co-expression, however, did not match previously published descriptions of projection specific neurons and their projection patterns24. This is most likely due to differential expression of fluorophores and the differential ability to discern these fluorophores when co-expressed with one another. For studies in which identifying several fluorophores within one ROI is important, altering the experimental approach is recommended.
Neuronal cell-types and behavior
Our functionally relevant ROIs were obtained during a social memory task in which animals were trained to recognize an initially novel mouse and were subsequently tested in a freely moving assay where both the trained mouse and a second novel mouse were introduced to the behavioral box (Supp. Fig. 6a). We utilized conventional methods to determine neurons that statistically modified their firing rate during specific behaviors. We then delineated the neurons by projection-region and demonstrate the ability of Neurocipher to identify unique attributes of each type. For example, in these animals NAc-projecting neurons were statistically tuned to social interactions with either familiar or novel conspecifics (Fig. 5a, c). Alternatively, LC-projecting neurons were selective for aggressive versus investigative social interactions (Fig. 5a). Furthermore, certain populations display greater selectivity for what behaviors they encode compared to others, as shown by looking at the number of distinct behaviors for which individual neurons statistically modified their firing rate. Indeed, lHyp-projecting neurons are either not tuned or tuned to only one specific type of behavior while some Str-projecting neurons can be tuned to up to 6 unique behaviors (Fig. 5b, c). While examples of tuned neurons of each type could be found for most behaviors, encoding was enhanced in certain populations. Using this approach, our results indicate that Str-projecting neurons tune to aggressive behaviors, most notably with familiar conspecifics (Fig. 5c and Supp. Fig. 6b) by statistically decreasing their firing rate (Supp. Fig. 6b.)
Fig. 5: Neuronal cell-types vary in behavioral encoding.
a, Representative trace (left) and averaged Δf/f traces (right) of calcium transients time-locked to behavioral annotations. Top traces depict a nucleus accumbens-projecting neuron with annotations denoting social interaction with either a familiar (black) or novel (grey) conspecific. Bottom traces denote a locus coeruleus-projecting neuron with annotations denoting aggressive (black) or investigative (grey) social interactions, regardless of conspecific target. Scale bars = 10 Δf/f y-axis, 2 seconds x-axis (left) and 5 Δf/f y-axis, 1 second x-axis (right). N = 34 behavior epochs for familiar, 38 epochs for novel, 32 epochs for aggressive, and 53 for investigative interactions. Mean +/− SEM. Two-sided t-test p= 0.0011 familiar max response vs. novel, p = 0.049 aggressive vs. Investigative. b, Distribution of the number of different behaviors for which each neuronal cell-type statistically modifies its firing rate. c, Schematic of neuronal cell-types and the behavioral categories for which each cell encodes.
Discussion
Here we present Neurocipher, a pipeline enabling the distinction of 10 fluorophores including GCaMP through implanted GRIN lenses that enables the classification of behaviorally relevant ROIs into neuronal subtypes. By imaging neural activity of multiple subtypes simultaneously in the same subject, direct comparisons of temporal dynamics and magnitude of responses are achievable. Thus, this technique will allow for fine-tuned dissection of neural encoding of complex behavioral tasks.
The ability to co-register multiple fluorophore markers with functional calcium data will substantially enhance not only the throughput of neural activity studies but the statistical strength of the findings. By using a multiplexed spectral imaging approach and selecting fluorophores with unique spectral fingerprints, we were able to identify nine fluorophores co-expressed with GCaMP with few hit overlaps. By using beta multipliers determined by a linear regression, we calculated the relative weight of each fluorophore within a ROIs spectral curve. Spectral ROI curves recorded in vivo displayed a disparate mix of contributing fluorophore signals, stemming from extra-somatic fluorophore expression in the surrounding brain tissue. As a result, the average spectral background was highly variable from subject to subject, heavily influenced by varying fluorophore expression levels. We therefore only considered beta multipliers significantly above the spectral background to be relevant, leading to a conservative hit rate that favors missing labels (false negatives) over misidentifying cells (false positives). Using nuclear-tagged fluorophores in future studies would reduce background contamination especially for bright fluorophores with strong signal near the soma, reducing variability and the rate of false negatives.
By modeling different variables in simulated conditions, we determined which perturbations produced what types of errors in our fluorophore identification algorithm. Overall, the algorithm heavily favors false negatives to false positives when errors do occur, preferring to identify fewer cells with higher accuracy. Increasing spectral background primarily reduces the chance to identify a fluorophore, whereas white noise also increases the number of false positives. Under simulated experimental conditions, our accuracy was 87% with less than 5% false positive cases when we only considered a single hit per ROI. The algorithm can potentially identify multiple fluorophores within one ROI, at the cost of higher false positive rates. If dual expressing ROIs is a focal point of an upcoming experiment, the accuracy and efficiency of the identification algorithm could be increased by carefully selecting fluorophore pairs that can be easily distinguished as well as by reducing the number of secondary fluorophores.
While several other studies have successfully identified neuronal subtypes from functional data, the approach has been to utilize immunohistochemistry or in situ labeling in post-mortem brain tissue collected from the subject after a behavioral task. However, the process of co-registration between images obtained through GRIN lenses in a living brain and those obtained from mounted fixed tissue is exceptionally arduous and error prone. This is in part due to the GRIN lens induced astigmatism and Petzval aberration of the FOV and in part due to the non-uniform warping of brain tissue during fixation, staining, and mounting. Studies using this co-registration approach have painstakingly applied non-linear warping to each image, determined manually by trial and error. While incredibly time consuming, this approach has low fidelity and many sections from valuable subjects are unable to be registered, in addition lending low confidence in the accuracy of the remaining registered sections. Our method co-registers images that are both obtained through GRIN lenses, using the same FOV, in living tissue, and matched resolution between the two modalities. When care is taken to keep the GRIN lens clean and images taken where the GRIN is parallel to the detector, a nonlinear warping is strictly unnecessary and co-registration requires slight linear transformations including scaling and image flipping (conserved between subjects), as well as x/y adjustments (unique to subject and imaging day). Using anatomical landmarks, we are confident that co-registration using this technique is accurate.
While imaging neuronal subtypes in living mice allows for easier co-registration, it also enables repeated imaging and use of valuable test subjects. This would permit experimenters to check fluorophore expression and distribution in each subject before conducting lengthy behavioral testing or longitudinal studies. One consideration, however, regarding imaging a subject on the confocal more than once is that the subject needs to be anesthetized for each multiplexed spectral imaging session. Anesthetization during this step is critical if using fluorophores that have spectral overlap with GCaMP as the large transient changes in fluorescence intensities both occlude less bright fluorophores and interfere with the linear regression.
Neurocipher is not limited by the type or dimensions of the implanted GRIN lens, and, can also be used in conjunction with cranial windows as opposed to GRIN lenses. While all the lenses we tested were viable, their trade-offs varied. We opted to use the most common 1 mm x 4 mm silver-doped GRIN lenses despite their inferior spectral characteristics in comparison to lithium-doped lenses. Indeed, the lithium-doped lenses displayed significantly lower spectral aberrations, wavelength-dependent transmission as well as lower background fluorescence, however these lenses struggled with significantly lower numerical aperture (NA) and thus produced much dimmer signals. In practice, if the spectral shifts do not exceed the travel capacity of the microscope z-drive, and the NA does not hinder recordings, any GRIN lens should be viable for use assuming the proper chromatic corrections are applied.
Neurocipher is scalable and can be easily modified to fit unique experimental goals. Here, we wanted to identify as many mPFC projection-specific pyramidal subtypes as possible. Because the mPFC has many of these unique types, we needed to utilize all nine fluorophores. However, other applications may need to identify fewer subtypes, enabling the experimenters to select the best performing and more spectrally distinct fluorophores (see Table 1). Fluorophore choice is also influenced by the laser lines and emission detectors available on individual confocal microscope systems. One fluorophore addition if systems are equipped with a near infrared detector would be iFP2.0, an infrared fluorophore which would emit at a higher efficiency at wavelengths in the 700–740 nm wavelength compared to mNeptune 2.5 We have demonstrated the efficacy of this approach by labelling nine pyramidal neuron subtypes in the mPFC determined by their projection region. Together, this methodological pipeline opens the possibilities for circuit-level dissections of neural representations of behavior.
Table 1: AAVretro fluorophore evaluation.
| Fluorophore | Laser | Interfering Fluorophore | Reason for ranking |
|---|---|---|---|
| mOrange2 | 514 nm | NA | Bright, distinct |
| mTagBFP2 | 405 nm | NA | Several distinct bins |
| mVenus | 514 nm | NA | Bright |
| mTurquoise2 | 405 nm *Would benefit from 455 nm |
mTagBFP2 & T-Sapphire | Neutral |
| T-Sapphire | 405 nm | NA | Neutral |
| FusionRed | 594 nm | mScarlet | Underperformer, slightly dim |
| mScarlet | 561 nm | MOrange2 & mNeptune | Cross talk |
| mNeptune2.5 | 639 nm | mScarlet | Dim, cross talk |
| mCyRFP2 | 488 nm | NA | Very dim |
Materials and Methods
Code Repositories
Neurocipher: https://github.com/PhillipsML/MultiColorGrin
Calcium / Behavior Correlation: https://github.com/MetaCell/Zeiss-Data-Science
Mice
All experimental procedures were approved by the Max Planck Florida Institute for Neuroscience Institutional Animal Care and Use Committee and were performed in accordance with guidelines from the US NIH. Mice were group housed in 12h light-dark cycle with food and water ad libitum. The mice used in this study resulted from crossing heterozygous or homozygous B6.DBA-Tg(tetO-GCaMP6s)2Niell/J mice (JAX 024742) to heterozygous B6.Cg-Tg(Camk2a-tTA)1Mmay/DboJ (JAX 007004).
Fluorophore selection
Initial selection
Fluorophores were identified based on spectral profiles published on fpbase.com and chosen for further study based on the specific spectral fingerprints we hypothesized would be distinguishable by multiplexed spectral imaging. These fluorophores included: mTagBFP2, mTurquoise2, T-Sapphire, mVenus, mPapaya, mOrange2, mScarlet, FusionRed, mCyRFP1, and mNeptune2.5.
In vitro expression
Vectors containing the identified fluorophores obtained from Addgene (Addgene.com) were cloned into plasmids under the CMV promoter. HEK293T cells (GE Dharmacon, Fischer Scientific) were cultured in DMEM supplemented with 10% FBS at 37°C in 5% CO2 and transfected with plasmids using Lipofectamine 1000 (Invitrogen). Imaging was performed 24–48 h following transfection. HEK Cells were used as an expression platform only and were not rigorously tested for potential contamination from other cell lines.
Viral construction and evaluation
Plasmids encoding mTagBFP2, mTurquoise2, T-Sapphire, mPapaya, mOrange2, mScarlet, FusionRed, mCyRFP1, and mNetune2.5 were introduced into a hSyn-mVenus vector, replacing the mVenus sequence. The resulting vectors were used to create AAVretros (UNC vector core). Each virus was tested by injecting into the right medial prefrontal cortex of a wildtype mouse. After waiting three weeks for expression, mice were sacrificed and 100 μm sections of the medial prefrontal cortex made. Fluorophores were evaluated for expression levels, brightness, photostability, and neuronal health. mPapaya was excluded from further experiments due to excessive neuronal death after injection.
Surgery
Mice were anesthetized with 4% isoflurane vapor in 100% oxygen gas and maintained with 1–2.5% isoflurane vapor in 100% oxygen gas mixtures. Mice were aligned in a stereotactic frame (Kopf Instruments), and their body temperature was measured with a rectal probe and maintained with a heating pad. Warmed sterile saline was injected subcutaneously at a rate of 0.1 mL/hour to maintain hydration. Additionally, mice received subcutaneous injections of carpofen (5mg/kg) and dexamethasone (0.2 mg/kg) to reduce inflammation.
For viral evaluation
A midline incision was made down the scalp, and a dental drill was used to perform a small craniotomy over the right medial prefrontal cortex. A 2.5 μL syringe (Hamilton Company) was used to inject 250 nL of virus at a rate of 0.25 μL/min using a microsyringe pump (UMP3 UltraMicroPump, Micro4; World Precision Instruments), for coordinates see Table 1. The needle was slowly extracted from the injection site over 10 min. The scalp was closed using surgical glue.
For multi-color GRIN experiments
A midline incision was made down the scalp, the scalp scored with a razor blade, and a dental drill used to perform a small craniotomy over the target area. A 2.5 μL syringe (Hamilton Company) was used to inject viruses at a rate of 0.25 μL/min using a microsyringe pump (UMP3 UltraMicroPump, Micro4; World Precision Instruments), see Table 2 for coordinates and volumes. The needle was slowly extracted from the injection site over 10 min. This injection procedure was repeated for each of the 9 fluorophore viruses, each injected into a unique region. Once all viral injections were complete, a 1.2 mm diameter craniotomy was performed over the mPFC and the dura carefully removed. A custom-made metal probe measuring 1mm in diameter was lowered at a rate of 100 μm/min to reach x 300 μm above the desired imaging plane. The probe was left in place for 15 minutes before being retracted slowly over 10 minutes. Immediately, a 1 mm x 4 mm silver-doped GRIN lens with integrated baseplate (“1×4 mm regular”, Inscopix) and head-bar was lowered into place at a rate of 100 μm/minute. Any area between the craniotomy and GRIN lens was sealed with silicone (KWIK-SIL, World Precision Instruments) after which the implant was secured in place using dental cement. The skin was sutured around the implant (DemeTech). Mice were given at least 5 weeks to recover from surgery before use in experiments.
Table 2: Injection coordinates.
| Acronym | Region | Angle | Medial/Lateral | Anterior/Posterior | Dorsal/Ventral | Volume |
|---|---|---|---|---|---|---|
| dPAG | Dorsal periaqueductal gray | 26° | 1.18 | −4.2 | 2.36 | 300 nL |
| BLA | Basolateral amygdala | 0° | 2.95 | −1.6 | 3.8 3.3 |
250 nL 250 nL |
| NAc | Nucleus accumbens | 0° | 1.0 | 1.3 | 4.0 3.5 |
250 nL 250 nL |
| Str | Striatum | 0° | 1.25 | 1.3 | 2.5 2.0 |
250 nL 250 nL |
| Cla | Claustrum | 0° | 2.2 | −1.7 | 2.6 | 300 nL |
| LHyp | Lateral hypothalamus | 0° | 1.1 | −1.3 | 5.3 4.75 |
250 nL 250 nL |
| LHb | Lateral habenula | 0° | 0.5 | −1.6 | 2.75 2.5 |
250 nL 250 nL |
| LC | Locus coeruleus | 0° | 0.8 | −5.3 | 3.0 3.0 |
250 nL 250 nL |
| VTA | Ventral tegmental area | 0° | 0.45 | −3.0 | 4.25 3.45 |
250 nL 250 nL |
| c-mPFC | Contralateral medial prefrontal cortex | 0° | 0.4 | 1.5 | 1.45 | 300 nL |
Mouse perfusion
Mice were anesthetized with an intraperitoneal (i.p.) injection of a ketamine (100 mg/kg) and xylazine (50 mg/kg) and transcardially perfused with ice-cold 1X phosphate-buffered saline (PBS), followed by ice-cold 4% paraformaldehyde (PFA) in 1X PBS. The brain was dissected and postfixed in 4% PFA overnight. Brains were sectioned at 100 μm thickness with a vibratome (VT 1200, Leica) and mounted with Vectashield mounting media (Vector Biolabs, Malvern, PA).
Behavioral experiments
Testing
One week prior to testing, the back of sentinel mice was dyed with blond hair dye (Born Blonde Maxi, Clairol) with differing patterns for tracking by computer vision. The behavioral paradigm was 5 days in duration, with one behavior session per day. At the beginning of each behavioral session, test mice were acclimated to the behavioral chamber alone for 10 minutes. On days 1–4, the same initially novel sentinel mouse was added to the behavior chamber following the acclimation period and allowed to freely interact for 10 minutes. On day 5, the trained sentinel mouse and a second novel sentinel mouse were added to the behavior chamber following the acclimation period and allowed to freely interact for 10 minutes. The test box was cleaned and filled with new bedding between each test mouse. Each sentinel mouse interacted with a maximum of 3 test mice. Custom-written MATLAB (Mathworks) code was used to record behavioral videos at 20Hz.
Analysis
After all mice had been tested, sentinel mice were individually videotaped for 10 min for training the computer. Individual and test videos were fed to the Motr program (https://github.com/motr/motr29) to create tracks that were sent to JAABA (https://github.com/kristinbranson/JAABA30) for unbiased computer identification of behaviors. JAABA classifiers were trained on pilot data sets.
Imaging
In vivo calcium imaging using the miniscope
On each day of behavioral experimentation, the miniscope was mounted on the implanted GRIN lens and baseplate immediately prior to the mouse being placed in the behavioral chamber. Custom-written MATLAB code triggered simultaneous video acquisition and nVoke2 (Inscopix) calcium recording, both recording at 20 Hz sampling rate. Parameters of the miniscope, such as the LED power, the gain, and the electronic focus, were adjusted on a mouse-to-mouse basis but otherwise kept consistent for the 5 sequential days of behavioral testing.
Acquired calcium transients, concatenated per recording day with each recording day consisting of the acclimation and behavior time, were processed in the Inscopix Data Processing Software (IDPS, Inscopix). First, the traces were spatially down sampled by a factor of 2, then pre-processed, spatially filtered, and motion corrected. Individual cells were identified using a constrained non-negative matrix factorization algorithm (CNMF). Traces with abnormal physiological calcium transients (i.e., transients lasting over one minute) were excluded. For co-registration purposes, the motion-corrected video was temporally averaged into an image depicting anatomical landmarks. ROIs generated by the CNMF, and their corresponding calcium traces were also exported.
Multicolor volumetric confocal imaging
The post-behavioral confocal imaging was performed using a LSM 980 confocal microscope on an Examiner Z.1 upright stage. The mouse treadmill was inserted directly onto the xy-mechanical stage, bypassing the z-piezo stage. Images were taken using a 10x, NA 0.4 objective lens (C Epiplan-Apochromat, 422642–9900, Zeiss), and utilizing both multialkali PMTs (Ch1 & Ch2) and the GaAsP detector (ChS), spanning a wavelength range from 350 nm – 750 nm. All six excitation lasers (405, 488, 514, 561, 594, and 639 nm) were used during volumetric spectral imaging. The pinhole was set to ‘optimal’ when imaging without GRIN lens, and to 350 μm when imaging through a GRIN lens. Detector gain voltages and laser powers were set for each animal to prevent detector saturation for the brightest spectral channels and kept constant for each multiplexed spectral image. MBS was set to 405, 488/561/639, or 455/514/594 depending on the excitation laser used. No dichroic SBS was used. Imaging parameters included a zoom setting of 1, no averaging, and a scan speed setting of 5.
GRIN lens optical transmission determination
A custom-built GRIN lens micromanipulator (MPFI) was used to suspend the GRIN lens above a platform. Using a photodiode power sensor (S121C, Thorlabs) and power meter (PM100D, Thorlabs), we recorded the laser power of the LSM 980 excitation lasers (Zeiss) out of the objective lens, first directly and second after focusing through a GRIN lens. The percent difference in these values was used to calculate the wavelength-dependent transmission through the GRIN lens. The data was fit to a second order polynomial, and subsequently used to pre-adjust the intensity of each excitation laser to ensure wavelength-independent laser power on the sample.
Measuring GRIN-induced chromatic aberrations
Using a custom-built GRIN lens micromanipulator (MPFI), the GRIN lens was centered and suspended over the fluorescent “field of rings” pattern on an Argo-LM v2.0 slide (ArgoLight). The pattern was imaged through the GRIN lens using a 10x objective lens (0.4 NA, C Epiplan-Apochromat, Zeiss). The upper and lower z-stack limits were set using the 405 and 639 lasers, respectively, after which the entire z-stack was imaged at 5 μm intervals for each excitation laser (405, 488, 514, 561, 594, and 639 nm). To determine the chromatic shifts along the optical axis the z-plane with the brightest intensity for the center cross was determined to be the focal plane for each laser wavelength, and the z-aberration non-linear distribution was fit to these values using a second order polynomial. There were negligible chromatic aberrations in the optical plane (i.e., the x/y dimensions).
Multiplexed spectral imaging technique
To enable discrimination of all 10 fluorophores, we utilized a “multiplexed spectral imaging” technique. This involved sequentially imaging the same field of view using 6 different excitation lasers (405, 488, 514, 561, 594, and 639 nm) while detecting the emission in spectral mode using both multialkali and the GaAsP PMTs, together collecting the fluorescence emissions in 34 separate spectral bins. The bin widths were approximately 10 nm between 400 to 695 nm (longer wavelengths have larger emission bins) using the GaAsP detector, with the multialkali PMTs spanning the wavelengths from 350 nm – 400nm and 695 – 750 nm, respectively. This resulted in a spectral fingerprint consisting of 204 measurements each (6 excitation lasers x 34 emission bins).
Spectral fingerprint generation
After allowing 24 hours for expression, wells containing fluorophore expressing HEK293T cells were rinsed and filled with imaging buffer. Wells were imaged on a Zeiss 980 at 10x magnification using the multiplexed spectral technique. Laser powers were determined per sample but kept the same for each excitation laser. The pinhole was set to optimal and one focal plane and field of view was taken per sample.
For each fluorophore, the 6 corresponding images were imported into Fiji (ImageJ). The image with the highest intensity was selected and then thresholded to isolate cells from background. The cell detection module was used to determine ROIs. The 204-point spectral fingerprint of each fluorophore was determined by averaging the multiplexed spectral traces from all ROIs from a single sample.
In vivo multiplexed spectral imaging
Mice were anesthetized with an i.p. injection of ketamine (100 mg/kg) and xylazine (10 mg/kg) to reduce high-intensity fluctuations of GCaMP6s transients, though low-intensity slow-wave fluctuations remained. The GRIN lens was thoroughly cleaned with isopropanol and water and the mouse was head-fixed on a custom treadmill (MPFI). The temperature was monitored and maintained with hand warmers (Hothands). Images were obtained using the multiplexed lambda technique on a Zeiss 980 confocal microscope running the ZEN Blue software. Using 10x magnification, the objective pinhole was set to 350 μm to minimize chromatic z-dimensional aberration of emission introduced by the GRIN lens. For each mouse, z-range was set by utilizing the 405 nm and 639 nm excitation lasers to account for the remaining chromatic z-dimensional aberration and sampled at 5 μm intervals with the typical range being 48 slices or 253 μm. The maximum intensity of all fluorophores was found, and the laser power of the corresponding laser was set to avoid over saturation. Using this laser value, the remaining laser values were adjusted to account for differing wavelength-dependent transmission of the GRIN lens except for the 639 nm laser. Because Neptune 2.5 is the only fluorophore to emit following 639 nm excitation, and due to the reduced efficiency of its excitation at this wavelength, we consistently set the 639 nm laser to 40% power across all mice. Beginning with the 405 nm laser and progressing sequentially, we recorded the entire z-stack in lambda detection mode for each laser. If high-intensity fluctuations for GCaMP were observed, the mouse was recorded on a subsequent day to eliminate these as much as possible.
In post-processing, spectral z-stacks from each laser were cropped in the z dimension to remove any planes that produced large amount of noise, any cropping was done to all images from the same mouse. Background subtraction was performed to reduce non-somatic signals. A summed z-projection for each excitation laser stack was used for the spectral analysis.
Coregistration of functionally defined neurons
nVoke registration across days
Averaged temporal projection images for each recording day from the motion-correction stage of the IDPS analysis were imported into MATLAB and a custom code utilized to determine the x/y shift between images. There was no observed rotation or scaling differences between imaging days. The x/y shifts were applied to all ROI coordinates. All transformation coordinates were set to match the image from Day 5 of recordings.
nVoke to Zeiss registration
Temporal projection images from Day 5 of miniscope recording were overlaid onto an anatomical image taken from the confocal multiplexed spectral images. We typically found that the image from the 514 spectral bin using the 488-excitation laser matched the nVoke anatomical image well.
First, the miniscope images were flipped both horizontally and vertically, then scaled by a factor of 1.92x. The scaling factor was determined by affixing the GRIN lens to the custom-built micromanipulator and imaging the field of rings calibration pattern on the Argo-LM slide, first with the miniscope attached to the GRIN lens baseplate, then using the Zeiss LSM 980. Afterwards, only minor translation and rotation in the optical x/y plane were necessary to overlap both images. No non-linear transformations were performed, as they were found to be unnecessary. Linear transformations were also applied to the across-day aligned ROI coordinates for each mouse.
Overlapping ROIs from the miniscope recordings were heat mapped using a custom code; ROIs that overlapped more than 70% were considered to be the same cell and ROIs merged. ROIs that overlapped but did not meet the percentage criteria were manually watershed to produce two cell regions. These summed and registered cell ROIs were used as a template to pull spectral information from ZEISS multiplexed lambda images.
Fluorophore identification
Modeling of experimental variables to assess accuracy of algorithms
To assess how the fluorophore identification algorithm was performing, we utilized wells containing single-fluorophore expressing HEK293T cells imaged using the multispectral approach. We created a library of individual ROIs from each well and randomly sampled these ROIs to create simulated datasets. Each simulation evenly distributed the desired manipulation to ROIs of each fluorophore and was conducted in replicates of 100. Fluorophore matches assigned by the algorithm were compared to the known ROI identity, allowing us to measure the accuracy by determining the percent of correct matches, false negatives (no match), and false positives (incorrect match). We tested the robustness of the algorithm under different simulated conditions by adding several types of background signal, by considering unequal fluorophore distributions, and by combining ROIs with different fluorophores. GCaMP background involved adding GCaMP spectra at varying intensities compared to average fluorophore intensity, spectral background involved adding signal from equal amounts of all fluorophores and varying the rate compared to average fluorophore intensity, and Gaussian white noise was added at varying signal to noise ratios. Initially, we modeled each condition separately to determine which perturbations created what types of errors. Finally, we simulated an experimental condition by matching conditions within an animal subject as closely as possible. To this end, we recreated the fluorophore population of the dataset to reflect the actual measured hits, added GCaMP background at a level of 30% (the measured peak of GCaMP signal within ROIs), spectral background obtained by averaging all pixels within the GRIN lens FOV at a rate of 30% (measured by comparing the peak intensity of background to the average peak intensity of fluorophore-containing ROIs), and Gaussian white noise at a signal to noise ratio of 6 as an estimation.
We assessed how ROIs containing two fluorophores would be handled by the algorithm by generating a dataset containing ROIs expressing all combinations of two fluorophores. To this end, we randomly selected ROIs from HEK293T wells containing single fluorophores and created new ROIs by summing the spectra from two ROIs with each of the respective fluorophores. The resulting dataset contained equal numbers of ROIs expressing all possible dual-fluorophore pairs and ROIs expressing only a single fluorophore.
Single Pass algorithm
The multiplexed spectral data from the functionally defined ROIs was evaluated to fit to the pure sample fingerprints using a linear regression. Beta values for each fluorophore were generated for ROIs using both the raw emission values (betaraw) and those normalized to maximum intensity (betanorm). For each mouse, a cutoff was determined as 1.5 standard deviations above mean for each fluorophore’s beta values. It was necessary to do this on a mouse-by-mouse basis because background varied based on the number and ratio of neurons expressing fluorophores (Supp. Fig. 3). ROIs with betaraw or betanorm above these thresholds were considered positive for a fluorophore. If the ROI was positive for more than one fluorophore, the match with a value most standard deviations above the mean was taken. Both betaraw and betanorm were used as they were biased for bright and dim ROIs, respectfully. Cutoffs and procedures were evaluated using multiplexed spectral bins where only one fluorophore could be emitting.
Dual Pass algorithm
To reclaim fluorophore hits potentially missed due to over-represented fluorophores by the first pass analysis, we implemented a second identification step for any ROIs which were not assigned a hit by the first pass. This second pass utilized the same linear regression and beta multiplier calculation as the first pass but adjusted these values to correct for uneven fluorophore distribution. To apply the correction, we first modeled a dataset with a perfect distribution of HEK293T cell ROIs from single fluorophore wells. We obtained the average beta multipliers for all ROIs and assessed the beta contribution of each fluorophore as a percent of total. These values were utilized as a theoretical perfect distribution. We then determined the beta contribution for each fluorophore in our experimental conditions and adjusted the cutoff threshold for hits based on the deviation from the theoretical value, resulting in lowered thresholds for over-represented fluorophores.
Linking neural activity to behavior and delineating by cell-type
For each animal and session, a particular set of behaviors were defined depending on the types of sessions. For example, single-animal behaviors (such as moving, still) were defined for acclimation sessions, while social interaction behaviors (such as sniffing or aggression) were defined for training and testing sessions, with potentially different target animals (novel vs. familiar) in testing session.
Then, for each cell and each behavior in each session, a t-test was carried out comparing the mean activity 2.5 seconds before and 2.5 seconds after the onset of behavior with Bonferroni correction accounting for multiple comparisons across different behaviors. If the mean activity was significantly different before and after a given behavior, we mark the cell as responsive to the behavior. The Sunburst diagram visualizes the number of cells that were responsive to different number of behaviors, separated by different brain regions. The Sankey diagram visualizes the relative proportion of cells that were responsive to different behaviors separated by different brain regions.
Supplementary Material
Acknowledgments
We would like to acknowledge David Kloetzer for lab management, Yuki Hayano and Irena Suponitsky-Kroyter for technical assistance, and the MPFI ARC, including Elizabeth Garcia, and Amanda Coldwell for animal care and maintenance. This work was supported by National Institutes of Health Grants R35-NS-116804 (RY), R01-MH-080047 (RY), and F32MH120872 (M.L.P.).
References
- 1.Resendez S. L. & Stuber G. D. In vivo Calcium Imaging to Illuminate Neurocircuit Activity Dynamics Underlying Naturalistic Behavior. Neuropsychopharmacology 40, 238–239 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Ghosh K. K. et al. Miniaturized integration of a fluorescence microscope. Nat. Methods 8, 871–878 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Barbera G., Liang B., Zhang L., Li Y. & Lin D.-T. A wireless miniScope for deep brain imaging in freely moving mice. J. Neurosci. Methods 323, 56–60 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Guo C. et al. Miniscope-LFOV: A large field of view, single cell resolution, miniature microscope for wired and wire-free imaging of neural dynamics in freely behaving animals. 2021.11.21.469394 Preprint at 10.1101/2021.11.21.469394 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Scott B. B. et al. Imaging Cortical Dynamics in GCaMP Transgenic Rats with a Head-Mounted Widefield Macroscope. Neuron 100, 1045–1058.e5 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Helmchen F., Fee M. S., Tank D. W. & Denk W. A Miniature Head-Mounted Two-Photon Microscope: High-Resolution Brain Imaging in Freely Moving Animals. Neuron 31, 903–912 (2001). [DOI] [PubMed] [Google Scholar]
- 7.Zong W. et al. Fast high-resolution miniature two-photon microscopy for brain imaging in freely behaving mice. Nat. Methods 14, 713–719 (2017). [DOI] [PubMed] [Google Scholar]
- 8.Zong W. et al. Large-scale two-photon calcium imaging in freely moving mice. Cell 185, 1240–1256.e30 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Skocek O. et al. High-speed volumetric imaging of neuronal activity in freely moving rodents. Nat. Methods 15, 429–432 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Stamatakis A. M. et al. Miniature microscopes for manipulating and recording in vivo brain activity. Microscopy 70, 399–414 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Aharoni D. & Hoogland T. M. Circuit Investigations With Open-Source Miniaturized Microscopes: Past, Present and Future. Front. Cell. Neurosci. 13, (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Kohl J. et al. Functional circuit architecture underlying parental behaviour. Nature 556, 326–331 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Kingsbury L. et al. Cortical Representations of Conspecific Sex Shape Social Behavior. Neuron 107, 941–953.e7 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Langer D. & Helmchen F. Post hoc immunostaining of GABAergic neuronal subtypes following in vivo two-photon calcium imaging in mouse neocortex. Pflugers Arch. 463, 339–354 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Kahan A. et al. Light-guided sectioning for precise in situ localization and tissue interface analysis for brain-implanted optical fibers and GRIN lenses. Cell Rep. 36, 109744 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Xu S. et al. Behavioral state coding by molecularly defined paraventricular hypothalamic cell type ensembles. Science 370, eabb2494 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Khan A. G. et al. Distinct learning-induced changes in stimulus selectivity and interactions of GABAergic interneuron classes in visual cortex. Nat. Neurosci. 21, 851–859 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Lambert T. J. FPbase: a community-editable fluorescent protein database. Nat. Methods 16, 277–278 (2019). [DOI] [PubMed] [Google Scholar]
- 19.Lee W. M. & Yun S. H. Adaptive aberration correction of GRIN lenses for confocal endomicroscopy. Opt. Lett. 36, 4608–4610 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Royon A. & Converset N. Quality Control of Fluorescence Imaging Systems: A new tool for performance assessment and monitoring. Opt. Photonik 12, 22–25 (2017). [Google Scholar]
- 21.Wekselblatt J. B., Flister E. D., Piscopo D. M. & Niell C. M. Large-scale imaging of cortical dynamics during sensory perception and behavior. J. Neurophysiol. 115, 2852–2866 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Tervo D. G. R. et al. A Designer AAV Variant Permits Efficient Retrograde Access to Projection Neurons. Neuron 92, 372–382 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Zhou P. et al. Efficient and accurate extraction of in vivo calcium signals from microendoscopic video data. eLife 7, e28728. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Gongwer M. W. et al. Mapping whole-brain projections of anatomically-defined prefrontal neurons using combined 3D convolutional networks. 2022.03.31.486619 Preprint at 10.1101/2022.03.31.486619 (2022). [DOI] [Google Scholar]
- 25.Meier A. F., Fraefel C. & Seyffert M. The Interplay between Adeno-Associated Virus and Its Helper Viruses. Viruses 12, (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Dembrow N. & Johnston D. Subcircuit-specific neuromodulation in the prefrontal cortex. Front. Neural Circuits 8, 54 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Remedios R. et al. Social behaviour shapes hypothalamic neural ensemble representations of conspecific sex. Nature 550, 388–392 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Kennedy A. et al. Stimulus-specific hypothalamic encoding of a persistent defensive state. Nature 586, 730–734 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Ohayon S. et al. Automated multi-day tracking of marked mice for the analysis of social behavior. Journal of Neuroscience Methods 219, 10–19 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Kabra M. et al. JAABA: interactive machine learning for automatic annotation of animal behavior. Nature Methods 10, 64–67 (2013). [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.





