brain - machine interfaces ( bmis ) impose arbitrary associations between neural activity patterns and prosthetic actions .
a neuroprosthetic skill is considered successfully acquired when this association is learned and the prosthesis can be controlled in a goal - directed manner .
the underlying principle is that neural activity , reinforced via operant conditioning , can be volitionally generated .
operant conditioning of cortical neurons has been successfully achieved in monkeys ( engelhard et  al . , 2013 , fetz , 1969 , fetz and baker , 1973 , hwang et  al . , 2013 , moritz et  al . , 2008 ,
2014 ) , rodents ( arduin et  al . , 2013 , clancy et  al . , 2014 , gage et  al . , 2005 ,
2012 ) , and humans ( cerf et  al . , 2010 ) by translating their activity into auditory or visual feedback signals and reinforcing desired patterns with reward .
because this paradigm specifies which neurons control an action , it circumvents the neural complexity associated with natural behavior .
its use goes , therefore , beyond bmi applications ; it can serve as a research tool that facilitates dissecting the involved plasticity mechanisms ( sadtler et  al . , 2014 ) .
a closed - loop implementation in which the feedback takes the form of direct cortical activation ( i.e. , an artificial sensory channel ) would offer the advantage of having full control of the neurons directly involved in the association to be learned . implementing such an  artificial position sense  ( lebedev et  al . , 2011 ) in a bmi setting could not only offer more flexible and faster feedback mappings , but , more importantly , substitute the position sense of a neuroprosthetic device when natural sensation is lost .
, 2013 ) ; bias ( salzman et  al . , 1990 ) , mimic ( oconnor et  al .
2013 ) , or even augment ( thomson et  al . , 2013 ) natural perception ; and cue goal - directed movements ( fitzsimmons et  al .
it can also be optimally integrated with natural sensory cues during real reaching movements ( dadarlat et  al . , 2015 ) .
however , in conjunction with volitional neural control , cortical stimulation has only been able to provide cues for choosing ( odoherty et  al . ,
2009 ) or for discriminating ( odoherty et  al . , 2011 ) between virtual targets , while natural sensory feedback was used to guide learning and the actual execution . the feasibility of artificial sensations to not only cue , but to actually instruct in real time the generation of conditioned neural patterns , remains currently unexplored .
this would mean that the brain can create an association between an action and its real - time sensory consequence when both are restricted to activities of different sets of cortical neurons .
stable activity patterns of local populations of motor cortex neurons have been found to emerge during motor learning ( peters et  al . , 2014 ) , and highly interconnected cortical ensembles ( harris and mrsic - flogel , 2013 ) might be responsible for the emergence of such population dynamics where individual neurons matter little .
operant conditioning of a single motor cortex neuron might thus be expected to entrain its ensemble during learning and just be a participant of a changing population code . 
recent findings , however , suggest that learning might be confined to the conditioned neurons rather than involving a  cortical ensemble ( arduin et  al . , 2013 , clancy et  al . , 2014 )
conclusive evidence of such learning specificity requires conditioning single neurons and simultaneous unambiguous tracking of a large number of neighboring non - conditioned neurons . in the present study
, we therefore address the following questions : can mice learn to use a fabricated feedback channel to control single - neuron activity ? how do responses of the conditioned and neighboring cortical neurons change with learning ? for this purpose
, we developed an all - optical bmi , a system for simultaneous wide - field two - photon population imaging of neurons expressing genetically encoded calcium ( ca ) indicators in primary motor cortex ( m1 ) and simultaneous activation of neurons expressing optogenetic actuators in primary somatosensory cortex ( s1 ) .
operant conditioning of a single m1 neuron was performed by reading out its activity in real time , transforming it into a rate code of optogenetic stimulation pulses in s1 and  reinforcing above - threshold activations with reward .
we tested the necessity of the optogenetic feedback signal for identifying the reinforced activations and for learning to produce them more often over time .
we then analyzed learning - related changes observed in conditioned neurons in comparison to those in neighboring , longitudinally tracked , non - conditioned neurons .
our results unveil basic properties of l2/3 processing , which may also characterize cortical activity during , but not be delineable with , natural behaviors .
to test if artificial sensory feedback can guide operant conditioning of cortical neurons , we first developed a novel two - photon imaging system designed for simultaneous optogenetic stimulation of cortical areas in head - fixed mice ( figures 1a1d ; see star methods ) .
mice expressed the genetically encoded ca indicator gcamp6f in forelimb m1 and the optogenetic actuator channelrhodposin-2 ( chr2 ) in the corresponding somatosensory representation ( figure  1a ) .
we used a cre - dependent reporter mouse line ( ai32 ) to ensure a stable level of chr2 expression over time . to monitor the effect of the optogenetic stimulation
, we measured the local field potential in the contralateral s1 with electrocorticograms ( ecogs ; figure  1b ) .
experimental animals were either classified as chr2 mice ( n  = 8) or control mice ( n  = 11 ) depending on whether ecog responses were detectable upon optogenetic stimulation ( figures 1c , s1a , and s1b , available online ) .
the absence of optogenetically driven responses in control mice was due to insufficient or lack of expression of chr2 ( see star methods ) .
two - photon images of large populations of individual l2/3 neurons ( 461   164 , mean   sd ) were acquired at 30hz and simultaneously streamed to a dedicated computer for real - time processing ( figure  1d ) . to condition the activity of a single neuron , we extracted its fluorescence changes from the image and used it as a proxy for its neuronal activity .
the fluorescence transients were transformed directly into a rate code dictating the frequency of the optogenetic stimulation pulses targeting s1 .
a water reward was delivered whenever the conditioned neuron s activity and , by extension , the rate of optogenetic stimulation crossed a chosen threshold , thereby reinforcing high activation levels ( figure  1e ) .
we trained the chr2 and control mice in the operant conditioning task for at least 15 consecutive daily sessions , for 3040  min per session ( figure  s2a ; see star methods for details ) .
potential visual cues from the optogenetic stimulation were effectively masked with blue light flashes ( figure  s1c ) . learning was defined as significant increases in threshold crossing rate ( tcr ) of the conditioned neuron s ( cn ) ca response between session start and end ( two - tailed paired t  test , p  < 0.05 ) . according to this definition , chr2 mice learned on average within single sessions ( figure  2a ) , with six out of eight individuals showing significantly increased tcrs .
a significant increase in tcr compared to session start was already observed in the second time bin ( p  < 10 ) , suggesting that operant control of the cn ensued after 4.9   1.64  min ( mean   sd ) of conditioning .
control mice , which underwent identical experimental procedures and were rewarded at similar rates as chr2 mice ( figure  s2b ) , did not learn on average , with only one out of eleven showing an increase in the tcr ( figure  2b ) .
baseline tcr at the start of a session did not differ between mice that learned and the ones that did not learn ( non - paired t test , p  = 0.15 ; figure  s2c ) .
0.05 ) became more frequent across successive days of training in chr2 mice only ( figure  2c ) .
after more than 10 consecutive days of conditioning , the probability of observing learning in a given chr2 animal reached 40% . during these learning sessions , the number of threshold crossings increased by 0.66   0.08 ( mean   sem ) every minute .
movement artifacts in the two - photon images and activation of the cn by the optogenetic stimulation via direct inputs from s1 were negligible and did not contribute to threshold crossings ( figures s2d 
learning was also not accompanied by more frequent contralateral forepaw movements ( figure  s2h ) . in previous studies , operant conditioning of cortical neurons in the absence of sensory feedback ( reward only ) was found to be either not possible ( koralek et  al . , 2012 ) or only successful in experienced animals previously trained with visual feedback ( fetz , 1969 ) or extensively exposed to reward - based learning ( hira et  al . , 2014 ) .
our results indicate that in naive animals , providing feedback by chr2-based cortical stimulation can expedite operant conditioning of cortical neurons when compared to reward reinforcement only .
therefore , the brain is able to form associations between the activity of a single neuron and proportional feedback stimulation in s1 within single behavioral sessions . given that learning occurs surprisingly fast , have the mice truly formed an association between activity increases of the cn and the reward outcome ?
is optogenetic feedback a necessary cue for maintaining this association after the initial learning has occurred ?
contrary to normal task conditions where rewards were automatically delivered , these questions were addressed with a 
condition , during which mice had to initiate licks upon threshold crossings to receive the reward .
this condition therefore tested if the mice can behaviorally detect instances of threshold crossings ( i.e. , the actions that lead to reward ) and was introduced for brief intervals of time at the end of the last five experimental sessions ( figure  s2a ) . to learn and maintain an association between above - threshold activation and the reward outcome
, mice could also rely on internal predictions related to the generation of the neuron s activity ( i.e. , analogous to efference copies ) . to assess the relative contribution of the involved cues , we uncoupled the optogenetic feedback from the cn s activity in feedback removal and  playback  conditions . in the normal feedback condition , detection probability , defined as the proportion of threshold crossings successfully detected by subsequent licking , was close to unity ( figures 2d and  2e ) .
when feedback was transiently removed , detection probability significantly dropped ( p  < 10 , kruskal - wallis test ) and became no different than would be expected by chance ( figure  s4 ; see star methods for details ) .
these results reveal that the association has indeed been learned , that the optogenetic stimulus remains necessary , and that potential internal cues alone are not sufficient for detecting correct performance . to assess
if optogenetic stimulation alone was sufficient for identifying the rewarded actions , we also introduced a  playback  condition ,
during which the stimulation pattern was transiently decoupled from the cn s real - time activity and controlled by a recording from a previous day ( figures 2d and 2e ) . during playback , because rewarded 
actions  were not generated anymore by the animal , their identification could only be based on the s1 stimulation pattern .
detection probability during playback was not different compared to normal feedback periods ( p  = 0.33 ) , demonstrating the importance optogenetic stimulation acquired during learning ( figures 2d and 2e ) .
to exclude reliance on any other sensory cues , such as visual percepts evoked by the blue light pulses , we also delivered playback stimuli to a control area not expressing chr2 ( figure  1a ) .
under these conditions , detection ability was significantly compromised ( p  < 10 ) and indistinguishable from either the stimulus removal condition ( p  = 0.84 ) or chance occurrence ( figure  s4 ) .
these results indicate that the artificial sensory signal is not only needed for learning to rapidly occur , but also to behaviorally identify correct performance during the task and remain the sole necessary cue for this purpose thereafter .
ca events might occur more frequently over time and thus the rate of those that cross threshold also increases .
alternatively , the ca events might become larger and thereby cross threshold more often . to examine this
, we looked at activity changes of the cns in all sessions with significant learning ( n  = 33 ) .
within - session increases in tcr were guided by increases in the rate of ca events ( i.e. , occurrence of spike bursts ) , as well as increases in their individual amplitudes ( i.e. , number of spikes in a burst ) ( figures 3a and 3b ) .
while both changes in ca event rate and amplitude contributed to tcr increases , event amplitude changes accounted significantly more on average for the variability in tcr during a session ( general linear model ; figure  3b , inset ) .
furthermore , if either increase of the amplitude or rate of the conditioned events still persists , it would indicate that this activity change might be the result of learning - related plasticity .
we found that upon feedback removal event rate significantly dropped , leading to a decreased number of threshold crossings , yet the event amplitude remained elevated ( figure  3b ) .
the persistence of the elevated amplitude might therefore be an indication of lasting plasticity changes in the system .
the immediate decrease in the rate of events , on the other hand , indicates that  feedback remains necessary for maintaining the learned behavior and that the observed increases in cn s activity are not signs of irreversible ca accumulation or related to the acquisition of a habit .
we next asked if these learning - related changes are specific to the cn or if they can also be found in simultaneously imaged neighboring neurons .
we found that 6.4% ( quartiles , 2.3% and 10.6% ) of neighboring neurons had significant within - session linear increases in either event rate or amplitude and were therefore labeled as  increasing neurons  ( ins ) these increases , however , did not match the characteristics of the learning - related activity changes of the cns ( figures 3c and s5 ) . whereas the rate changes of ins were similar to those of cns ( two - sided paired t test , p  = 0.51 , t(26 )  = 0.661 ) , the mean changes in event amplitude , which are mostly responsible for learning , were statistically different ( p  < 0.001 , t(26 )  = 4.257 ) .
furthermore , the onset of ca events in ins lagged both rewarded ca events of the cn and reward onsets ( figure  3d ) .
thus , activity increases observed in non - conditioned neurons probably reflect the behavioral consequences ( e.g. , reward anticipation , collection , or consumption ) rather than causes of above - threshold activations of the cn .
it follows that learning - related changes are restricted to the cn and do not involve the collective activation of a local population of m1 neurons .
because the feedback signal represents a pseudo - random stimulation pattern for all neurons other than the cn , the observed neuronal specificity suggests that it is the activity - locked feedback signal , and not just the s1 optogenetic stimulation per se , that is important for learning .
the neuronal specificity further suggests that the conditioned activity was not primarily related to other variables such as forelimb movements that would most likely result in driving all forelimb - related neurons in concert . in spite of an absence of learning - related activity increases in neighboring neurons , it is still possible that the cn is driven by activity in the local network .
indeed , we found that a small fraction of neighboring neurons ( 2.5% ; quartiles , 0% and 8.2% ) exhibited ca events that preceded those of the cn more often than would be expected by chance ( p  < 0.01 , hypergeometric probability ) ( figure  3e ) and could therefore potentially constitute pre - synaptic inputs .
these events occurred sparsely ( 30%   10% , mean   sd of threshold crossings ) , and in only 16% of these  leading neurons ,  an ideal observer could discriminate whether a conditioned ca event would cross threshold or not ( p  < 0.05 , permutation test , receiver operating characteristic [ roc ] analysis ; see star methods for details ) .
leading neurons ,  but not the ins , were situated in closer spatial proximity to the cn than a size - matched random neuronal sample ( figures 3e and 3f ) .
small spatially organized functional clusters of neurons might therefore exist in l2/3 of m1 , as previously suggested ( hira et  al .
these putative local pre - synaptic drivers might actually be more numerous , yet be individually weak and therefore below the detection threshold of ca imaging used in this study .
therefore , even if the animals learned to control a single neuron instead of an m1 subpopulation , the nearby neurons might still play an active role in providing part of the drive to the cn .
long - term tracking of individual l2/3 neurons has revealed that their population representation might be stable , but their individual responsiveness and/or functional tunings are flexible day to day in motor ( huber et  al . , 2012 ,
peters et  al . , 2014 ) , as well as sensory ( unpublished data ) cortices .
similarly , consistent cross - day learning of multi - unit neuroprosthetic control has been found to require either daily retraining or iteratively adapting the decoder to the day - to - day variability of neuronal activity ( orsborn et  al . , 2014 , taylor et  al . , 2002 ) .
redundant representations of a motor or sensory function across many neurons might allow such flexibility and reflect a necessary adaptability of neural responses .
however , operant conditioning of a single m1 neuron attributes a functional role to that neuron only .
it might therefore be expected that its responses would become more stable and stereotyped over time .
we analyzed the stability of the cns across multiple days of learning . despite their exclusive status
, cns were readily found inactive at the start of a new session and often remained silent for several consecutive days ( figures 4a and s6 ) .
this prevented further conditioning with the same neuron and forced us to choose a new one .
the decision to switch conditioning to a new neuron was based on a baseline recording prior to session start ( see star methods for details ) , whereas the data in figure  4a depict the neuron s average activity during the entire session .
the distribution of day - to - day changes in the overall ca event rate of the cns was not different from that of the  non - conditioned neurons ( figure  4b ; two - sample kolmogorov - smirnov goodness - of - fit test , p  = 0.15 ) .
conditioned l2/3 neurons seem therefore not to be immune to flexibility , even when they acquire an exclusive functional role , which further highlights the robustness of this seemingly intrinsic property of l2/3 representations .
taking together the remarkable speed and specificity with which the conditioned neuron adapts to the imposed constraints , our results suggest the existence of functionally and spatially specific plasticity mechanisms able to tune the activity of an l2/3 neuron on very short timescales . to determine if more complex mappings can also be rapidly learned with artificial feedback , we trained mice to modulate the activity of three neurons simultaneously .
chr2 mice previously trained on the single - neuron task were taught to co - activate two arbitrarily chosen m1 neurons , while silencing a third neuron to gain reward .
the amplitude of the fluorescence signal of each neuron was transformed with a logistic function .
the outputs of neurons 1 and 2 were summed and that of neuron 3 subtracted to obtain an ensemble signal ( figure  5a ) .
the ensemble signal dictated the frequency of optogenetic stimulation pulses according to the same transfer function as in figure  1d , and above - threshold crossings triggered reward .
the threshold level was chosen so that only simultaneous activations of neurons 1 and 2 , and near - baseline activity of neuron 3 , led to reward .
any activation , no matter how strong , of either neuron 1 or 2 alone was not sufficient for threshold crossing , and any above - baseline activity of neuron 3 prevented it ( figure  5b ) .
we found that chr2 mice can also learn this more complex mapping , as indicated by within - session linear increases in tcrs ( figure  5c ) .
as imposed by the mapping rule , neurons 1 and 2 were co - activated at threshold crossings of the ensemble activity ( figure  s7b ) .
the probability of these co - activations might fortuitously increase during a session as the rate of ca events increases in the two neurons , or even in only one of them . both neurons indeed increased their overall activity throughout a session ( figure  s7a ) . but to test whether mice also generated more co - activation per se , we analyzed if the number of co - activations per produced ca event changes during learning .
we found that this ratio significantly increased between session start and end for both neuron 1 ( p  = 0.003 , kruskal - wallis test ) and neuron 2 ( p  = 0.03 ) , demonstrating that more frequent co - activation did not occur fortuitously .
a comparison of each neuron s activity aligned on any ca event of the other , between the start and end of a session , confirms that they became more co - active during learning ( figure  s7b ) . to illustrate a practical neuroprosthetic application of this mapping
, we also translated the imposed rules into mechanical constraints governing the multi - joint displacement of a robotic arm ( figure  5a ; movie s1 ) .
the activity of each neuron was transformed into a joint angle , rendering the ensemble activity proportional to the distance ( in joint angle coordinates ) from the arm s endpoint to a target area .
the optogenetic stimulation thus provided feedback of the arm s position relative to the target .
the increased number of threshold crossings was therefore akin to more frequent target hits ( figure  5c ) .
although unbeknownst to the mouse , increases in the rate of successful displacements toward the target illustrate how multiple l2/3 neurons can be conditioned to execute goal - directed movements of a prosthetic device under the guidance of artificial sensory feedback .
this study reveals that artificial sensory feedback about the current activity state of one or multiple volitionally modulated neurons can guide rapid learning during operant conditioning .
we effectively fabricated an optical version of an artificial cortical communication channel ( jackson et  al . , 2006 ) , which was used by mice to rapidly ( i.e. , in less than an hour ) learn to produce reinforced neural activity patterns in a goal - directed manner , similarly to using natural sensorimotor associations .
schematic depictions of such a channel are readily included in idealized views of neuroprosthetic control where artificial sensory information from the prosthetic device is fed back directly to the brain ( bensmaia and miller , 2014 , kwok , 2013 ) .
our experiments provide a seminal proof of concept of such a system using an adaptation - based approach ( bensmaia and miller , 2014 ) and illustrate that it could in principle be used to modulate multiple neurons in concert for executing goal - directed multi - joint prosthetic movements . a more biomimetic implementation ( bensmaia and miller , 2014 )
it would necessitate that multiple instances of the artificial channel be learned in parallel , each activating and providing  proprioceptive  feedback of a single joint .
graded stimulation of the cortex has previously only been used to guide natural forelimb reaches ( dadarlat et  al . , 2015 ) ,
albeit under the assistance of proprioception and a lengthy ( i.e. , several months ) learning procedure involving pairings with visual cues .
in contrast , we demonstrate that both sensory and motor peripheries can be bypassed and that unassisted , arbitrary associations can be fashioned between activities of two different sets of cortical neurons ( not necessarily invoking direct anatomical pathways ) .
a key component in our experiments was the wide - field imaging of a large number of cortical neurons and their longitudinal tracking during conditioning .
it enabled us to peek into cortical mechanisms underlying volitional neural control and how the brain drives its own activity .
conceptually , the reinforced activity of the conditioned neuron ( i.e. , the controlled variable ) is driven by a
this might seem surprising given that cortical networks are locally highly interconnected ( harris and mrsic - flogel , 2013 ) .
it is , however , consistent with the general sparseness of l2/3 neuronal firing ( petersen and crochet , 2013 ) where population activity is thus not expected to reflect a common motor function and might be less correlated compared to the output neurons of the deeper layers of cortex .
previous studies actually report a similar confinement of learning - related activity to conditioned cortical neurons ( arduin et  al . , 2013 , clancy et  al . , 2014 ) .
the original single - neuron conditioning experiments of fetz and baker ( fetz and baker , 1973 ) targeted deeper cortical layers ( probably layer 5 ) using microelectrodes to simultaneously record the conditioned and an adjacent neighboring neuron .
their findings revealed that in about half of the recorded pairs , the responses were correlated during threshold crossings .
we can therefore hypothesize that spatial specificity is more prominent in l2/3 and might be related to the necessary flexibility of this cortical layer for the purposes of learning new skills and adaptive mechanisms in general ( huber et  al .
it follows that the  volitional controller  driving l2/3 neurons most likely involves other , more distributed or distant cortical activations or subcortical pathways ( koralek et  al . , 2012 ) .
our results also demonstrate that when reward is contingent on the volitional activation of a single neuron , neural mechanisms can home in on that cell and ignore its immediate cortical neighbors . in a way , this mirrors a concept put forward by in  vivo single - cell stimulation experiments ( brecht et  al . , 2004 , houweling and brecht , 2008 ) .
the latter suggests the existence of circuits downstream of the stimulated cortical neuron capable of reading out single - cell activity .
our finding , on the other hand , suggests that activity in circuits upstream of the conditioned neuron can be routed to a single cortical cell . both emphasize the behavioral relevance of single - neuron activity , which might be more significant than previously thought .
the closest direct precedent to our study is the work of clancy and colleagues ( clancy et  al . , 2014 ) .
they also used wide - field imaging to condition cortical neurons and were thus also able to unambiguously track activity of a local subpopulation of individual neurons during learning . instead of conditioning a single neuron
, they conditioned ensembles of up to eleven neurons . the auditory feedback and reward delivery were dependent on the summed activity of the ensemble .
additionally , they calibrated the feedback transform coefficients and reward thresholds daily based on baseline activity levels , whereas we kept them the same throughout the experiment for each conditioned neuron .
their approach was hence more immune to day - to - day fluctuations in the activity of single neurons and probably explains why apart from observing within - session learning as we did , their mice also learned across days .
similar coordination between non - conditioned neurons , those outside the ensembles , was not present and did not increase over time .
such specificity of learning - related changes to conditioned neurons is confirmed in the present study , but our findings go further by demonstrating that this remains true even when conditioning is restricted to just a single neuron . clancy and colleagues also identified that some non - conditioned cells were activated around threshold crossings , which was more evident for those nearby than those distant from the conditioned ensemble .
although a direct comparison is not possible because they do not report precise temporal relationships , these nearby cells might be similar to our spatially clustered 
leading neurons ,  which represent a putative pre - synaptic drive of operant activity in the local network .
the finding that increased amplitudes of the ca events ( reflecting stronger bursts ) guided learning and persisted despite a performance drop after feedback removal led us to speculate that learning might in part be the result of neuronal plasticity , such as synaptic potentiation or more synchronous inputs to the conditioned neuron .
future experiments could thus be aimed at identifying potentiated synapses and subsequently tracing the source of the related pre - synaptic input ( wickersham et  al . , 2007 ) .
since the  volitional controller ,  again conceptually , uses the feedback signal to modify the controlled variable ( fetz , 2007 ) , the fact that we could artificially constrict the feedback to a set of cortical neurons might further facilitate its identification . a potential site of plasticity
could be the cn s synapses receiving direct input from s1 . in the mouse vibrissal system , s1 projections directly target l2/3 neurons in m1 ( mao et  al . , 2011 ) , and analogous
the sequential activation of the cn and s1 afferents might have , by design , led to a hebbian - like spike timing - dependent plasticity ( markram et  al . , 1997 ) and have been a contributing factor to producing more post - synaptic spikes over time .
if that were the case , it is expected that s1 stimulation would evoke higher ca levels in the cn after , as compared to before , learning . however , we were not able to detect any significant fluorescence transients in the cn upon optogenetic activation of s1 , neither before nor after learning ( figure  s3c ) .
learning - related activity increases in the cn therefore do not seem to be mediated by direct s1-to - m1 projections , reinforcing the idea that more intricate pathways are involved .
actually , because s1 stimulation does not lead , but follows , the cn s activation by a few milliseconds , it is more likely that the synapses in question were depressed and not potentiated ( jacob et  al . , 2007 ) .
indeed , stimulation of a cortical site proportional to real - time activity recorded at another site induces neural plasticity that is consistent with synaptic potentiation of pathways from the recording to the stimulation site , and not vice versa ( jackson et  al . , 2006 ) .
further work is  therefore required to unequivocally identify the recruited pathways and the source of the input driving the conditioned neurons in m1 .
in practical terms , this means that attaching an  artificial position sense  to neuroprosthetic actuators is feasible and can in principle be rapidly learned ( figure  5a ; movie s1 ) .
these findings in rodents might also be applicable to humans and pave the way toward developing artificial feedback systems for patients , which could be implemented even with currently available electrode - based approaches .
besides neuroprosthetic applications , our study also provides a novel behavioral tool for in  vivo circuit dissection : an  in cerebro 
learning paradigm that bypasses sensory and motor peripheries by imposing the learned action and its feedback directly in the cortex .
this approach can potentially substitute for natural behavior and thereby facilitate dissecting neural circuits underlying sensorimotor learning .
for instance , trans - synaptic tracing ( beier et  al . , 2011 , wickersham et  al . ,
2007 ) can identify the presynaptic drivers of the conditioned neuron and the postsynaptic targets of the stimulated neurons , thus revealing how the feedback signal is routed to instruct volitional control and what ultimately drives the output .
in addition , structural imaging and functional manipulations of the spines of conditioned neurons or the boutons of stimulated cells can provide insights into the synaptic plasticity mechanisms at play .
finally , the accuracy of circuit dissection can be improved by producing a more specific feedback signal aimed at individual neurons with two - photon targeted activation and simultaneous imaging ( packer et  al . , 2015 ,
reagent or resourcesourceidentifierantibodiesanti - chr2mfd diagnosticsclone 15e2biotinylated goat anti - mouse iggvector labscat # ba-9200 ; rrid : ab_2336171bacterial and virus strainsaav2.1-syn-gcamp6f.wpre.sv40university of pennsylvaniacat # cs0201aav2.1-hsyn-cre.wpre.hghuniversity of pennsylvaniacat # cs0342chemicals , peptides , and recombinant proteinssigma fast dab tabletsigma - aldrichcat # d4293 - 50setexperimental models : organisms / strainsmouse : ai32 : rosa - cag - lsl - chr2(h134r)-eyfp - wprejackson laboratoryrrid : imsr_jax:012569mouse : wild type : c57bl/6ncrlcharles rivercat # 027 further information and requests for resources and reagents should be directed to and will be fulfilled by the lead contact , daniel huber ( daniel.huber@unige.ch ) .
we used 8 to 12  weeks old ai32 transgenic homozygote male mice carrying a floxed chr2(h134r)-eyfp fusion gene inserted in the gt(rosa)26sor locus in a c57/bl6 background mouse strain ( madisen et  al . , 2012 )
the animals were housed in an animal facility , maintained on a 12:12 light / dark cycle and were placed under a water restriction regime ( 1  ml / day ) ( median weight : 22.5 g , range : 19.2  g to 24.1 g ) .
the animals did not undergo any previous surgery , drug administration or experiments and were housed in groups of maximum 5 animals per cage .
all procedures were approved by the institutional animal care and use committee of the university of geneva and geneva veterinary offices .
all surgeries were conducted under isoflurane anesthesia ( 1.5%2% ) and additional analgesic ( 0.1  mg / kg buprenorphine intramuscular ( i.m . ) ) , local anesthetic ( 50 - 100  l 1% lidocaine subcutaneous ( s.c . ) under the scalp ) and anti - inflammatory drugs ( 2.5  mg / kg dexamethasone i.m . and 5  mg / kg carprofen s.c . ) were administered as necessary .
a custom made titanium head bar was implanted in the skull to allow for subsequent head fixation .
a craniotomy was performed over the left frontal cortex and two viral injections ( 30 - 50 nl each ) were delivered ( 10 - 20 nl / min ) into the forepaw representation in s1 ( 0.75  mm anterior , 2.25  mm or 1.75  mm lateral to bregma ) and two in the forepaw m1 ( 1.75  mm anterior and either 2  mm or 1.5 lateral ) . in 8 mice ,
( aav2.1-syn - cre , 1:100 for 2 mice and 1:1000 for 6 mice , 0.2% fastgreen in sterile saline , virus stock titer 1.46   10 genome copy per ml ( gc / ml ) ) . in m1 ,
( aav2.1-syn - gcamp6f , 1:10 , 2.96   10 gc / ml ) was injected .
the coordinates for the somatosensory representation of the forepaw were based on a series of intrinsic signal imaging sessions ( 7 additional ai32 mice ) .
after virus injection , cortex was rinsed for 1 - 2  min with dexamethasone ( 0.03% ) .
two hand - cut glass coverslips ( 150  m thick ) that matched the shape of the craniotomy were glued together with optical adhesive ( norland 61 ) .
the cranial window was placed on top of the cortex , glued to the bone with cyanoacrylic glue and secured with dental cement .
the correspondence between the s1 injection sites and the sensory forepaw representation was confirmed post - operatively with intrinsic signal imaging in each mouse .
the m1 injection coordinates were calculated relative to the s1 coordinates and based on a database of cortico - cortical projections in somatic sensorimotor areas ( zingg et  al . , 2014 ) .
in addition , all mice were implanted with cortical surface electrodes ( teflon coated gold wires , au-3 t , science products , germany ) in the contralateral somatosensory ( 0.75  mm anterior , 2  mm lateral to bregma ) and visual cortices ( 3  mm posterior , 1  mm lateral to bregma ) .
after a four day recovery period , mice were placed under a water restriction regime ( 1  ml / day ) .
neural responses could be evoked by optogenetic stimulation of s1 in all 8 mice ( figures s1a and s1b ) .
histological verification of chr2 expression revealed dense labeling of cell bodies and neuropil in l2/3 and l5 at the s1 site , whereas no neurons were retrogradely labeled in m1 ; only axonal projections of chr2 neurons from s1 could be observed ( figure  s8a ) .
11 additional male mice that underwent identical surgery and injection procedures were used as controls as they did not exhibit ecog responses to the optogenetic stimulus ( figures s1a and s1b ) and showed no or only sparse expression of chr2:4animals were wild - type siblings not carrying the floxed chr2-eyfp gene.2ai32 mice were heterozygote siblings4ai32 homozygote mice received a highly diluted cre - virus injection in s1 ( 1:10000).2ai32 homozygote mice received a diluted cre - virus injection in s1 ( 1:1000 ) , but showed only very sparse expression of chr2 ( figure  s8b ) .
we explain the low chr2 expression levels and lack of evoked responses in these mice by the failed virus delivery during surgery .
ai32 mice were heterozygote siblings ai32 homozygote mice received a highly diluted cre - virus injection in s1 ( 1:10000 ) .
ai32 homozygote mice received a diluted cre - virus injection in s1 ( 1:1000 ) , but showed only very sparse expression of chr2 ( figure  s8b ) .
we explain the low chr2 expression levels and lack of evoked responses in these mice by the failed virus delivery during surgery . at the end of the experiments ,
mice were deeply anesthetized with pentobarbital , transcardially perfused with cold saline and paraformaldehyde 4% ( pfa ) and the brains were removed and stored overnight in pfa 4% .
then , the brains were transferred to a sucrose solution ( 20% in pbs 0.1 m ) for at least 24  hr and sliced in 50  m coronal sections with a freezing microtome .
tissue was stored in a solution of sodium azide ( 0.01% in pbs 0.1 m ) until histological processing .
slices were incubated with a mouse primary monoclonal antibody anti - chr2 ( clone 15e2 , mfd diagnostics ) and with a biotinylated secondary antibody anti - mouse ( vector labs ) .
the tissue was finally processed with diaminobenzidine ( sigma - aldrich ) for the colorimetric reaction .
slices were mounted and imaged with a wide field scanner microscope ( olympus vs120 ) at 10x .
mice were head - fixed and placed on a heated platform under light isoflurane anesthesia ( 0.75% ) .
ten 1  s vibrotactile stimuli consisting of a 100  hz sinusoidal vibration were delivered to their forepaw with a 10  s inter stimulus interval .
the cranial window was illuminated by a collimated red light led ( 630 nm ) and imaged at 10 fps with a 256 by 332 pixels resolution .
the average difference image between the stimulation period and a 1.5  s baseline period was processed by a 50 by 50 pixels spatial averaging filter and subsequently smoothed by a 5 by 5 pixels gaussian low pass filter with 0.5 pixels standard deviation .
imaging was performed with a custom built two - photon microscope ( mimms ; https://openwiki.janelia.org/wiki/display/public/home ) controlled by scanimage 4.2 ( scanimage.org ) using a 16x 0.8 na objective ( nikon ) and with excitation wavelength at 940  nm ( ultra ii , tunable ti : sapphire laser , coherent ) .
512 by 512 pixel images covering 626 by 665  m of cortex were acquired at 29.57  hz using bidirectional scanning with a resonant scanner system ( thorlabs ) .
the power was modulated with pockels cell ( 350 - 80-la-02 , conoptics ) and calibrated with a photodiode ( thorlabs ) .
optogenetic stimuli were generated with a 473 nm laser ( dhom - w473 - 200mw , ultralasers ) which was custom modified to be gated electronically using ttl pulses .
the power was calibrated before each session to be 20mw at the stimulation site on the brain surface .
the imaging and optogenetic beams were combined using a longpass dichroic mirror ( 700dcxxr , chroma ) between the scan lenses and the tube lens .
the primary mirror for imaging was a custom polychroic ( chroma , zt470/561/nir - trans ) transmitting the infrared and blue light , while reflecting the green . before detection
, the remaining ir light was filtered with a colored glass band pass filter ( bg39 , chroma ) , whereas the remaining blue light was removed with a short pass filter ( cg475 , chroma ) .
images were continuously acquired using gated photo multiplier tubes ( gpmt ) ( h11706p-40 sel , hamamatsu ) and written in 16 bit format to disk in separate files ( 1110 frames / file ) .
the start / end of file trigger was issued by a separate pc and later used for temporal alignment of ca traces with behavioral variables .
the objective was aligned perpendicular to the imaging window for each mouse using a custom built laser - based alignment device . at the start of each session , the imaging field
was manually located using reference images of previous recording days and slow drifts manually corrected for throughout the session . to correct for lateral movements ,
a custom matlab registration algorithm was used to align each image to a template taken as the average image of a 30  s resting baseline period recorded at the start of each session .
the cross - correlation was computed between each image and the template by multiplying the two - dimensional discrete fourier transform of one with the complex conjugate of the fourier transform of the other and taking the inverse fourier transform of the product .
the row and column location of the peak cross - correlation value was taken as the vertical and horizontal shift , respectively .
10% of each image was cropped at the boundaries for the purposes of this computation .
semi - automatic custom matlab routines were used to draw regions of interests ( rois ) for individual neurons using the session average image .
the ca - dependent fluorescence time series were extracted by averaging pixels within each roi .
the time - varying baseline f0 of a fluorescence trace was computed as the average value in a 20  s moving time window by excluding values that surpass 20% of this average . at each time point , the updated baseline value f0 was subtracted from the raw fluorescence value f to yield f and compute the relative change to baseline as f / f0 .
images of scanned brain tissue acquired with scanimage were streamed on the local network using the user datagram protocol ( udp ) .
each end - of - frame signal triggered a custom coded matlab routine that sent , in succession , 32 equal - sized lines of the 512 by 512 pixel image ( i.e. , 16 packets / image ) over the network .
the packets were read on the appropriate udp port on a separate pc , the images reassembled and the relative change with respect to baseline of the conditioned neuron(s ) computed by extracting the average pixel intensity in a defined region of interest comprising a single cell .
the extracted activity was downsampled to 0.2  s by averaging blocks of 6 consecutively received images and changes relative to a preceding 20  s moving baseline window were computed ( f / f0 ) .
f / f0 values exceeding 20% were excluded when updating the baseline value . a second custom written matlab instance running on the same pc transformed , at every time sample t , f / f0 into a frequency value f(t ) according to f(t)=aen(t)a where n(t ) is the f / f0 value at time t. the obtained frequency value
was then binned into one of 17 bins ranging from 1  hz to 15.12  hz in quarter - octave increments and produced a rate signal for the optogenetic pulses .
the pulse rate was updated whenever the binned f(t ) differed from the binned f(t-1 ) .
linear changes in neural activity therefore resulted in exponential changes in the feedback signal ( figure  1d , inset ) . a third custom written matlab instance used the rate code to generate an analog output signal on a data acquisition board ( national instruments , austin , tx ) that produced the optogenetic feedback to the mouse .
the same instance also triggered a 0.35  s auditory beep and a reward pulse that opened a valve to deliver a drop of water to the mouse whenever the signal crossed a threshold level .
the water drop was sucked away with a peristatic pump ( minipulse 2 , gilson , middleton , wi ) right upon delivery , thereby requiring immediate consumption and instigating anticipatory licking .
rewards were always delivered automatically upon threshold crossings except in the lick - triggered reward condition of the last 5 sessions ( see behavioral training section below ) .
the threshold level was initially chosen for each neuron on a trial - and - error basis to yield a minimum of approximately two rewards per minute , based on a baseline recording period , and was kept fixed thereafter .
that was binned in the maximum 15.12  hz bin and was set by adjusting the coefficient a. only threshold crossings triggered a reward and the 15  hz stimulation was turned off if a sustained activity above threshold continued in excess of 1 s. the optogenetic feedback was reinstated once such sustained activity came back below threshold .
this was done to pair the maximum stimulation frequency ( 15  hz ) with activity threshold crossings only , as this is what we sought to reinforce . by turning the stimulus off
we avoided optogenetically reinforcing high levels of activity sustained above threshold that did not lead to reward .
the total median time delay between frame completion and feedback generation was uniformly distributed between 19.2  ms and 219.2  ms ( see table).median ( 5% and 95% quantiles ) time delays incurred by the different processing stagesframe transmission11.2 ( 9.2 , 13.0 ) mssignal extraction7.1 ( 6.8 , 10.1 ) msrate code computation0.84 ( 0.8 , 5.4 ) msfeedback generation0.052 ( 0.05 , 3.2 ) ms median ( 5% and 95% quantiles ) time delays incurred by the different processing stages the choice of the conditioned neurons was biased toward neurons in the middle of the imaged field of view .
other selection criteria were a clear identifiable morphology and a minimal ca event rate of 2 events / minute ( assessed during initial baseline measurements lasting 2 to 3  min ) .
once a neuron was chosen , it was used for conditioning on all subsequent sessions as long as it remained active ( produced more than 2 ca events / minute ) .
if the criterion was not met , conditioning was switched to a new neuron meeting the criterion before the start of the session . the functional role ( relationship to movements ) of the chosen neurons
was not assessed and therefore remained unknown . because image movement correction was not performed for the real - time data , we quantified the artifactual transitions in the conditioned f / f0 traces that were induced by lateral motions ( figures s2d
the optogenetic feedback was guided by mirrors through the imaging objective and visually aligned on the chr2 expression site in forepaw s1 using a ccd camera and a reference image of the blood vessel map .
the squared pulses were used to electrically switch the laser on and off creating as such a fast and silent shutter for the blue light stimulus .
the same pulse signal elongated by 1  ms turned off the gpmt used for imaging during photostimulation periods .
this resulted in at most one band of 92 lines of the 512 by 512 pixel images to be blacked out over a two frame period for the maximal 15  hz stimulation level .
eventual blanking of the cn was detected online and the frame in question was ignored in subsequent processing stages . as a visual mask ,
a collimated blue light led ( 473  nm , roithner ) was turned on and the gpmt turned off during flyback periods of scanning ( 1.5  ms pulses at the 29.57  hz acquisition rate ) , thus not affecting the acquired images while providing a perceptually stable visual stimulus .
this pulsated blue light illuminated the otherwise dark setup from session start to session end .
the feedback signal was delivered continuously without any trial structure but was paused for 1  s at 37.5  s intervals to allow for logging acquired data to separate files .
this end / start of file trigger was also used to periodically update the saved image files on the scanimage pc and later used for aligning extracted ca traces with behavioral variables .
mice sat head - fixed in a tube ( 25  mm inner diameter ) .
the forepaw contralateral to the imaged and stimulated cortical sites was resting on a hold bar to maintain balance while the ipsilateral forepaw was restrained inside the tube .
the water reward was delivered through a spout placed at licking distance below the snout .
the tube and the mouse were connected to a 5  v node and , when touched , the conductive hold bar and reward spout shunted the 5  v to a circuit that pulled a respective analog input signal to the data acquisition board to high .
licks and forepaw rests were in this manner continuously acquired at a sampling rate of 1 khz .
releases of the hold bar were used to assess if mice consistently used contralateral forepaw movements to solve the task ( figure  s2h ) .
we used 4 control mice to test the efficacy of a blue visual mask in suppressing visually evoked ecog responses by the optogenetic stimulus . with the mask turned off , visually evoked potentials were observed in response to the onset and offset of the blue laser pulse train , but were completely suppressed when the mask was turned on ( figures s1c and s1d ) .
mice were trained in the operant conditioning task for 15 to 17 consecutive daily sessions .
the experimental timeline of each session was divided into condition blocks ( figure  s2a ) .
each conditioning session began with a three minute period of playback where a neural activity recorded on a previous day controlled the optogenetic feedback and reward delivery , in otherwise identical experimental settings .
the f / f0 trace of the conditioned neuron saved in a previous session was used for this purpose . instead of the f / f0 values extracted from the streamed images at each time sample in real - time ,
the optogenetic feedback and threshold crossings were determined by the f / f0 values of that saved trace .
control was then switched to the conditioned neuron and after an average of 25  min of real - time conditioning , the optogenetic feedback was removed for 3  min and reinstated thereafter .
lick - triggered rewards were introduced during the first 3  min of playback and 3  min before , during and after optogenetic feedback removal . instead of being automatically delivered , mice had to initiate licking in a 500  ms time window following threshold crossings to obtain the reward . because rewards were otherwise always automatically delivered , these brief introductions of the lick - triggered reward condition were not significant enough to incentivize mice to engage in continuous licking as is sometimes observed in such lick - triggered reward paradigms .
additionally , each session ended with 6  min of playback under the lick - triggered reward condition .
in the first 3  min , optogenetic stimulation was applied to a control non - chr2 site and moved back to the s1 chr2 site in the last 3  min of playback .
the positions corresponding to the chr2 and control sites were located on the blood vessel map using a ccd camera and their image coordinates recorded .
the optogenetic beam was then positioned with a pair of galvanometric mirrors on those same image coordinates ( using a reflective surface ) and the corresponding voltages applied to the two mirrors were recorded for each site .
the beam was then moved between chr2 and control sites , during the experiment , by applying the appropriate voltage levels at relevant times .
all transitions between different experimental conditions were not cued by experiment interruptions or additional sensory stimuli . in the three neuron conditioning experiments , each neuron s activity n was transformed by a logistic function according tof(n)=12[1+tanh(a(nc ) ) ] .
the ensemble activity f(n1)+f(n2)f(n3 ) controlled the rate of optogenetic feedback pulses and reward delivery .
a and c were set to 2.2 and 0.6 , respectively and the reward threshold to 1.75 .
this mapping constrained neurons n1 and n2 to co - activate and n3 to remain silent to bring the ensemble activity above threshold and trigger a reward . more specifically , f / f0 values of n3 above 0.36 prevented threshold crossings irrespective of n1 and n2 activity .
concomitant f / f0 values of n1 and n2 above 1.15 resulted in threshold crossings provided the activity of n3 remained at zero .
no statistical methods were used to predetermine sample size and all trained animals were included in the analysis . two - tailed student s t test ( for samples with equal variances ) or welch s t test ( for samples with unequal variances )
equal variances were determined with the two - sample f - test and the normality assumption was tested with the kolmogorov - smirnov test .
the efficacy of chr2 activation ( figures s1a and s1b ) was assessed by measuring differentially between the two contralateral cortical electrode responses evoked by a 0.5 s train of 5 ms optical pulses delivered at 15 hz .
peak responses in a 20  ms time window following the onset of each 5  ms light pulse were compared across all stimulation trials ( n = 30 ) to peak responses to the same number of simulated light pulses in the 0.5  s baseline period preceding the stimulus train onset .
animals with significant differences ( paired t test , p  < 0.05 ) between true and simulated mean peak values were classified as chr2 mice and as control mice otherwise .
no method of randomization was used and the investigator was not blind with respect to the classification of 5 control animals , but was blind for the other 6 and for all chr2 animals .
learning curves were calculated for the conditioning period between the end of the initial playback and either the onset of feedback removal or onset of the lick - triggered reward condition that precedes feedback removal .
threshold crossing rate ( tcr ) was calculated for each of 8 equally sized time bins in this window .
learning sessions were defined as those with significant linear increases of tcr across the 8 bins ( linear regression , p  < 0.05 ) .
mice with significantly bigger tcr in the last compared to the first bin across all sessions were labeled as learners and as non - learners otherwise .
tcr normalization was performed by offsetting individual session learning curves to the same tcr value in the first bin , taken as the mean of all first bin tcr values , and dividing the rate of each bin by it .
chance levels of detection probability of threshold crossings assessed in the lick - triggered reward condition ( figure  s4 ) were simulated separately for each mouse and each experimental condition as follows : 1 .
we identified the experimental epoch corresponding to each individual data point included in the mean value calculations of figure  2e .
we isolated licks that occur only during baseline stimulation ( i.e. , 1  hz ) and attributed them to spontaneous licking .
we then simulated spontaneous licking for the whole epoch by randomly reproducing the isolated lick sequences , thus preserving their temporal statistics ( i.e. , the inter - lick - interval and lick duration ) .
chance detection probability was then calculated using these simulated licks and the same neural activity as for the actual data .
as such , this procedure yielded for each individual data point a corresponding chance level and allowed paired statistical comparisons .
ca events were detected by taking the first derivative of the smoothed f / f0 trace ( savitzky - golay filter , second order polynomial , 15 data points ) and an event onset was defined when the z - scored trace crossed a value of 2 and event end when it decreased again below 0 .
event amplitude was defined as the difference of the f / f0 values between event end and event onset time points .
event rate and average event amplitude were calculated for the same 8 time bins as the learning curves . a general linear model with the threshold crossing rate ( tcr ) z score as the dependent and the z scores of the event rate ( er ) and event amplitude ( ea ) as the independent variables was fit to each of the 33 learning sessions as follows : tcr = berer+beaea .
the relative contribution of er and ea changes to tcr increases was evaluated by comparing the distributions of the fitted ber and bea values expressed in terms of number of standard deviations across all learning sessions .
event rate and event amplitude change factors correspond to the ratios between the last and first time bins of the two measures , respectively .
temporal ca event probability ( figure  s3a ) was computed by transforming each f / f0 trace into an event trace which was set to 1 between each event onset and end , and to 0 otherwise .
the reward - triggered average of all event traces of a given neuron yielded the event probability .
increasing neurons were defined , in a given learning session , as those having significant linear increases ( p  < 0.05 , linear regression ) of either their eas or ers between the start and end of learning , evaluated with the 8 time - binned values .
leading neurons were identified , in a given learning session , by computing the hypergeometric cumulative distribution function value for each non - cn according top=1i=0x(ki)(mkni)/(mn),where x is the number of instances in which the non - cn produced a ca event in a 1  s interval preceding the onset of the cn s threshold crossing ca event .
k is the product of the number of time samples in the 1  s interval and the number of threshold crossings in a given session ( number of samples drawn ) , m is the product of the number of time samples in a 4  s interval preceding the cn s event onset and the number of threshold crossings ( size of the population ) and n is the number of instances in which non - cn events occurred in the 4  s interval ( number of items with the desired characteristic in the population ) .
non - cns with p  < 0.01 were defined as leading neurons ( i.e. , those that produce ca events that precede the cn s threshold crossing ca event more often than what would be expected by chance ) .
a receiver operating characteristic ( roc ) analysis was carried out on the leading neurons to assess whether their activity can predict threshold crossings of the cn s ca trace .
for each learning session , the cn s ca events were classified into rewarded ( those that crossed threshold , event type x ) and unrewarded ( those that did not cross threshold , event type y ) , and each leading neuron s f / f0 trace in a 1  s interval preceding the onset of these events was taken into account . a discrimination score ( dvx )
was computed for each leading neuron for the i event type x as the dot - product of the neuron s f / f0 trace ( xi ) and the mean trace across all type x events ( excluding the i event , x ) minus the dot - product of xi and the mean trace across all type y events ( y ) .
the discrimination score dvy was analogously obtained for the i event type y and , thus , according todvx = xi(xjiy)dvy = yi(xyji ) .
an roc curve was constructed by plotting , for each criterion value c varied across the range of dvx and dvy values , p(dvx > c ) ( i.e. , the fraction of dvx values exceeding the criterion ) against p(dvy > c ) ( i.e. , the fraction of dvy values exceeding the criterion ) . the area under the roc curve ( auc ) was computed using trapezoidal numerical integration ( trapz ( ) function in matlab ) and corresponds to the fraction of events correctly discriminated by an ideal observer using the obtained discrimination scores . a permutation test , consisting of shuffling the x and y event labels and calculating auc values with 1999 shuffled subsets , yielded a p value for each leading neuron , taken as the fraction of shuffled auc values that were more extreme than the auc corresponding to the non - shuffled data .
leading neurons with p  < 0.05 were deemed to correctly predict , above chance level , weather a cn s ca event would cross threshold . bootstrap hypothesis testing of a test statistic being different from zero was performed by taking at random , with replacement , n values from the total set of n measurements of a variable , 1999 times .
the two - tailed bootstrap p value was then computed from the 1999 sample measurements of a test statistic x as follows : p=2min(1bj=1bi(xj0),1bj=1bi(xj>0)),where b  = 1999 , xj is the j bootstrap sample of x and i ( ) is the indicator function , which is equal to 1 when its argument is true and 0 otherwise .
 summaryneuronal motor commands , whether generating real  or neuroprosthetic movements , are shaped by ongoing sensory feedback from the displacement being produced . 
 here we asked if cortical stimulation could provide artificial feedback during operant conditioning of cortical neurons . 
 simultaneous two - photon imaging and real - time optogenetic stimulation were used to train mice to activate a single neuron in motor cortex ( m1 ) , while continuous feedback of its activity level was provided by proportionally stimulating somatosensory cortex . 
 this artificial signal was necessary to rapidly learn to increase the conditioned activity , detect correct performance , and maintain the learned behavior . 
 population imaging in m1 revealed that learning - related activity changes are observed in the conditioned cell only , which highlights the functional potential of individual neurons in the neocortex . 
 our findings demonstrate the capacity of animals to use an artificially induced cortical channel in a behaviorally relevant way and reveal the remarkable speed and specificity at which this can occur . 
Introduction
Results
Discussion
STARMethods
Author Contributions