Main

We quantified spontaneous motion of mice placed in an open field (with no external cues, food deprivation or reward) by using inertial sensors that measure high-resolution acceleration and angular velocity (Fig. 1a). We found that the distribution of movements in an open field was not a continuum between arrest and motion, but rather a bimodal distribution (Fig. 1b and Extended Data Fig. 1). Using the minimum acceleration between the two peaks of the bimodal distribution (Fig. 1b), we could separate periods of immobility from periods of overt mobility (Fig. 1b and Extended Data Fig. 1), and precisely identify moments of spontaneous movement initiation.

Figure 1: Movement initiation is preceded by increased activity of dopamine neurons.
figure 1

a, Top left, photoidentification schematics. Top right, movable bundle electrode array with fibre-optic cannula. Bottom, open field set-up. The mouse brain schematic in this panel has been re-drawn with permission from ref. 31. b, Top, distribution of total dynamic acceleration in the open field (mean in blue; 3 ± 2.2 one-hour open-field sessions per mouse, n = 6 mice). Bottom, examples of movement initiation events (red). Dotted line represents acceleration threshold. c, PETH of a positively modulated DAN aligned to movement initiation. d, Left, mean trace for all neurons (n = 25, black), positively modulated neurons (n = 13, green) and negatively modulated neurons (n = 7, red), aligned to movement initiation (93.45 ± 35.99 (mean ± s.e.m.) spontaneous initiations per neuron). Grey shadows denote s.e.m. Right, proportion of positively (+) and negatively (−) modulated and unmodulated (No) neurons. e, Latency of each neuron to be significantly modulated in relation to movement initiation (red, negatively modulated; green, positively modulated). f, Time series of video frames for three movement initiations (1.5 s duration) and their representation in the motion sensor space. Cumulative angular velocity is shown in degrees per second (dg s−1). g, Representation of the initiations of one session using t-distributed stochastic neighbour embedding (t-SNE) dimensionality reduction. Colours represent different clusters determined using affinity propagation clustering. h, Number of initiation clusters in which each positively modulated neuron was significantly activated (n = 13, 30.4 ± 0.19% of initiations were preceded by a significant increase in neuron activity). i, Spread of initiations (mean distance to every other initiation) according to whether positively modulated neurons were active or not (not active, n = 8; active, n = 5). j, Normalized firing rate (firing rate / firing rate of low acceleration trials) for positively modulated neurons of low, medium and high acceleration trials (n = 13). k, Examples of a vigour-related neuron (left) and a neuron unrelated to vigour (right). Red, blue and black represent firing rates during high, medium and low acceleration initiations, respectively. l, Proportion of vigour-related (red) and non-related neurons (grey). P < 0.05, paired t-test comparing firing rate of low and high acceleration trials. Data are mean ± s.e.m. (i, j). *P < 0.05.

PowerPoint slide

Source data

We investigated the activity of photoidentified SNc DANs in relation to movement initiation by implanting 16-channel movable electrode bundles coupled to a fibre-optic cannula placed just above the SNc (Fig. 1a). We implanted these bundles in six TH-Cre mice8 (Extended Data Fig. 2a–c) crossed with Ai32 mice9 to obtain expression of channelrhodopsin-2 (ChR2) in TH+ neurons, and used photoidentification10 to identify putative DANs (Extended Data Fig. 3, see Methods for details). Next, we built peri-event time histograms (PETH) of their activity aligned to spontaneous movement initiations. We found that the average activity of all recorded DANs increased transiently before movement initiation (Fig. 1d). Consistently, we found that many photoidentified DANs were significantly modulated by movement initiation and that the majority of these were positively modulated (Fig. 1d). The latency for modulation preceded the initiation of movement for positively modulated neurons, but not for negatively modulated neurons (Fig. 1e). These findings were corroborated using microendoscopic calcium imaging of SNc DANs in freely moving mice (Extended Data Fig. 4; 22 neurons, see Methods and below for details).

We next examined whether the transient activity of individual DANs before action initiation was tuned to the initiation of specific actions, or represented a more general signal before action initiation. To characterize each spontaneous movement initiation, we built trajectories in the motion-sensor space using a combination of total body acceleration (correlated with displacement, see Extended Data Fig. 1), angular velocity (direction of movement) and gravitational acceleration (postural changes)11 (Fig. 1f). Next, we used affinity propagation12 to cluster similar movement initiations13 (Fig. 1g). We found that most DANs were broadly tuned, and were transiently active before rather different initiations (Fig. 1h). Furthermore, we found that initiation trajectories preceded by increased activity of each DAN were as variable as all other initiation trajectories (Fig. 1i). These data strongly indicate that the transient activity of individual DANs before initiation is not very action-specific.

Previous studies in patients with Parkinson’s disease14 and animal models15 have shown that dopamine depletion leads to less vigorous movements. We therefore investigated whether the activity of DANs before movement initiation encoded information about the vigour of the movement that was about to be initiated. We verified that overall, the activity of DANs 300 ms before movement initiation was significantly related to the vigour of future movements (measured by body acceleration; Fig. 1j, k). When doing per-trial analyses comparing all the lower vigour with the higher vigour initiations, we found that 38.5% of the neurons had significantly higher activity before higher vigour movements (Fig. 1l).

In order to test whether inhibiting DAN activity affects movement initiation, we expressed archaerhodopsin (ArchT)16 specifically in SNc neurons (AAV2/1.CAG.Flex.ArchT-GFP injected into TH-Cre mice, Extended Data Fig. 5). We expressed ArchT in the SNc of 11 TH-Cre mice and YFP in the SNc of 9 TH-Cre mice (control group), and delivered light unpredictably for periods of 15 s (Fig. 2a). Inhibition of SNc DANs increased the probability of mice being immobile (Fig. 2b, c). This was not observed in YFP controls (Fig. 2b, c). To investigate whether DAN inhibition mainly affected movement initiation or reduced ongoing movement, we investigated the effects of DAN inhibition in trials in which the mouse was immobile (for at least 300 ms), or mobile (for at least 300 ms), when the inhibition started (Fig. 2d–h).

Figure 2: Inhibition of SNc dopamine neurons impairs movement initiation, but not ongoing movement.
figure 2

a, Schematics showing fibre positioning and trial structure. b, Distribution of acceleration in the open field during laser on and laser off for ArchT (left) and YFP (right) groups. The vertical dashed line denotes the acceleration threshold. c, Left, time spent immobile during laser-off and laser-on periods. Clear bars indicate laser off and filled bars indicate laser on. Right, time spent immobile during laser-on normalized to the baseline. n = 11 ArchT mice, 9 YFP mice. Single asterisk above ArchT indicates significant difference from baseline (1). d, Heat maps of acceleration data of all trials where the mouse was immobile (top) or mobile (bottom) before the start of the trial, in laser-off (left) and laser-on (right) conditions. n = 11 ArchT mice. e, f, Acceleration during laser-off and laser-on trials for immobile trials and mobile trials. n = 7 ArchT mice. The horizontal dotted line denotes the acceleration threshold. There was an interaction between inhibition and mobility state when inhibition started (Supplementary Table 1). g, Left, mean values of the data plotted in e and f. Grey, laser off; green, laser on. Right, same data normalized (laser on / laser off). Single asterisk in Immobile indicates significant difference from 1. h, Mean acceleration per mouse for mobile trials without stops. n = 10 ArchT mice. i, Left, mobile trials aligned to the first stop. Right, normalized mean acceleration (laser on / laser off) before (−4 to −3 s) and after (3–4 s) the first stop for ArchT mice. Single asterisk above ‘After stop’ indicates significant difference from 1. j, Same as in i, but for the YFP group. k, Left, mean cumulative probability of movement initiation for immobile trials. Right, mean probability to initiate movement. n = 7 ArchT mice. l, Mean acceleration for initiations that occurred during immobile trials of ArchT mice. Laser on, n = 16; laser off, n = 30 trials. m, Normalized mean latency to initiate movement. n = 9 YFP mice, 11 ArchT mice. Single asterisk above Move indicates significant difference from 1. Data are mean ± s.e.m. Error bars and shaded areas denote s.e.m. *P < 0.05.

PowerPoint slide

Source data

We found a significant impairment in movement initiation when SNc DANs were inhibited during immobility (Fig. 2g). The effect of inhibition was relatively rapid with a significant difference between light and no light after 2.4 s (Fig. 2e). Consistently, we also found that 5 s of inhibition was sufficient to impair movement initiation (Extended Data Fig. 6).

By contrast, there was no significant change in mean acceleration when inhibition happened after movement onset (Fig. 2g). There was no change in the vigour of movement when SNc DANs were inhibited after movement initiation and mice did not stop during the inhibition (Fig. 2h). Furthermore, in mobile trials in which animals stopped during the 15 s (≥300 ms immobile), there was no difference in acceleration between laser-on and laser-off trials before the first stop. However, there was clear impairment in movement initiation after the first stop (Fig. 2i). This was not observed in YFP controls (Fig. 2j).

A more detailed analysis of the effects of inhibition when mice were immobile revealed that there was a significant decrease in the probability of initiating movement during the 15 s of inhibition (Fig. 2k). Furthermore, even when mice were able to initiate movements, the latency to initiate was significantly higher than in laser-off trials, and the initiated movements were less vigorous (Fig. 2l, m). Taken together, these data indicate that DAN activity before movement initiation modulates the probability and vigour of future movements, but activity of these neurons is less critical for the maintenance and vigour of ongoing movements.

Next, we investigated whether brief activation of DANs, when animals were immobile, would be sufficient to promote movement initiation. We expressed ChR2 in SNc DANs using a similar Cre-dependent strategy (DIO-ChR2-YFP in seven mice, and control DIO-eYFP in five mice). Stimulation at 20 Hz for 500 ms (Fig. 3a) delivered when mice were immobile was sufficient to produce overt movement that lasted several seconds (Fig. 3b), in accordance with previous findings7,17,18. The same activation when mice were overtly moving did not significantly affect ongoing acceleration (Fig. 3b, c).

Figure 3: Transient SNc dopamine neuron activation promotes movement initiation.
figure 3

a, Example of three SNc DANs (single units) expressing ChR2, following stimulation at 20 Hz. b, Mean acceleration depending on movement state before the trial. n = 7 ChR2 mice; n = 5 YFP mice. c, Mean acceleration from 0 to 1 s depending on movement state before the trial. Left, immobile; right, mobile. n = 7 ChR2 mice; n = 5 YFP mice. Blue, laser on; grey, laser off. d, Closed loop set-up. e, Heat maps of acceleration data for all trials. Laser-trigger criteria were reached at time 0. White crosses indicate onset of movement. f, Mean acceleration. n = 5 mice per group. Dark blue, ChR2 on; light blue, ChR2 off; black, YFP on; grey, YFP off. g, Mean acceleration from 0 to 1 s. n = 5 mice per group. h, Latency to initiate movement. n = 5 mice per group. i, Percentage of trials with movement initiation between 0 and 1 s. n = 5 mice per group. In h, i, there is a significant effect for group between ChR2 and YFP. j, Mean distribution of acceleration during the first second after movement initiation for laser on (blue) and laser off (black). n = 5 ChR2 mice. k, Mean acceleration during the first second of movement initiation during laser-off and laser-on trials. n = 5 ChR2 mice. Grey bars indicate laser off; blue bars indicate laser on. Data are mean ± s.e.m. Error bars and grey-shaded areas represent s.e.m. *P < 0.05.

PowerPoint slide

Source data

To further corroborate this finding, we performed an online closed-loop experiment in which mice received stimulation if they were immobile for at least 900 ms (in 50% of the trials, Fig. 3d). Trials in which light was not delivered (50%) were used as within-animal control (laser-off trials). Average acceleration during the first second after the closed-loop trigger was higher during laser-on than during laser-off trials in the ChR2 group (Fig. 3e–g). Moreover, the latency to initiate movement when SNc DANs were briefly activated was almost three times shorter than in laser-off trials (Fig. 3h). The percentage of trials in which movement was initiated during the first second was also higher in laser-on trials (Fig. 3i). We found no evidence that this closed-loop SNc DAN activation had a reinforcement effect, because immobility states did not become more frequent in ChR2 mice (interval between immobility periods: ChR2, 254.5 ± 116.5 s; YFP, 150.5 ± 65.8 s; t = 1.74, P = 0.12). We found that movements initiated during laser-on trials were more vigorous than movements spontaneously initiated during laser-off trials (Fig. 3j, k). None of the described effects were found in YFP controls.

The results presented above highlight a specific role for the transient activity of DANs for the gating and invigoration of self-paced movement initiation, but not for the modulation of ongoing movements. On the basis of these findings, one prediction would be that if individual spontaneous movements are chunked into a sequence of movements, then the activity of DANs would become preferentially active before sequence initiation, but not during the execution of individual elements within the sequence. To test this prediction, we trained mice on a self-paced operant task in which eight lever presses led to a 20% sucrose solution reward (fixed-ratio eight task (FR8)), without any explicit stimuli signalling the availability of reward4 (Fig. 4a). We implanted a gradient index lens just above the SNc of four TH-Cre mice (Extended Data Fig. 7d), and injected a virus that expressed GCaMP6f19 in a Cre-dependent manner20 (AAV2/5.CAG.Flex.GCaMP6f). We then used a miniaturized epifluorescence microscope21 to image calcium transients in genetically identified SNc DANs while mice were performing the FR8 task (Fig. 4b, c). Similarly to previous findings4, by creating lever press time histograms using normalized fluorescence traces (z score of ΔF), we found that the proportion of modulated neurons was different between press events with the highest proportion of neurons being modulated by the first press (Fig. 4d–f). As predicted, this higher proportion of neurons that were related to the first press was not apparent early in training, and developed with sequence learning4,22 (Extended Data Fig. 8).

Figure 4: SNc dopamine neurons are transiently active at sequence initiation, and when inhibited, impair sequence initiation, but not sequence performance.
figure 4

a, Example of the behaviour microstructure during the FR8 task late in training. Red, black and blue circles indicate first, middle and last press, respectively. Red and blue bars indicate licks and head entries, respectively. Dashed line denotes reward delivery. b, Field of view (projection of pixel standard deviation) of a TH-Cre mouse expressing GCaMP6f in the SNc. Regions of interest correspond to traces in c. Scale bar, 20 μm. c, Example traces obtained using the CNMF-E algorithm during FR8 task. d, Percentage of neurons modulated by press events. n = 4 mice. e, Venn diagram representing reward- and first press-related neurons. f, PETH of positively modulated neurons for each press event (bottom) and the corresponding heat maps (top). Grey shadow denotes s.e.m. g, Activity of first lever press-responsive neurons aligned to the cross from the magazine to the lever, before the first lever press. n = 22. h, Left, latency to initiate lever press sequence. Right, normalized latency to sequence initiation. ArchT, n = 11 mice; YFP, n = 9 mice. Single asterisk above ArchT indicates significant difference from 1. i, Top, distribution of latencies to sequence initiation. Bottom left, percentage of early initiations. Right, normalized percentage of early initiations (latency <5 s). ArchT, n = 11 mice; YFP, n = 9 mice. There is a significant effect for group between ArchT and YFP. j, Left, press rate. Light was delivered after the first press. Right, mean press rate normalized. ArchT, n = 11 mice; YFP, n = 9 mice. *P < 0.05. Clear bars indicate laser-off and filled indicate laser-on blocks in hj. Data are mean ± s.e.m.

PowerPoint slide

Source data

Recent studies claimed that SNc neurons are more modulated by movement, whereas ventral tegmental area neurons are more modulated by reward7. However, we found that around 35% of neurons in the SNc responded to reward (Fig. 4e). This is almost similar to the percentage of neurons modulated during sequence initiation (approximately 40% first press neurons; Fig. 4d, e). Importantly, there was little overlap between reward- and first-press-modulated neurons, and the overlap was not significantly different than what would be expected by chance (Extended Data Fig. 9). These data suggest that different populations of SNc DANs are related to movement versus reward, but it remains to be determined whether these correspond to populations that project to the dorsal versus ventral striatum, as has previously been suggested23.

Next, we tested whether SNc DAN activity was necessary for sequence initiation. TH-Cre mice expressing ArchT (n = 11) or YFP (n = 9) were trained on the FR8 task for 12–14 days. Mice developed a structured behaviour with predictable sequence initiations and trajectory after reward consumption24 (Fig. 4a). To inhibit SNc neurons before the first press of a sequence, the laser was triggered when mice broke an infrared beam placed between the reward magazine and the lever (Fig. 4g, h), corresponding to the moment of minimal DAN activity (before the increase in activity of first press neurons; Fig. 4g). We compared a block of inhibition (laser-on block) with a previous block without inhibition (laser-off block) during the same session. Inhibition during 5 s before the first lever press resulted in a significant increase in the latency to initiate the action sequence when compared to laser-off trials (Fig. 4h). Moreover, the probability of initiating a sequence decreased during the 5 s of DAN inhibition (Fig. 4i). Consistent with the experiments presented above, when the inhibition happened after sequence initiation (triggered by the first press), the inter-press interval and number of presses during the 5-s inhibition were not altered (Fig. 4j). No effects were observed in YFP controls (Fig. 4h–j). These results were replicated using DAT-IRES-Cre mice using a different inhibitory opsin (Jaws25) when pseudorandomly inhibiting 30% of the trials (Extended Data Fig. 10). Taken together, these results indicate that SNc dopamine activity before the initiation of the action sequence modulates the probability and latency of sequence initiation, but is not critical for the execution of ongoing sequences.

Here we show that SNc DAN activity modulates self-paced movement initiation. Importantly, precisely timed and state-dependent optogenetic manipulations did not change ongoing movements, indicating a specific role for SNc DAN activity for initiation. These results were corroborated using more complex movement sequences.

It has been proposed that dopamine release in the dorsal striatum is important for the regulation of movement vigour2,14,15, but it was thought that this effect was mostly due to the ongoing tonic levels of dopamine release. Our results indicate that the activity of DANs before movement onset modulates future movement vigour. This could explain why patients with Parkinson’s disease select less vigorous movements to initiate14. It is also in accordance with recent studies that have shown that activity of DAN terminals in the dorsal striatum preceded spontaneous movement initiation but did not precede and even followed acceleration bursts during ongoing movement7. Our results suggest that transient changes in dopamine can function as a fast system that acts on top of tonic release to increase the probability (and vigour) of initiating movements, presumably by modulating the excitability of striatal projection neurons24,26, which receive information about the movements that are ‘planned’ at that exact time via glutamatergic inputs from cortex and/or thalamus. This suggests a role for dopamine in gating and invigorating movements that were planned elsewhere27,28, and is consistent with the observation that DAN activity is not very action-specific. More sustained changes in DAN activity could represent states in which the ‘gate’ is more permissive, increasing the probability of action initiation during longer periods of time, therefore promoting movement29. This would translate into more movement variability with exploration of the action space, which could be important in situations of uncertainty or learning.

These results highlight that approaches aimed at providing transient modulations of basal ganglia circuitry tied to movement initiation, for example, via closed-loop deep-brain stimulation30 triggered by activity in cortical areas related to motor planning, could be beneficial to patients with Parkinson’s disease.

Methods

Animals

All experiments were approved by the Portuguese DGAV and Champalimaud Centre for the Unknown Ethical Committee and performed in accordance with European guidelines. TH-Cre male mice from the FI12 mouse line8 between 3 and 5 months, DAT IRES-Cre32 and TH-Cre;Ai329 between 2.5 and 6 months were used.

Sample sizes, randomization and blinding

The number of animals in each experiment was based on previous studies using a power of 0.7 and α = 0.05. n was larger than 5 in all experiments (except imaging experiments) as required for the use of parametric statistics. No formal method of randomization was used; littermates were equally divided among the groups that were compared. There was no blinding of experimental groups. Every experiment contained all experimental groups that were tested concomitantly. The timing of optogenetic manipulations was controlled automatically, not by the experimenter.

Recombinant adeno-associated viral vectors

The following Cre-dependent adeno-associated viral vectors were used in the experiments: AAV2/5.CAG.Flex.GCaMP6f.WPRE.SV40 (titre 1.19 × 1013, University of Pennsylvania); AAV2/1.CAG.Flex.ArchT-GFP (titre 1.4 × 1012, University of Pennsylvania); AAV2/1.ChR2-eYFP (titre 1.4 × 1013; University of North Carolina), AVV2/1.EF1a.DIO.eYFP (titre 1.4 × 1013, University of North Carolina); AAV8/hSyn.Flex.Jaws-GFP (titre 4.2 × 1012, University of North Carolina); rAAV8/hSyn.DIO.eGFP, (titre 4.9 × 1012, University of North Carolina).

Virus injections, electrode, lens and fibre placement

Surgeries were performed using a stereotaxic system (Kopf). Mice were kept in deep anaesthesia using a mixture of isoflurane and oxygen (1–3% isoflurane at 1 l min−1).

For imaging experiments, a 1 μl of virus solution was injected in the right substantia nigra compacta at the following coordinates: −3.16 mm anteroposterior, 1.40 mm lateral from Bregma and 4.20 mm deep from the brain surface. The injection was done through a glass pipette using a Nanojet II (Drummond Scientific) with a rate of injection of 4.6 nl every 5 s. After the injection was finished, the pipette was left in place for 10–15 min. The virus solution was kept at −80 °C and thawed at room temperature just before the injection. A 500-μm diameter, 8.2-mm long gradient index (GRIN) lens (GLP-0584, Inscopix) was implanted at the same coordinates as the injection. Before the lens was lowered, a blunt 28G needle was lowered to 3 mm deep from the brain surface to facilitate the lowering of the GRIN lens. The GRIN lens was then lowered (4.2 mm deep). The lens was fixed in place using cyanoacrilate and black dental cement (Ortho-Jet). One 1/16-inch stainless-steel screw (Antrin miniatures) was attached to the skull to provide a scaffold to build a dental-cement-based cap that protected and fixed the lens to the skull.

Three weeks after surgery, the mouse was anaesthetized and fixed with head bars. A baseplate (BPC-2, Inscopix) attached to a mini epifluorescence microscope (nVista HD, Inscopix) was positioned above the GRIN lens. To correctly position the baseplate, brain tissue was imaged through the lens to find the appropriate focal plane using 20% LED power, a frame rate of 5 Hz and a digital gain of 4. Once the focal plane was set, the baseplate was cemented to the rest of the cap using the same dental cement. Imaging started 2–3 days after this final step.

The same stereotaxic system and anaesthesia protocol was used for electrode and fibre placement. In the case of TH-Cre;Ai32 mice, no virus injection was used.

The same coordinates were used for optrode placement, except for a depth of 3.8–3.9 mm from the brain surface. The ground wire was attached to a 1/16-inch stainless-steel screw (Antrin miniatures), touching the surface of the brain.

For optogenetic experiments (ChR2 and ArchT groups), the same procedure and coordinates were used, except that a 1.5-μl virus solution was injected bilaterally at 2.3 nl every 5 s and optical fibres with a diameter of 230 μm and a NA of 0.39 (Thorlabs FMT 200 EMT) were placed bilaterally at a depth of 3.9 mm from the brain surface. Optical fibres were built based on a published protocol33. Two TH-Cre mice underwent the same virus injection protocol as the ArchT group and were used to obtain the data presented in Extended Data Fig. 5.

For the Jaws experiment, the same procedure was followed except that 1 μl of virus was used and optical fibres with a diameter of 400 μm and a NA of 0.5 (Thorlabs FP400URT) were implanted at the same depth.

Optogenetic set-ups

For ChR2-expressing mice and corresponding controls, light from a free-launched 200-mW, 473-nm, diode-pumped, solid-state laser (Laserglow Technologies), controlled using an AOM (AA Optolectronic), was delivered after being captured by a collimator and split using a one-input to two-outputs rotary joint (Doric Lenses). In addition, 200-nm, 0.22 NA optical fibre patch cords were used to guide the light to the fibres implanted in the mice.

For the ArchT and the corresponding controls, the same set-up was used, but with a different light source (free-launched 500-mW, 556-nm, diode-pumped, solid-state laser from CNI Lasers).

For the Jaws group and corresponding controls, we used a red LED (around 100 mW maximum output, approximately 625 nm, Prizmatix). The light was captured by a large diameter optical fibre (1 mm), which connected to a one-input to one-output rotary joint. A branched 500-μm optical fibre was then used to connect to the fibres that had been implanted in the mice.

Light intensity was measured before and during experiments using a fibre similar to the ones implanted and a power meter (PD1000-S130C, Thorlabs). The power was adjusted at the tip of the fibre to be around 15 mW for photoidentification experiments (Fig. 1 and Extended Data Fig. 3), approximately 3 mW for ChR2 (Fig. 3), around 35 mW for ArchT experiments (Figs 2, 4 and Extended Data Fig. 5), and approximately 9 mW in Jaws experiments (Extended Data Fig. 10).

Open field

We used a 39 × 39 cm open field with black walls (17.5 cm height) and white acrylic floor to assess the spontaneous movement of mice. The open field was inside a sound-attenuating chamber. Illumination was provided by white (2700 K) LEDs (Dioder, Ikea) that were placed on the floor and symmetrically around the open field in a way that illumination of the open field was uniform and indirect (135 lx).

FR8 operant task

Behaviour training and testing took place in operant chambers as described previously4. In brief, each chamber (23 cm L × 20 cm W × 19.5 cm H) was housed within a sound-attenuating box (Med-Associates) and equipped with one retractable lever on the left side of the food magazine and a house light (3 W, 24 V) mounted on the left lateral wall. Sucrose solution (10%) was delivered into a metal cup in the magazine through a syringe pump (20 μl per reward). Magazine entries were recorded using an infrared beam and licks using a contact lickometer. Mice were placed on food restriction throughout training, and fed daily after the training sessions with approximately 2 g of regular food to allow them to maintain a body weight of around 85% of their baseline weight.

Training started with a 30-min magazine training session, in which the reinforcer was delivered on a random time schedule, on average every 60 s (30 reinforcers). The following day lever-pressing training started with continuous reinforcement (CRF), in which animals obtained a reinforcer after each lever press. The session began with the illumination of the house light and insertion of the lever, and ended with the retraction of the lever and by turning off the house light. On the first day of CRF, the sessions lasted 45 min or until mice received five reinforcers, the second day of CRF lasted 45 min or until mice received 15 reinforcers, and the last day of CRF lasted 45 min or until mice received 30 reinforcers. This last CRF session was repeated if mice failed to obtain 30 rewards within the time limit. After CRF, animals started to be trained (day 1) on a fixed ratio schedule in which eight presses earn a reinforcer (FR8), without any stimulus signalling when eight presses were completed or when the reinforcer was delivered; this training continued for 12–14 days.

All timestamps of lever presses, magazine entries and licks for each animal were recorded with a 10-ms resolution. The same training chamber was used during imaging and optogenetic experiments.

Acceleration and video recordings

In the experiments where photoidentified TH+ neurons were recorded, acceleration was recorded using a digital 9-axis inertial sensor with a sampling rate of 200 Hz (MPU-9150, Invensense) assembled on a custom-made PCB and connected to a computer via a custom-made USB interface PCB (Champalimaud Foundation Hardware Platform).

For the other experiments, an analogue 3-axis inertial sensor was used with a sampling rate of 1,000 Hz (LIS331AL, ST) assembled on a custom PCB (Champalimaud Foundation Hardware Platform), and the signals were fed to the analogue inputs of a Cerebus recording system (Blackrock Microsystems).

Acceleration data obtained from these sensors aggregates acceleration from two sources: acceleration generated from gravity and from the body. To separate these two components we processed data obtained from both types of inertial sensor using a custom MATLAB code. We used a standard approach34 that relies on filtering the 3-axis data using a Butterworth filter. In our analysis we used a median filter (7 bins wide) to remove noise peaks. Then we used a 1-Hz high-pass fifth-order Butterworth filter to separate the static (gravitational) component of the signal. Unless stated otherwise, we used the sum of the three vectors of acceleration as a global measurement of body acceleration for our analysis. The dynamic (body acceleration) component accurately tracked animal movement, and correlated well with pixel change in video measurements (Extended Data Fig. 1b–d).

Video recordings were obtained using a charge-coupled device camera (DFK 31BF03, Imaging Source) and a custom-developed software in Labview (National Instruments) at a rate of 15 frames per second. This software allowed us to introduce signals to the video frames to sync acceleration, neural recordings and light delivery periods.

Classification of movement state

We used the average distribution of acceleration in the open field for each experimental group to define the movement state of the mice. This was possible, because the average distribution of the logarithm of total body acceleration was clearly bimodal, with a very low acceleration distribution corresponding to immobility periods (with the possible exception of small and slow postural adjustments) and a high acceleration distribution corresponding to periods of mobility (see Fig. 1b and Extended Data Fig. 1 for a comparison between video and motion-sensor acceleration data). The acceleration threshold was defined as the lowest acceleration value between the two distributions. Unless stated otherwise in the methods, initiation events were defined as transitions between periods of at least 300 ms below the threshold followed by at least 300 ms above the threshold.

Extracellular recordings of photoidentifed SNc DANs

We used a single-drive movable microbundle (sixteen 23-μm tungsten electrodes) with an optic-fibre guide cannula (Innovative Neurophysiology). An optical fibre with 230 μm diameter and a NA of 0.39 (Thorlabs FMT 200 EMT) was inserted in the cannula just to the top of the electrode microbundle cannula (see Fig. 1a for schematics). The neural activity and the timestamps from the light stimulation were recorded using a Cerebus recording system (Blackrock Microsystems).

Experiments were started one week after electrode placement. Every day, we sorted putative units using an online sorting algorithm (Central Software, Blackrock Microsystems) while the mouse was in its home cage. If putative single units were isolated, we delivered a screening protocol consisting of a train of 100 blue light pulses with a 10-ms width delivered at 1 Hz. Using neurophysiology data analysis software (NeuroExplorer V4), we built PETH that were aligned to the train pulses. If any of the isolated units appeared to be modulated by the light train, the mouse was introduced to the open field and neurons were recorded for 1 h. The stimulation protocol was run again at the end of the open field session for confirmation. At the end of the experiment, the microbundle was advanced 50 μm to record next day. We used six mice in these experiments. During this experiment, microbundles were moved on average 433 ± 93.1 μm.

Units were resorted using an offline sorting algorithm (Offline Sorter V3, Plexon Inc.) to isolate single units on the basis of waveform characteristics, inter-spike intervals and clustering. Single units together with the timestamps of the light stimulation provided by a pulse generator (Master 8, AMPI) were exported to MATLAB for analysis.

Criteria used to photoidentify DANs

Neural activity referenced to light pulse onset was averaged in 1-ms bins, and averaged across trials to construct a PETH, which was the basis for analysing amplitude and latency of light-related firing activity. Distributions of the PETH from −900 to −10 ms before light onset were considered baseline activity. We then determined which bins, slid in 1-ms steps during an epoch spanning from light onset to 50 ms after, met the criteria for significant firing rate increases. A significant increase in firing rate was defined as at least four consecutive bins had a firing rate larger than a threshold of five standard deviations above baseline activity. The latency in modulation of photoidentification was defined as the time between light onset and the first significant bin. On the basis of the distribution of latencies of significantly modulated neurons and in accordance with previous studies4,35, we used a very short latency (≤7 ms) for neural response to light, combined with at least a 30% increase in firing rate during the light pulse, and a high correlation coefficient between spike waveforms during light on and off (>0.9) as criteria for positive photoidentification (Extended Data Fig. 3).

Criteria to identify neurons modulated by movement initiation

We built a PETH for each photoidentified single unit spanning from 1,500 ms before and after movement-initiation events. Neural activity was averaged in 100-ms bins, shifted by 1 ms (100 bins, centred on current bin). Distributions of the PETH from −1,000 to −500 ms before light onset were considered baseline activity. We then determined which bins, slid in 1-ms steps during an epoch spanning from −500 ms to 500 ms after movement initiation, met the criteria for significant firing rate changes. A significant change in firing rate was defined when at least 50 consecutive bins had a firing rate higher or lower than a threshold of 2.56 standard deviations above or below baseline activity (99% confidence interval). The latency to modulation was defined as the time between movement onset and the first of the 50 consecutive significant bins.

Area under the receiver operating characteristic curve (auROC) analysis

For this analysis, we used a method similar to the one described previously35. We convolved the spike trains with a function similar to a post-synaptic potential36. To produce the ROC curves, we compared the firing rate of each 50-ms bin to the firing rates during baseline (–1,500 to −1,000 ms before movement initiation) across trials. The auROC for each bin was calculated using trapezoidal numerical integration.

Identification of neuron types using affinity propagation clustering

We used the affinity propagation algorithm12 to look for subtypes of significantly modulated neurons (Extended Data Fig. 3f). It is an efficient clustering algorithm that takes as inputs the similarities between pairs of observations in the dataset (in this case, the auROC traces for each modulated neuron), and finds exemplars and the clusters around them by exchanging real-valued messages between data points. We used the MATLAB (Mathworks) function made available by the authors of ref. 12 at http://www.psi.toronto.edu/index.php?q=affinity%20propagation. We used the correlation between neuron auROC traces as the measure of similarity used by the algorithm. We also used maxits = 1,000, convits = 100; lam = 0.9 and a preference equal to the median similarity of the dataset.

Trial-by-trial analysis of significant increases in neuron activity before movement initiation

We defined a baseline distribution of the number of spikes per 200-ms bin for a period of 1 s (from 2,200 ms before movement initiation to 1,200 ms before movement initiation) for all trials. On the basis of this distribution, we determined a criterion for each neuron such that 90% of the 200-ms bins in the baseline had a lower number of spikes than the criteria. Trials were considered to present a significant increase in neuron activity when the number of spikes during the 200-ms bin immediately preceding movement initiation was above this criterion.

Definition of movement initiation clusters and spread

We used a methodology previously developed by our group to use motion-sensor data to classify behaviour11.

We defined 1-s movement initiation trajectories specified by three motion-sensor variables: total body acceleration, the angular velocity of the axis most parallel to the dorsal–ventral axis of the mice and the gravitational acceleration of the same axis. We divided these trajectories in two 500-ms bins and for each bin we defined a vector composed by a concatenation of a normalized histogram for each motion-sensor variable. In the end, each trajectory was defined by the concatenation of two vectors, the first representing the distributions of the motion-sensor variables for the first 500 ms of initiation, and the second for the last 500 ms. Consequently, the final initiation vector was composed by six different motion-sensor variable distributions. We then determined a matrix representing the distances from each initiation vector to every other vector. To calculate the distances, the motion-sensor variable distribution of one vector was compared to the same motion-sensor variable distribution of another vector (range of 0–1; with 0 indicating that the vectors are exactly the same and 1 indicating that the vectors are maximally different). The differences between each motion-sensor variable distribution were then squared and summed together to find the distance between the two initiation vectors that were evaluated (range 0–6). The final distance matrix was built by comparing each initiation vector in this way and squaring the final result, obtaining a matrix that varied from 0 (exactly the same) to 36 (maximally different). The spread values presented in Fig. 1i were determined by averaging the distances between movement initiations.

After determining an initiation distance matrix for each session, we used affinity propagation12 to find clusters of initiations (see the description above regarding this methodology). We provided the affinity clustering algorithm with the additive inverse of the distance matrix as a similarity matrix. We also used maxits = 1,000, convits = 100; lam = 0.9. To make sure that we were selecting a consistent structure for the data, we used a value for preference between the minimum and the maximum similarity of each similarity matrix that provided the highest but at the same time most stable number of clusters (that is, a value was chosen in the middle of an interval of consecutive values that provided the same number of clusters).

t-Distributed stochastic neighbour embedding for visualization of initiations

We used t-distributed stochastic neighbour embedding (t-SNE)13 to visualize and assess the existence of structure within the movement initiations of each session (see the example in Fig. 1h). We implemented this using a MATLAB code provided by the authors of ref. 13 (https://lvdmaaten.github.io/tsne/). We used a 2D t-SNE using a perplexity of 15 to produce the image in Fig. 1h.

DAN activity and movement vigour analysis

We used the mean acceleration during the first 500 ms of each spontaneous initiation as a measurement of movement vigour, and separated trials into low acceleration trials (lower tertile), medium and high acceleration trials (upper tertile). We then calculated the activity of positively modulated neurons during 300 ms before movement initiation for each acceleration tertile. A neuron was considered to be vigour related if the activity during the lower tertile trials was significantly lower than the activity during the upper tertile trials.

GCaMP6f imaging using a mini-epifluorescence microscope

Mice were briefly anaesthetized using a mixture of isoflurane and oxygen (1% isoflurane at 1 l min−1) and the mini-epifluorescence microscope was attached to the baseplate. This was followed by a period of 20–30 min of recovery in the home cage before experiments started. Fluorescence images were acquired at 10 Hz and the LED power was set 10–20% (0.1–0.2 mW) with a gain of 4. Image acquisition parameters were set to the same values between sessions to be able to compare the activity recorded. Three GCaMP6f-expressing TH-Cre mice were imaged while freely exploring an open field. The same mice and one more were also imaged during the FR8 task. Data shown in Fig. 4 were obtained in two consecutive late training sessions (between days 7 and 13).

Calcium image processing and analysis

GCaMP6f image processing and fluorescence trace extraction

All fluorescence movies were initially processed using the Mosaic Software (v.1.1.2, Inscopix). First, all frames were spatially binned by a factor of 4. To correct the movie for translational movements and rotations, the frames were registered to a reference image consisting of an average of the raw fluorescence movie. This was achieved by implementing the TurboReg registration engine37 within the mosaic software. The movie was cropped after registration to remove the post-registration black borders.

GCaMP6f fluorescence trace extraction

Although calcium imaging using miniscopes enables researchers to image neurons in freely moving mice, it is a challenge to adequately extract neuronal signals without background contamination. Because of this, we implemented the ‘constrained non-negative matrix factorization for endoscopic data’ (CNMF-E) framework11,38. This recently described framework is an adaptation of the CNMF algorithm39. It can reliably deal with the large fluctuating background from multiple sources in the data, enabling accurate source extraction of cellular signals. It includes four steps: (1) initialize spatial and temporal components of single neurons without the direct estimation of the background; (2) estimate the background given the estimated spatiotemporal activity of the neurons; (3) update the spatial and temporal components of all neurons while fixing the estimated background fluctuations; (4) iteratively repeat step 2 and 3.

Criteria to identify DANs modulated by movement initiation using GCaMP6f imaging

We built a PETH for each neuronal trace spanning from 3 s before to 3 s after movement-initiation events. For this analysis, we considered movement initiations as transitions between a period of at least 500 ms below to a period of at least 500 ms above the acceleration threshold. Distributions of the PETH from −3 to −1 s before movement onset were considered baseline activity. We then determined which bins, during an epoch spanning from −0.5 before to 0.5 s after movement initiation, met the criteria for significant ΔF changes. A significant change in ΔF was defined if at least 2 consecutive bins had ΔF higher or lower than a threshold of 99% above or below baseline ΔF.

Criteria to identify lever-press-related and reward-related DANs using GCaMP6f imaging

We constructed a PETH for each neuron trace spanning from −3 to 3 s from lever press onset for the first, second, third, third to final, second to final and final press, and also for the first lick of reward. Distributions of the PETH from −5 to −3 s before first lever press were considered baseline activity for all press-related activity and distributions from −5 to −3 s of the first lick of reward PETH was considered as baseline for reward-related activity. We then searched each PETH during an epoch spanning from −0.5 s to 0.5 s for bins that were significantly different from the baseline. A significant change in fluorescence was defined as at least three consecutive bins with fluorescence higher than a threshold of 99% above baseline ΔF.

Extracellular recordings during SNc DAN inhibition

Optic fibres and electrodes were positioned 300 μm above the SNc. Light intensity was around 35 mW at the tip of the fibre, corresponding to an estimated40 irradiance of 70–206 mW mm−2 at SNc depth (200 to 400 μm from the fibre tip). Neural activity was recorded daily and the electrodes were moved 50 μm at the end of each recording session. We were thus able to record neural activity from different depths (−3.90 mm to −4.60 mm from the brain surface), with neurons being recorded above, within and below the SNc. We recorded from 140 units and observed that at depths where the SNc is located, more than 60% of recorded units were inhibited (Extended Data Fig. 5), whereas above and below the SNc, very few neurons were modulated. Furthermore, we only observed one single unit that was modulated by light at the depth closest to the fibre where light intensity is higher (−3.9 to −3.95mm, 0.7% of all units recorded, 7.7% of all units recorded at this depth), indicating that light delivery per se was not sufficient to change neural activity at this power. The same positioning of the fibres and light intensity was used during the open field and operant task inhibition experiments.

We used the same set-up and methodology described for the extracellular recordings of photoidentifed SNc DANs, but instead of using blue light, we used green light (see ‘Optogenetics set-ups’). The mean auROC traces presented in Extended Data Fig. 5a, b were calculated as described for the photoidentification experiments. The anatomical scheme depicted in Extended Data Fig. 5b was based on the histological determined position of the electrode cannula and the amount of electrode travel at each recording session.

Open field

Mice were introduced to the open field and green light was delivered continuously for periods of 15 s (mean of 22 ± 3 trials with a mean inter-trial interval (ITI) of 64 ± 28 s per mouse in the ArchT group and a mean of 23 ± 4 trials with a mean ITI of 65 ± 33 s per mouse in the YFP group). An open-field session was done on the day before to habituate mice to the open field and to light delivery (with similar trial structure except for light duration, which was 5 s). Data regarding this first session are shown in Extended Data Fig. 6.

Operant task

The same groups of ArchT and YFP mice used in the open-field inhibition experiment were trained to perform the FR8 task. Optogenetic experiments were started at the end of the FR8 training. We used two different light-delivery schedules: continuous light delivery for 5 s before the first lever press in a sequence; and continuous light delivery for 5 s after the first lever press in a sequence. For the first condition, we made the triggering of the light contingent on the breaking of an infrared beam (IRB) positioned right next to the magazine, on the side of the lever. This way, mice coming from consuming the reward would break the IRB before they started the next sequence. Sessions were divided into two blocks: a first block of 15 trials without light delivery; and a second block of 10 trials with light delivery. The last 10 trials with no light delivery were used to compare with the 10 trials with light delivery. In a few trials, the mouse failed to break the IRB before starting the action sequence. These trials were discarded and not included in the analysis. Sessions with no light delivery were interspersed between sessions with light delivery and a first session with light delivery was only used to habituate the mice to the delivery of light and it was not analysed. The same methodology was used in Jaws experiments with the exception that instead of light on and light off blocks there was a 30% probability of switching on the laser for each trial and data were collected in three consecutive sessions for each experimental condition (inhibition before initiation and inhibition after first press).

SNc DAN activation

Open field

Mice were introduced to the open field and a train of blue laser light (10 ms pulses at 20 Hz, during 0.5 s) was delivered with a variable interval: after 90 s there was a 33% probability that the light was delivered and this was repeated every 10 s until light was delivered.

Closed loop experiment in the open field

For closed loop experiments, the same light pulse train was used, but it was delivered depending on the acceleration state of the mouse in the following way: acceleration of mice was monitored online by feeding the analogue accelerometer data through a Cerebus recording system (Blackrock Microsystems) into MATLAB (Mathworks) using Blackrock’s MATLAB interface (CBMEX). Using a custom MATLAB code, we processed accelerometer data as described above. We monitored acceleration of mice using bins of 300 ms and when mice reached 900 ms below the threshold used to identify immobility, light was delivered with a 50% probability. There was a minimum of 30 s between trials. In this experiment, we considered the maximum acceleration during the first second after each movement initiation as a measurement of initiation vigour.

Anatomical verification

Animals were euthanized after completion of the behavioural tests. First, animals were anaesthetized with isoflurane, followed by intraperitoneal injection of ketamine–xylazine (around 5 mg kg−1 xylazine; 100 mg kg−1 ketamine). Animals were then perfused with 1× phosphate-buffered saline (PBS) and 4% paraformaldehyde, and brains were extracted for histological processing. Brains were kept in 4% paraformaldehyde overnight and then transferred to 1× PBS solution. Brains were sectioned coronally in 50-μm slices (using a Leica vibratome (VT1000S) and kept in PBS solution before mounting or immunostaining experiments). Images were taken using a wide-field fluorescence microscope (Zeiss AxioImager) and the tip of the longest track found was used to determine the anatomical location of the implants (lenses, fibres and electrodes), which was represented in the corresponding Allen Brain Atlas41 slice (Extended Data Fig. 7).

To estimate the specificity of the TH-Cre line, we crossed TH-Cre mice with ROSA26-eGFP mice. TH-Cre;ROSA26-eGFP mice express GFP in neurons expressing Cre recombinase. We used slices from the brain of one TH-Cre;ROSA26-eGFP mouse and used a tyrosine hydroxylase antibody (ImmunoStar) to label the ventral tegmental area (VTA) and SNc DANs (Extended Data Fig. 2). We imaged the VTA and SNc in three different slices (approximately −2.9 mm, −3.3 mm, −3.8 mm from Bregma) using a confocal microscope equipped with a Diode 405-nm, Argon multi-line 458−488−514-nm and DPSS 561-nm lasers (LSM710, Zeiss). We acquired z stacks (354 μm × 354 μm × 5 μm; 5-μm interslice interval) in a tile that covered the VTA, SNc and areas 200 μm above and below the SNc. We imported these images into the Stereo Investigator software (MBF Bioscience) and used a stereological approach to count labelled cells (TH+ and Cre+) and evaluate co-localization, using a 100 μm × 100 μm counting frame (Extended Data Fig. 2a–c).

We also used a stereological approach to estimate the rate and specificity of infection of the AAV2/1.CAG.Flex.ArchT-GFP and the density of TH+ neurons in the SNc of ArchT and YFP TH-Cre mice (ArchT, n = 2; YFP, n = 2). We imaged every six slices in which the VTA and/or SNc were found, using the confocal microscope described above (three slices per mouse). Using a 40× magnification, we acquired z stacks (354 μm × 354 μm × 5 μm; 5-μm interslice interval) in a tile that covered the whole SNc. These tile z stacks were imported into the stereo investigator software (MBF Bioscience) and quantification of the TH+, eYFP+ or GFP+ cells was performed using a 100 μm × 100 μm counting frame (Extended Data Fig. 2d–h).

Statistics

Statistical hypothesis testing was done at a 0.05 significance level (except for classification of neurons, which was done at a 0.01 significance level as explained above). Parametric testing was used whenever possible to test differences between two or more means. Normality was tested using the Shapiro–Wilk test, wheras F-tests (for unpaired t-tests) and Levene’s tests (for ANOVA) were used to assess equality of variance. If data were not normally distributed, we first tried to transform the data using the natural logarithm. If the distribution of the transformed data was still not normally distributed or there was a significant difference in variance, an alternative non-parametric test was used. ANOVA and linear mixed models were used to check for main effects and interactions in experiments with repeated measures and more than one factor. The assumptions for linear mixed models were checked by careful inspection of the model residuals to check for normality and equality of variances. When main effects or interactions were significant, we did planned comparisons according to experimental design (for example, comparing laser on and off). Fisher’s least significant difference tests were used for comparisons after ANOVA tests and least square means tests were used for comparison when linear mixed models were significant. Details on the statistical analysis used for hypothesis testing in the main figures can be found in the Supplementary Table 1. Statistical tests were done using Prism (GraphPad), MATLAB (MathWorks) statistical toolbox and R (R core team 2015, v.3.1.3, lme442).

Code availability

MATLAB (MathWorks) codes used for data analysis are available from the corresponding author.

Data availability

Source Data for Figs 1, 2, 3, 4 have been provided with the online version of the paper and all other data that support the findings of this study are available from the corresponding author upon reasonable request.