Search tips
Search criteria 


Logo of hhmipaabout author manuscriptssubmit a manuscriptHHMI Howard Hughes Medical Institute; Author Manuscript; Accepted for publication in peer reviewed journal
Nature. Author manuscript; available in PMC 2013 March 13.
Published in final edited form as:
PMCID: PMC3443316

Activity in motor-sensory projections reveals distributed coding in somatosensation


Cortical feed-back projections to primary sensory areas terminate most heavily in layer (L) 11,2, where they make synapses with tuft dendrites of pyramidal neurons. L1 input is thought to provide ‘contextual’ information3, but the signals transmitted by L1 feedback remain uncharacterized. In the rodent somatosensory system, the spatially diffuse4 vibrissal motor cortex (vM1)→ vibrissal somatosensory cortex (barrel cortex, vS1) feedback projection may allow whisker touch to be interpreted in the context of whisker position to compute object location5,6. When mice palpate objects with their whiskers to localize object features7,8, whisker touch excites vibrissal somatosensory cortex (barrel cortex, vS1)9 and later vibrissal motor cortex (vM1) in a somatotopic manner10,11,12,13. Here we used axonal calcium imaging to track activity in vM1→ vS1 afferents in L1 of barrel cortex, while mice performed whisker-dependent object localization. Spatially intermingled individual axons represented whisker movements, touch, and other behavioral features. In a subpopulation of axons, activity depended on object location and persisted for seconds after touch. Neurons in the barrel cortex thus have information to integrate movements and touches of multiple whiskers over time, key components of object identification and navigation by active touch.

We trained head-fixed mice to perform a whisker-based object localization task under a 2-photon microscope with one whisker row (C row) (Fig. 1a) 12. In each trial, a pole was moved into one of several locations within reach of the whiskers (for approximately 1 second; Supplementary Fig. 1a), arranged along the anterior-posterior axis on one side of the head (Fig. 1b). Mice moved their whiskers to determine if the pole was either in one of several ‘Go’ locations or in a ‘No Go’ location. Automated whisker tracking 14 measured whisker movements and shape. The force acting on the follicles, which underlies object localization 8,15,16, can be estimated from whisker shape changes induced by touch. A change in curvature at point p of the whisker is proportional to the force applied by the pole on the whisker 16: F ~ Δκp yp, where yp is the bending stiffness at p. We thus present forces acting on the whiskers as the change in curvature, Δκ (Supplementary Fig. 1b). Mice report their decision about object location with licking. Imaging was performed in trained mice (d’ average, 1.8, corresponding to 80% correct trials; range, 1.2-2.6) (Supplementary Fig. 1c-e).

Figure 1
Imaging activity in vM1 → vS1 axons during whisker-based object localization

To image activity in vM1→vS1 axons we expressed the genetically encoded calcium sensor GCaMP3 17 in vM1 neurons 5,12 and implanted a chronic imaging window over vS118(Fig. 1c).. Imaging was in barrel columns with principle whiskers C1, C2, or C3, based on intrinsic signal imaging 19 (Fig. 1d). Fluorescent axons were abundant in L1 (Fig. 1e, f; Supplementary Fig. 2a,b). GCaMP3-positive axonal varicosities appeared as bright spots along the axon backbone 20. Two-photon time-lapse images (field of view, 40μm × 40μm) were acquired using raster scanning (16 Hz) over 100-200 trials per imaging location (trial duration, 7 seconds) (Fig. 1f, g; Supplementary Fig. 1c).

Action potentials reliably invade cortical axonal arbors and cause calcium accumulations in varicosities 21, which harbor synaptic terminals. We measured GCaMP3-mediated fluorescence transients, corresponding to trains of action potentials (≥ 5; Supplementary Fig. 2c-f), in regions of interest (ROIs) containing individual varicosities (varicosities per field of view, 35-80; 17 fields of view; 6 mice). Fluorescence transients were detected in multiple ROIs within each field of view (range 6 - 20 active varicosities per field of view) (Fig. 1f, ,2a).2a). As expected, the fluorescence signals from varicosities belonging to the same axon were highly correlated, whereas correlations computed across all other pairs were low (Fig. 1g). These correlations allowed us to identify varicosities on the same axon, even in cases where the local arbor could not be reconstructed morphologically (Fig. 1h-j). Below we report the activity of one varicosity per axon to represent the activity of the entire axon. Only active axons were analyzed (Methods). This assured that the vast majority (> 99 %) of fluorescence signals reported neural activity rather than movement (Supplementary Fig. 3).

Figure 2
Motor and sensory signals in vM1 → vS1 axons

We aligned fluorescence time series with recordings of behavioral features, including Δκ, whisking, and lick rate, and grouped trials by trial type (Fig. 2). Axonal activity was concentrated mainly around the sampling period, and correlated with specific behavioral variables. Some axons were active coincident with whisking during the sampling period (Fig. 2b-d; cf ROI1 and whisking amplitude), while other axons where mainly active in trials with strong whisker touch (cf ROI2 and Δκ). Some axons were primarily active during licking or could not obviously be explained by a single behavioral feature 12. Correlations between activity and behavior were apparent across trials and within trials. These data indicate that individual vM1 → vS1 axons represent specific behavioral features, but the representations are diverse across the population of axons.

We used a generalized form of regression (Random Forests, Methods)12 to quantify how behavioral features are represented by vM1 → vS1 axons. Both behavior and activity varied within trials, across individual trials, and across trial types (Fig. 2b, c). For example, on some trials whisker touch was strong, whereas on other trials it was weak or absent (touch on No Go trials was typically weakest; Supplementary Fig. 1b,e). On some trials mice whisked gingerly and late during the sampling period (Fig. 2b, trial 144), whereas on other trials they whipped their whiskers against the pole as soon as it came within reach (Fig. 2b, trial 145). Our algorithms exploit this variability and the large number of trials in our data set (Supplementary Fig. 1d) to quantify how well specific behavioral features could be decoded from axonal activity.

We first decoded the measured behavioral features (whisker curvature changes, Δκ whisking, licking; Methods) based on activity in all axons in a field of view (Fig. 3a). The algorithms used the activity of populations of axons to fit individual behavioral features, taking into account variability within and across trials. The explained variance (Ri2, for the ith behavioral feature) was used to measure the quality of decoding (Supplementary Fig 4).

Figure 3
Decoding behavioral variables based on axonal activity

Population activity decoded the recorded behavioral features, including Δκ, whisking and lick rate (Fig. 3a). Whisking was decomposed into setpoint (< 1.6 Hz) and amplitude (6 - 30 Hz; Methods) 6,12 (Fig. 2b), but these parameters were highly correlated (Supplementary Fig. 5a) and decoding was similar for these parameters. All imaged fields of view decoded all behavioral features (R2 larger than for trial-shuffled data; p < 0.001, bootstrap test for all sessions and features (Supplementary Fig. 4a). This is despite the fact that each experiment sampled only approximately 10−5 % of the synapses in vS1 (assuming: thickness of L1 in vS1, 0.09 mm22; vS1 area, 2 mm2; synaptic density, 109/mm3,23). We conclude that vM1 → vS1 axons relay signals related to touch, whisking, licking and other task-related variables to vS1 in a distributed and highly redundant manner.

We used similar methods to classify individual axons based on their activity patterns12 (Methods; Fig. 3b-e). One half of the active axons (78/138 active axons; 56%) decoded one or more of the measured behavioral features (mean Ri2 for best feature, 0.22). Whisking-related axons (26/138 active axons) were active during whisking for all trial types, independent of touch (Fig. 2, ROI 1). Whisking-related fluorescence signals lagged whisking onset (259 ±101 ms) (Supplementary Fig. 5b-d). However, because of the slow dynamics of calcium-dependent fluorescence we cannot exclude the possibility that the underlying spikes might lead whisking. Coding of whisking amplitude and whisking set-point is consistent with neurophysiological6,24 and imaging experiments in vM112. Touch-related axons (31/138 active axons) were activated mainly in trials with touch, but not by whisking alone (Fig. 4b; Supplementary Fig. 4c). Consistently, trimming whiskers, which precluded touch during whisking, abolished activity of touch-related axons (Supplementary Fig. 6). Other axons decoded lick rate (classified as lick-related) 25 or a mixture of features (classified as ‘mixed’ axons) (Fig 3d).

Figure 4
Persistent object location-dependent activity

Axons representing different behavioral features were spatially intermingled over length scales of micrometers (Fig. 2; Fig. 3e); nearby varicosities were equally likely to be part of any of the representations. Repeated imaging experiments revealed that the representations of individual axons were largely stable (Supplementary Fig. 6). The L1 apical tuft dendrites of individual neurons in vS1 may have access to a rich amalgam of contextual information.

Most of the touch-related axons showed activity that varied with object location (Fig. 3d, arrow heads; Fig. 4a-c; Supplementary Fig 7) (25/138 active axons). These axons became active only after first touch (Fig. 4a-c) (latencies greater than 100 ms) and might thus be driven in part by touch-triggered excitation spreading from vS1 to vM1 10,11,13. In many cases, activation of these axons correlated with forces on a specific whisker. However, this whisker was typically not the principle whisker of the imaged barrel column (Supplementary Fig. 7). Touch-related activity corresponding to specific whiskers is thus broadcast widely to the barrel cortex, consistent with the diffuse nature of the vM1 → vM1 projection 4. These data implicate primary motor cortex in somatosensation 26. Furthermore, signals coding for object-location are fed back from the motor cortex to the somatosensory cortex.

Fluorescence changes coding for object location often outlasted the presence of the pole, sometimes for several seconds (Fig. 4d-h; Supplementary Figure 8). This is much longer than expected for the decay time constant of GCaMP3 fluorescence after trains of action potentials in axons (half decay time, T1/2, 0.45 seconds; Supplementary Fig. 2) (Fig. 4g, h). After taking calcium dynamics and GCaMP3 fluorescence into account, significant graded, persistent activity was seen in 11 out of 25 object location sensitive axons (2-way ANOVA, p < 0.05 ), lasting from 0.5 seconds to more than 4 seconds (Fig. 3d, red arrow heads; Fig. 4g, h). Motor behaviors did not explain object location-dependent persistent activity; licking and whisking were not different across trials with different object locations (2-way ANOVA, 9 out 11 persistent object location axons, p > 0.05, Supplementary Fig. 8f-g). Object location could be decoded from the activity of persistent axons for up to 4 seconds after the last contact (Fig. 4 i, j). This parametric persistent activity 26 represents a form of short-term memory of objects detected by specific whiskers at particular locations.

We used calcium imaging with genetically encoded indicators to track activity in specific projections (Fig. 1). Small patches of L1 in vS1receive diverse signals from vM1, including activity coding for aspects of whisking, touch and licking (Fig. 2, ,3).3). Most of the signals coded by L2/3 neurons in vM1 12 were also represented in vM1 axons in L1 of vS1. Touch-related and persistent activity was overrepresented in the vM1 → vS1 axons, but this difference could be due to variations in the behavioral task or the sampled neuronal population.

Pyramidal neurons receive this rich top-down information in their tuft branches in L1, while bottom-up sensory input impinges mainly on the proximal basal dendrites 5. L1 input increases neuronal gain and can promote bursting with coincident input in the proximal basal dendrites 27. Pyramidal neurons therefore compare contextual input and ongoing sensory input.

Activity related to whisker position was a prominent component of the vM1 → vS1 signals (Fig. 2, ,3).3). Pyramidal neurons in vS1 might combine this efference copy-like positional information and touch input to compute object location in vS1 6,15. Whisking signals impinging on L1 dendrites might also selectively amplify activity related to touch during periods of active exploration.

Although mice responded within approximately 100 milliseconds after touch in the object localization task, a subpopulation of vM1 → vS1 axons exhibited persistent object-location signals which outlasted the animals’ decision by seconds (Fig. 4). These memory traces, which might not be relevant to solve this particular task, represent information about touches of specific whiskers in the recent past. Haptic object recognition is constructed from localization of several related object features, based on multiple touches over time 28,29 with multiple whiskers 30. The vM1 → vS1 projection links the past state of specific whiskers (input in L1) with current sensory input from other whiskers, ascending into vS1 via the sensory thalamus. The vS1 ←→ vM1 loop thus has the capacity to integrate haptic information across time and space, key components of object recognition and somatosensory navigation. Pyramidal cells in vS1 receive L1 inputs related to past touch, while their proximal basal dendrites receive input signaling current touch. These neurons could selectively burst after specific sequences of touches with different whiskers, within time windows defined by the mnemonic activity in L1. In this scheme burst firing of populations of vS1 neurons codes for complex object shape (Supplementary Fig. 9).

Methods Summary

Virus expressing GCaMP3 (rAAV-syn-GCaMP3, serotype 2/1, University of Pennsylvania Gene Therapy Program Vector Core) was injected (20 nl, 10 nl/min, 350 um deep) in vM1 of adult (>P60) C57BL/6 male mice and a circular craniotomy was made over the left vS1. Animals were trained in a whisker-dependent object localization task. vM1 axons were imaged in vS1 14-23 days after virus injection. Images of the whiskers were acquired using a high-speed CMOS camera (EoSense CL, Mikrotron, Germany) running at 500 frames/sec. The whisker position (azimuthal angle at the whisker base, θ) and whisker shape were tracked using automated whisker tracking8. Licking was detected using an optical lickport.


Virus injection and chronic window preparation

All procedures were approved by the Janelia Farm Research Campus Institutional Animal Care and Use Committee. Surgeries were conducted on adult mice (> P60) male C57BL/6 mice under isoflurane anesthesia (1.5-2%). Additional drugs reduced potential inflammation (Ketofen, 5mg/kg, subcutaneously) and provided local (Marcaine, 0.5%, injected under the scalp) and general analgesia (Buprenorphine, 0.1 mg/kg, intraperitoneal). To label motor cortex axons a small craniotomy was performed over the left vibrissal motor cortex (vM1) (coordinates relative to bregma, in millimeters: anterior, 1.3; lateral, 0.7). Virus expressing GCaMP3 (rAAV-syn-GCaMP3, serotype 2/1, University of Pennsylvania Gene Therapy Program Vector Core) was injected (20 nl, 10 nl/min, 350 um deep) with a custom-made volumetric injection system (based on a Narishige, MO-10, manipulator) 5. Glass pipettes (Drummond) were pulled and beveled to a sharp tip (30 um outer diameter). Pipettes were back-filled with mineral oil and front-loaded with viral suspension immediately prior to injection. Compared to synthetic calcium indicators, expression of protein sensors ensures labeling of long-range axons and also allows imaging in trained mice across multiple behavioral sessions, separated by days to weeks. The virus infected neurons in layers (L) 2-5, including the majority of vS1-projecting neurons 13 (Supplementary Fig. 2a). A custom-machined titanium frame was cemented to the skull with dental acrylic (Lang Dental).

For imaging a circular craniotomy was made over the left barrel cortex (vS1) (diameter, 1.5 mm; center relative to bregma, in millimeters: lateral, 3.5; anterior, −1.4, left hemisphere, Fig. 1d). An imaging window was constructed from two layers of standard microscope coverglass (Fisher; thickness, 170 - 210 um), joined with an UV curable optical glue (NOR-61, Norland). A larger piece was attached to the bone; a smaller insert fit snugly into the craniotomy. The bone surrounding the craniotomy was thinned to allow for a flush fit between insert and the underlying dura. The window was cemented in place using dental acrylic (Lang Dental). After 3 days of recovery the C-row whiskers were mapped using intrinsic signal imaging 9 (Fig. 1d). Mice were anesthetized with isofluorane (1 %) after injection of chlorprothixene (1 mg/kg) 31. Images were acquired through a cranial window through a Leica MZ12.5 microscope under 630 nm illumination. Images of the vasculature over the same field of view were taken under 530 nm LED illumination. Individual whiskers were moved using a piezoelectric bimorph (0.75 mm, 3 mm from the base, 10 Hz, 4 sec, repeated every 20 sec; total time 10-30 minutes). Acquisition was performed with Ephus ( 32. Water restriction was started one day later.


The behavioral task was modified from previous studies 8,12 (Fig. 1a, b; Supplementary Fig. 1). Behavioral training began after the mice had restricted access to water for at least 7 days (1 ml/day). In the initial session mice first learned to lick for water rewards (~40 rewards). Animals were then trained to lick only in trials in which a metal pole was within easy reach of the whiskers on the right side of their face. The pole was mounted on a pneumatic linear slider (Festo; SLS-10-30-P-A Mini slide; P/N 170496) and was moved rapidly (~0.25 seconds) into and out of reach of the whiskers under computer control. The pole was within reach of the whiskers for ~1 second (sampling period). Tongue movements were tracked using an optical lickport.

Because the pole was placed in one of five randomly selected locations, it was impossible for mice to position their whiskers to solve the task with passive whisker stimulation. However, consistent with previous studies8, mice tended to focus their whisking on the rewarded target locations. Passive stimulation by the moving pole thus occurred in some trials (23 % of trials; 6 sessions, 5 animals). In general, mice whisked to contact the pole, but whisking varied across trials (Fig. 2b, c; Supplementary Fig. 1). Whisking strategies also varied across mice. After removal of the pole, during an answer period lasting ~1.5 seconds, licking was rewarded with a drop of water in Go trials and punished with an extra inter trial interval of 4 seconds in No Go trials. Licking was ignored in other behavioral epochs. Multiple pole positions in Go trials were introduced at this early training stage. The range of Go positions was initially relatively small (4.5 mm) and was gradually increased with training. The pole positions were (in millimeters, relative to the C2 follicle at rest) (Supplementary Fig. 1b): Lateral, 6.7 to 9.1. Go positions, center of anterior-posterior range, 0.35-3.32; anterior-posterior range, 5.6-7; No Go positions, anterior-posterior location, 8.9 to 13.6; lateral, 6.7 to 9.1. Although all pole locations were within reach of the long posterior whiskers (C1, C2), mice did not always touch the most anterior (No Go) location8(Supplementary Fig. 1e).

Once the animals were trained ( d’ > 1), all whiskers but C row were trimmed on the right side of the face. Subsequent behavioral sessions were performed while imaging under the 2-photon microscope.


Imaging was performed 14-23 days after virus injection with a custom microscope (design available at GCaMP3 was excited using a Ti-Sapphire laser (Maitai, Spectra Physics) tuned to λ = 925 nm. We used GaAsP photomultiplier tubes (10770PB-40, Hamamatsu) and a 16x (0.8 NA) microscope objective (Nikon). The field of view was 40×40 um (128×256 pixels) (Fig. 1f), imaged at 16 Hz. The microscope was controlled with ScanImage 33( The average power for imaging was < 50 mW, measured at the entrance pupil of the objective. For each mouse the optical axis was adjusted to be perpendicular to the imaging window. Imaging was stopped during intertrial intervals (3 seconds; 7 seconds after False alarms trials). Bleaching of GCaMP3 was negligible. Slow drifts of the field of view were corrected manually approximately every 50 trials using a reference image. In some cases we imaged the same axons over several days (Supplementary Fig. 6). Vascular landmarks and visual comparison with reference images from previous days were used to identify the same axons.

Calcium imaging has some drawbacks. Current genetically encoded indicators are not sufficiently sensitive to detect single action potentials and as a consequence axons with low firing rates were likely missed 9,17 (Supplementary Fig. 2). This implies that the representations in vM1 → vS1 axons are likely even richer than suggested by our imaging data. In addition, the slow dynamics (100’s of milliseconds) of the calcium indicator limits the temporal resolution of the neurophysiological measurements. Advances in the development of fluorescent sensors of neuronal function will likely ameliorate these problems.

Image analysis

Frames were registered using rigid translation based on cross-correlation 34. First, we selected a trial with little movement and the frames within the trial were registered and averaged. All the frames from a session were registered to this averaged image. To extract fluorescence signals, regions of interest (ROIs) were drawn over fluorescent varicosities identified by using the mean, maximum intensity, and standard deviation values of all trials. The pixels in each ROI were averaged to estimate fluorescence corresponding to a single varicosity. The ROI’s baseline fluorescence, F0, was estimated as the 30th percentile of the fluorescence using a 32 seconds sliding window and used to calculate ΔF/F0 = ((F-F0)/F0). To produce an event vector from the ΔF/F0 trace, and thereby minimize the temporal distortions caused by GCaMP3 dynamics 17, we used a non-negative deconvolution method 35. These event vectors were used to train the decoder and to measure average activity when selecting for active axons. Active axons were defined as having an average event rate higher than 0.007 events/frame and a peak ΔF/F0 in the PSTH higher than 30% for any trial-type (i.e. Hit, Correct rejection or False alarm). This assures that the calcium signals are not due to motion artifacts (less than 1% of the GCaMP3 signals are expected to be polluted by movement) (Supplementary Fig. 3).

Whisker tracking

Whiskers were illuminated using a high power LED (940 nm, Roithner) and condenser optics (Thorlabs). Images were acquired through a telecentric lens (0.36×, Edmund Optics) by a high-speed CMOS camera (EoSense CL, Mikrotron, Germany) running at 500 frames/sec (640 × 352 pixels; 42 pixels/mm). Image acquisition was controlled by Streampix 3 (Norpix, Canada). The whisker position (azimuthal angle at the whisker base, θ) and whisker shape were tracked using automated whisker tracking8,14( Whiskers are cantilevered beams, with one end embedded in the follicle in the whisker pad. Measurement of whicker shape and the mechanical properties of the whisker can be used to estimate the forces acting on the follicle 16. The amplitudes of the forces in the follicle are proportional to the curvature of the whisker. We used curvature change at a particular location along the whisker (2-3 mm) as a substitute for the mechanical forces acting on the whiskers 36. Curvature was measured from a parametric curve comprising second order polynomials fitted to the whisker backbone. Periods of contact between whisker and object (touch) were detected based on nearest distance between whisker and object.

Behavioral features

Licking was detected using a lickometer8. Lick rate (Hz) was the inverse of the inter-lick interval. Motor cortex neurons primarily code for slow variables related to whisking 6,24. We decomposed whisking (i.e. θ at base) into whisking setpoint and whisking amplitude. Whisking setpoint was defined as the 0.6 second moving average of θ. Whisker amplitude was defined as the Hilbert transform37 of the absolute value of the band-pass filtered (6-30 Hz) θ. Whisking setpoint and whisker amplitude were highly correlated in our behavioral task (Supplementary Fig. 5a). We therefore only show one of these features (whisking amplitude) in most figures (Fig. 2 & 3). To characterize the quality of the decomposition we reconstructed whisker position from setpoint, whisker amplitude and whisking phase. The reconstruction error (root mean squared error) across all animals was 4.5 ± 0.18° (mean ± sem; range 3.5-6.1 °), corresponding to 30 % of the variance of whisker position. The analysis of curvature was restricted to periods of touch. We further derived features related to protraction touch (negative curvature changes) and retraction touch (positive curvature changes) and separately absolute values.

All behavioral features were down-sampled to the image acquisition rate (16 Hz). Mean and maximum values were calculated for each feature in a 64 ms window centered on the middle of the new sampling point. Mice whisk at frequencies above 8 Hz (the Nyquist frequency)38 and this information is lost by downsampling. Across animals 48 ± 1% of the energy of the whisking trajectory was contained at frequencies below 8 Hz. The higher frequency signals (i.e. phase) are not thought to be coded by the vast majority of motor cortex neurons6,24. Also, our imaging methods would be too slow to capture modulation with whisking phase.

Correlation analysis to determine if multiple varicosities are part of the same axon

vM1 axons form elaborate arbors in L1 of vS1 and multiple varicosities in one field of view were often part of the same axon. To characterize the diversity of signals impinging on vS1, we wanted to report activity in distinct axons, as opposed to distinct varicosities. We used correlation-based methods to distinguish varicosities that were part of the same axon and those that were part of different axons (Fig. 1h-j).

We first selected varicosities that, based on structural images were part of the same axon (14 sessions). We computed their correlation coefficient over an entire session, and compared them to correlation coefficients computed over all pairs of varicosities (dominated by pairs from different axons). As expected 21,39, pairs of varicosities from the same axon showed dramatically higher correlation coefficients compared to random pairs. The correlation coefficient is expected to be higher for axons with higher event rates. For varicosities from the same axon we plotted the correlation coefficients as a function of event rates and fitted an exponential curve to the data. The 95 % confidence value of the fit was used as a criterion to assign pairs of varicosities to the same axon, even in the cases where the axonal morphology could not be discerned.

To build clusters of correlated ROIs we selected all the pairs that were considered to be from the same axon based on correlations (Fig. 1h-j). We seeded a cluster with one randomly selected pair. The next randomly selected pair could share one of the ROIs with the existing cluster in which case it joined the cluster. Otherwise it seeded a second cluster, etc.. We iterated this procedure until all pairs were assigned. Each cluster was represented in the data set by a ‘representative’ ROI, defined by the largest mean ΔF/F0.

Characterizing movement using mice with GFP-expressing axons

Axons and their varicosities are tiny structures (one micrometer diameter, or less 20). Movement of the animal could displace axons in and out of the objective focal plane and thus produce motion artifacts in the fluorescence signal. To quantify these errors we performed control experiments in mice with vM1→vS1 axons labeled with GFP. All experimental conditions were identical, except that AAV-syn-GFP (serotype 2/1) was injected into vM1 instead of the GCaMP3-expressing virus. These mice were trained in the object localization behavior and analyzed identically to mice expressing GCaMP3 (Supplementary Fig. 3). Although varicosities in GFP animals showed movement-induced changes in fluorescence, mainly during the licking period, these changes rarely exceeded 25%.

Characterization of axonal varicosities in brain slices

Male C57BL/6 mice (P15) were injected in the left vibrissal motor cortex (vM1) with 20 nl AAV-syn-GCamP3, serotype 2/1 as described 5. Two weeks later vS1 slices were prepared. Mice were anesthetized with an intraperitoneal injection of a ketamine/xylazine mixture (0.13 mg ketamine/0.01 mg xylazine/g body weight) and perfused through the heart with ice cold ACSF (~5 ml) containing (in mM): 127 NaCl, 25 NaHCO3, 25 D-glucose, 2.5 KCl, 1 MgCl2, 2 CaCl2, and 1.25 NaH2PO4, aerated with 95% O2/5% CO2. The brain was removed and placed into ice-cold cutting solution containing (in mM): 110 choline chloride, 25 NaHCO3, 25 D-glucose, 11.6 sodium ascorbate, 7 MgCl2, 3.1 sodium pyruvate, 2.5 KCl, 1.25 NaH2PO4, and 0.5 CaCl2. Coronal slices (300 μm thick) of the right barrel cortex were cut with a vibrating slicer (Microm, Walldorf, Germany) and incubated in oxygenated ACSF for 45 min at 37°C and then at room temperature. For recording, slices were placed in a chamber with circulating ACSF at 34°C under a custom built two-photon microscope. A 40×40 μm area of L1 in barrel cortex was imaged at 16 Hz using a Ti-Sapphire laser (Maitai, Spectra Physics) tuned to λ = 925 nm. L1 axons were stimulated with an extracellular electrode at 83Hz. Fluorescence traces were extracted as described for the in vivo experiments.

Decoding behavioral variables

The relationship between fluorescence signal of the ith axon and the jth behavioral variable yj can be characterized as an encoding description P(xi|yj) or a decoding description P(yj|xi). The encoding description specifies how much of the activity of the axon can be accounted for by the behavioral variables. The decoding description specifies how well a behavioral variable can be derived from the activity of populations of axons (Fig. 3a, Supplementary Fig.4) or single axons (Fig 3b-e; Fig. 4i-j). Here, we focused on the decoding description.

We used machine learning algorithms to decode the behavioral variables based on activity. For single axon decoding (Fig 3b-e) each axon was used to predict behavioral variables, such as forces on each whisker, whisking amplitude, and lick rate. The input to the algorithm was the event-rate (i.e. deconvoluted ΔF/F0) of a given axon as well as time-shifted versions. To predict sensory input we used present and future activity. For motor variables we used both past and future values, since neural activity could reflect motor commands, corollary discharges, or re-afferent input.

The goal of the decoder algorithm was to find a mapping y^j(tk)=fxi(tk1),,xi(tk),xi(tk+p) that best approximates yj(tk) for all tk. tk is discretized time (in units of 1/16s, corresponding to the imaging rate); l and p represent the maximum negative and positive shifts of the activity respectively. We concatenated trials to generate a vector t of time-binned data. For sensory variables we used l=5 and p=0 and for sensory-motor variables l=5 and p=5 (corresponding to time-shifts up to 0.32s). The dimensionality of the input variables is l+p+1.

For decoding neural populations (Fig. 3a, Supplementary Fig. 4a) we used for each session all axons showing at least 1 event 1 and created an input vector of size Naxons × (l+p+1). Each behavioral session, corresponding to one imaged field of view, was treated separately.

The algorithm was trained on a subset of trials (the training set; 80 %) and evaluated on a separate set of test trials (20%) We repeated this procedure five times to obtain a prediction for all trials 40.

The accuracy of the decoding algorithm was evaluated using the Pearson correlation coefficient (ρ) between the model estimate and the data. The explained variance is R2 = ρ2 (range 0 - 1). R2 was calculated separately for each trial type (i.e. Hit, Correct rejection, Miss and False alarm). Treating trial types separately was critical to disambiguate the relationship between different behavioral variables and activity of single axons. For instance, we observed large amplitude whisking during licking, which complicates the classification of the axons’ response type. However, during Correct rejection trials, licking was absent and whisking present, simplifying classification of axon types. Similarly, in trained animals, touch and licking occurred with short latencies in Hit trials. In contrast in False alarm trials touch was typically absent or diminished in magnitude.

Decoding was with Random Forests 40,41, a multivariate non-parametric machine learning algorithm based on bootstrap aggregation (i.e. bagging) of regression trees. We used the TreeBagger class implemented in Matlab®. TreeBagger requires only few parameters: the number of trees (Ntrees = 32), the minimum leaf size (minleaf = 10), the number of features chosen randomly at each split (Nsplit = Nfeatures/3; the typical value used by default 41). These parameters were chosen as a trade-off between decoder accuracy and computation time. We did not observe much improvement in decoding accuracy for Ntrees > 32 and minleaf < 10 (data not shown).

Classification of response types

We measured the R2 between each measured behavioral variable (i.e. whisking amplitude, lick-rate, whisking setpoint, etc) and each axon’s decoder prediction for all the trials and for each trial type (Fig. 3b-e). In addition, we used ANOVA to determine if calcium responses were different for different pole locations (Fig. 4). We grouped the behavioral variables in larger categories such as whisking (i.e. including whisking amplitude and whisker set-point), lick-rate and touch (i.e. touch per whisker, rate of change of forces, absolute magnitude, etc). We considered the best R2 set for each of the three behavioral categories. Alternatively, all axons were manually classified based on trial-to-trial calcium transients and behavioral prediction for each trial-type. For most axons classification was unambiguous based on the decoder R2 values. The remaining axons were more accurately classified based on a rarer trial type. For example, touch-related axons were much more active in trials with touches compared to trials without touches (Supplementary Fig. 4c). Lick-related axons, but not touch-related axons, were active during licking in False alarm trials. Three of the authors independently arrived at consistent classifications.

Clustering of response-types

We employed clustering algorithms to display the trial-averaged responses of all active unique axons (Fig. 3b). First, we divided the axons into five categories: Touch, Whisking, Licking. Mixed and Unclassified. Within each category we computed a similarity index between pairs of axons based on the trial-averaged responses in Hit, Correct rejection and False alarms trials. For each axon we concatenated their trial-average response for these tree trial-types. The similarity index was the pairwise correlation between the concatenated trial-average responses between every axonal pair. We computed a weighted correlation to take into account that the number of False alarm trials is typically lower than either Hit or Correct rejection trials.

Given the two vectors y and [x with macron] and the weight vector w (by the relative number of trials in each trial type):

weighted mean:μ(x;w)=ΣiwixiΣiwi

weighted covariance:cov(x,y;w)=Σiwi(xiμ(x;w))(yiμ(y;w))Σiwi

weighted correlation:corr(x,y;w)=cov(x,y;w)cov(x,x;w)cov(y,y;w)

Axons were re-ordered using hierarchical clustering for each category separately (using linkage and dendrogram from Matlab with unweighted average distances between clusters).

Analysis of sustained activity

For all cells showing object location-dependent activity we tested for parametric persistent activity. Fluorescence traces were deconvolved with an exponential decay characterized by the GCaMP3 decay time constant (T1/2 =0.45 seconds) (cf Fig. 4f, h and Supplementary Fig. 8 c-d). The mean value of the deconvolved traces at different times after contact (0.2-1.1, 1.1-2, 2-2.9 and 2.9-3.8 seconds after the last contact) were tested for object location-dependent activity (2-way mixed-effect ANOVA ) To determine if object location-dependent motor behaviors could explain object location-dependent activity similar analyses were performed for lick-rate and whisking parameters (Supplementary Fig. 8 f, g).

We applied linear and non-linear decoders (Random Forests, linear and quadratic discriminant analysis; Naïve Bayes was also tested and gave identical results to linear discriminant analysis) to determine the time-course of the objection location memory traces and compared their performance (Supplementary Fig. 8h). Each decoder was trained to predict the pole position as a function of time based on the average activity (i.e events) in the previous 0.5 seconds for each axon. We performed 200 repetitions of this procedure to compute the average performance of each decoder and their confidence intervals. We ensured that there was an equal number of trials per each of the four possible pole positions (i.e. chance level corresponded to 0.25). As before, we used 80% of the trials to train the decoders and tested the performance in the remaining 20% trials (repeating this five times to obtain a prediction for the full set of trials). The linear and quadratic discriminant decoders assume that the input is a multivariate Gaussian and find the optimal linear or quadratic curve that best separates the classes 42.

Supplementary Material


We thank Mac Hooks, Nuo Li, Zengcai Guo, Jeff Magee and Josh Dudman for critical comments on the manuscript; Nathan Clack, Vijay Iyer, and Joshua Vogelstein for help with software; Dan Flickinger for help with microscope design.


Author contributions

LP and KS conceived study. LP performed the experiments. LP, DG, and KS analyzed the data. DG, DHO contributed software. DH, DHO helped with behavioral and imaging experiments. NX performed key pilot studies. LT and LL provided reagents. LP, DG, and KS wrote the paper with comments from all authors. Correspondence and requests for materials should be addressed to KS:


1. Felleman DJ, Van Essen DC. Distributed hierarchical processing in the primate cerebral cortex. Cereb Cortex. 1991;1:1–47. [PubMed]
2. Cauller LJ, Connors BW. Synaptic physiology of horizontal afferents to layer 1 in slices of rat S1 neocortex. J. Neurosci. 1994;14:751–762. [PubMed]
3. Cauller L. Layer I of primary sensory neocortex: where top-down converges upon bottom-up. Behavioural brain research. 1995;71:163–170. [PubMed]
4. Veinante P, Deschenes M. Single-cell study of motor cortex projections to the barrel field in rats. J Comp Neurol. 2003;464:98–103. [PubMed]
5. Petreanu L, Mao T, Sternson SM, Svoboda K. The subcellular organization of neocortical excitatory connections. Nature. 2009;457:1142–1145. [PMC free article] [PubMed]
6. Hill DN, Curtis JC, Moore JD, Kleinfeld D. Primary motor cortex reports efferent control of vibrissa motion on multiple timescales. Neuron. 2011;72:344–356. doi:10.1016/j.neuron.2011.09.020. [PMC free article] [PubMed]
7. Knutsen PM, Pietr M, Ahissar E. Haptic object localization in the vibrissal system: behavior and performance. J Neurosci. 2006;26:8451–8464. [PubMed]
8. O’Connor DH, et al. Vibrissa-based object localization in head-fixed mice. J Neurosci. 2010;30:1947–1967. [PubMed]
9. O’Connor DH, Peron SP, Huber D, Svoboda K. Neural activity in barrel cortex underlying vibrissa-based object localization in mice. Neuron. 2010;67:1048–1061. [PubMed]
10. Ferezou I, et al. Spatiotemporal dynamics of cortical sensorimotor integration in behaving mice. Neuron. 2007;56:907–923. [PubMed]
11. Kleinfeld D, Sachdev RN, Merchant LM, Jarvis MR, Ebner FF. Adaptive filtering of vibrissa input in motor cortex of rat. Neuron. 2002;34:1021–1034. [PubMed]
12. Huber D, et al. Multiple dynamic representations in the motor cortex during sensorimotor learning. Nature. 2012;484:473–478. doi:10.1038/nature11039. [PMC free article] [PubMed]
13. Mao T, et al. Long-Range Neuronal Circuits Underlying the Interaction between Sensory and Motor Cortex. Neuron. 2011;72:111–123. doi:10.1016/j.neuron.2011.07.029. [PMC free article] [PubMed]
14. Clack NG, et al. Automated tracking of whiskers in videos of head fixed rodents. PLoS Comp. Biol. 2012 in press. [PMC free article] [PubMed]
15. Knutsen PM, Ahissar E. Orthogonal coding of object location. Trends Neurosci. 2008 [PubMed]
16. Birdwell JA, et al. Biomechanical models for radial distance determination by the rat vibrissal system. J Neurophysiol. 2007;98:2439–2455. [PubMed]
17. Tian L, et al. Imaging neural activity in worms, flies and mice with improved GCaMP calcium indicators. Nat Methods. 2009;6:875–881. [PMC free article] [PubMed]
18. Trachtenberg JT, et al. Long-term in vivo imaging of experience-dependent synaptic plasticity in adult cortex. Nature. 2002;420:788–794. [PubMed]
19. Masino SA, Kwon MC, Dory Y, Frostig RD. Characterization of functional organization within rat barrel cortex using intrinsic signal optical imaging through a thinned skull. Proceedings of the National Academy of Sciences of the United States of America. 1993;90:9998–10002. [PubMed]
20. De Paola V, et al. Cell type-specific structural plasticity of axonal branches and boutons in the adult neocortex. Neuron. 2006;49:861–875. [PubMed]
21. Cox CL, Denk W, Tank DW, Svoboda K. Action potentials reliably invade axonal arbors of rat neocortical neurons. Proc Natl Acad Sci U S A. 2000;97:9724–9728. [PubMed]
22. Hooks BM, et al. Laminar analysis of excitatory local circuits in vibrissal motor and sensory cortical areas. PLoS Biol. 2011;9:e1000572. doi:10.1371/journal.pbio.1000572. [PMC free article] [PubMed]
23. De Felipe J, Marco P, Fairen A, Jones EG. Inhibitory synaptogenesis in mouse somatosensory cortex. Cereb Cortex. 1997;7:619–634. [PubMed]
24. Carvell GE, Miller SA, Simons DJ. The relationship of vibrissal motor cortex unit activity to whisking in the awake rat. Somatosens Mot Res. 1996;13:115–127. [PubMed]
25. Komiyama T, et al. Learning-related fine-scale specificity imaged in motor cortex circuits of behaving mice. Nature. 2010;464:1182–1186. [PubMed]
26. Hernandez A, et al. Decoding a perceptual decision process across cortex. Neuron. 2010;66:300–314. doi:10.1016/j.neuron.2010.03.031. [PubMed]
27. Larkum ME, Senn W, Luscher HR. Top-down dendritic input increases the gain of layer 5 pyramidal neurons. Cereb Cortex. 2004;14:1059–1070. [PubMed]
28. Anjum F, Turni H, Mulder PG, van der Burg J, Brecht M. Tactile guidance of prey capture in Etruscan shrews. Proc Natl Acad Sci U S A. 2006;103:16544–16549. [PubMed]
29. Davidson PW. Haptic judgments of curvature by blind and sighted humans. J Exp Psychol. 1972;93:43–55. [PubMed]
30. Krupa DJ, Matell MS, Brisben AJ, Oliveira LM, Nicolelis MA. Behavioral properties of the trigeminal somatosensory system in rats performing whisker-dependent tactile discriminations. J Neurosci. 2001;21:5752–5763. [PubMed]
31. Kaneko M, Hanover JL, England PM, Stryker MP. TrkB kinase is required for recovery, but not loss, of cortical responses following monocular deprivation. Nature neuroscience. 2008;11:497–504. doi:10.1038/nn2068. [PMC free article] [PubMed]
32. Suter BA, et al. Ephus: multipurpose data acquisition software forneuroscience experiments. Frontiers Neurosci. 2010;4 [PMC free article] [PubMed]
33. Pologruto TA, Sabatini BL, Svoboda K. ScanImage: Flexible software for operating laser-scanning microscopes. BioMedical Engineering OnLine. 2003;2:13. [PMC free article] [PubMed]
34. Guizar-Sicairos M, Thurman ST, Fienup JR. Efficient subpixel image registration algorithms. Optics letters. 2008;33:156–158. [PubMed]
35. Vogelstein JT, et al. Fast nonnegative deconvolution for spike train inference from population calcium imaging. Journal of neurophysiology. 2010;104:3691–3704. doi:10.1152/jn.01073.2009. [PubMed]
36. Pammer L, et al. The mechanical variables underlying vibrissa-based object localization. 2011 submitted.
37. Hill DN, Bermejo R, Zeigler HP, Kleinfeld D. Biomechanics of the vibrissa motor plant in rat: rhythmic whisking consists of triphasic neuromuscular activity. J Neurosci. 2008;28:3438–3455. [PubMed]
38. Voigts J, Sakmann B, Celikel T. Unsupervised whisker tracking in unrestrained behaving animals. J Neurophysiol. 2008;100:504–515. [PubMed]
39. Koester HJ, Sakmann B. Calcium dynamics associated with action potentials in single nerve terminals of pyramidal cells in layer 2/3 of the young rat neocortex. J Physiol. 2000;529(Pt 3):625–646. [PubMed]
40. Hastie T, Tibshirani R, Friedman J. The Elements of Statistical Learning. 2nd edn Springer; 2009.
41. Breiman L. Random forests. Mach Learn. 2001;45:5–32.
42. Duda RO, Hart PE, Stork DG. Pattern Classification. 2nd edn Wiley; 2001.