= Functions for Basic e-phys = ''Author: Konstantinos Nasiotis'' <> {{attachment:functionsIntro.png||width="700"}} After performing the spike sorting and the conversion to the LFPs users have access to these invaluable types of information. LFPs can be analyzed using the extensive library of methods that have been used in EEG and MEG research already present in Brainstorm. These signal processing libraries include preprocessing, artifact removal, time-frequency, connectivity, statistics and several other tools that are essential for analyzing electrophysiological data. Spiking activity can be analyzed in a set of functions that is present in the Electrophysiology library (Run->Electrophysiology), and help researchers understand their selectivity and interaction with the LFPs. For the purpose of the tutorial, the timings around the presentation of the Superflow are selected as the segment of interest of the recordings. To import those segments, users should right click on the Link to raw file (On the LFP file)-> Import Recordings. Then users should select the events of interest, and if needed, resample the dataset (For this tutorial we selected downsampling to 500 Hz since the LFP was bandpass filtered to 0.5-150 Hz). If all superflow stimulation events are selected, this will create 863 new entries in the database, organized according to the event label, since each event type (Stim On: …) was presented 96 times. {{attachment:importDatabase.png||width="700"}} <
> All event types should be imported, as in the screenshot below: {{attachment:importedTrials_new.png}} Now that the trials are appropriately imported along with the spiking events in the database, users can use the functions that utilize them '''''Note''''': ''As stated earlier on this tutorial, in order for the spiking functions to work, the spiking events should be named with the convention: “Spikes Channel ChannelLabel”. If the spike sorting is performed within Brainstorm, this should be done automatically. Users that import their own spiking events should organize their events in a [[http://neuroimage.usc.edu/brainstorm/e-phys/ConvertToBrainstormEvents|compatible to Brainstorm format]].'' == Tuning Curves == The tuning curve is the most basic method of getting insights about neuronal selectivity in electrophysiology. Different conditions of a stimulus presentation are expected to elicit different number of spikes. Those conditions that each neuron is more “tuned” to, are expected to be recognized from a plot that shows that neuron’s number of spikes for each condition. The tuning curves can be derived straight __from the link to the raw file__, since the events are already linked to that file after the spike-sorting step. For computing the tuning curves, either the initial link to raw file or the link to the LFP file can be used. Users just need to drag and drop the Link to raw file to the process box, then click Run-> Electrophysiology->Tuning Curves. A new window will appear that allows users to select the neurons and the conditions that should be displayed. {{attachment:tuningCurves_new.png}} For using the tuning curve function, users have to make these selections: 1. Conditions: Since every experimenter uses their own event labels, the ordering of the stimulation events cannot be automated. Therefore, __users have to select the order__ that they want to have their events on the x-axis (box 1). The events have to be selected and then the arrow that moves them in the right box according to the preferred ordering. Only the events in this box will be included in the Tuning Curves plot. 1. Neurons: The second step in this function, is for users to select the Neurons that the tuning curves will be computed for. A separate window will appear for each window. 1. Time Window: The time-period around the events selected on step (i), that the spikes of each neuron selected will be counted. 1. Normalize tuning curve: If this checkbox is not selected, the tuning curves will just display the sum of the spike counts inside the selected time-window for each neuron. When selected, the tuning curves will be normalized based on the number of trials that each condition had. For the purpose of this tutorial, users should select the Stim ON X events in a meaningful order, and select the neuron from the first two electrodes in order to display their tuning curves. Select a time window between 50 and 300 ms and check the box for normalization. This will create two figures with the selectivity of these two neurons on the selected conditions. {{attachment:tuningCurvedOutput.png||width="700"}} <
> == Noise Correlation == Correlation is a measure of the degree to which trial-to-trial fluctuations in response strength are shared by a pair of neurons. This is typically quantified as the Pearson correlation of the spike count responses to repeated presentations of identical stimuli under the same behavioral conditions (Cohen & Kohn 2011). Users can perform noise correlation analysis in brainstorm, after they import their trials in the database. Once they are imported, the trial icons need to be drag and dropped in the process box->Run->Electrophysiology. The only selection that users need to adjust, is the Time-Window in the trial already imported that the spikes for each neuron will be computed. The Pearson-correlation of all spike-trains from all neurons (some electrodes might pick up more than one neuron) will be computed after the baseline is removed and finally an nxn matrix (where n is each neuron) will hold the noise correlation information. {{attachment:noiseCorrelation_new.png||width="700"}} <
> * ''Cohen, M.R. & Kohn, A. Measuring and interpreting neuronal correlations. Nat. Neurosci. 14, 811–819 (2011).'' <
> == Spike Field Coherence (Under Development) == The spike-field coherence will effectively show the relationship between the spiking activity of a neuron, with the ongoing LFP oscillations as a matter of frequency. So, if a neuron is phase-locked to a specific frequency of the LFP oscillations, the SFC will show an increase only for that frequency. The user just selects the trials that they want to compute the spike-field coherence and the time-window around each spike that will create the segment of the LFP. The computation of the SFC is based on the method from Fries et al. (2001). For more information users can check the supplementary figure 3 on the link listed at the end of this section. The following window will appear, allowing users to select: 1. ''Parallel Processing'': Activate the parallel toolbox and run processes in parallel. Greatly improves the speed of the process (requires Matlab’s parallel toolbox). 1. ''Time Window'':The time-period around the spike-events. The LFP segments from all electrodes will be selected inside this window and the SFC will be computed in these segments Once the computation is complete, double clicking on the created SFC icon will open the computed SFC for each neuron. Each neuron can be selected from the drop-down box. The figure that appears, effectively shows the influence that the selected neuron has on all the electrodes on the recording, in all frequencies (up to the Nyquist limit). For the tutorial purposes, users should drag and drop the trials that correspond to condition Stim On: 1 to the process box and sequentially Run-> Electrophysiology -> Spike Field Coherence. This will create the SFC file after the completion of the computations. {{attachment:SFCEntry_new.png}} <
> On the image below, the SFC from neuron 1 on channel with label “AD03” is shown for all 32 channels, for all frequencies up to 250 Hz (the trials were downsampled at 500 Hz, so we can get frequencies about to the Nyquist frequency). A clear cutoff frequency is shown above 150 Hz, since the LFP signals during the conversion were bandpass filtered at [0.5 - 150] Hz. This neuron shows increased SFC on the Beta band and some high-gamma on the electrode that is picked up, and also some on the neighouring electrodes. The increased low frequency SFC is ambigous due to the window selected around the spikes [-150,150] ms, and could be affected by edge-effects. {{attachment:SFCOutput_new.png||width="700"}} * Fries, P., Reynolds, J., Rorie, A. & Desimone, R. Modulation of oscillatory neuronal synchronization by selective visual attention. Science 291, 1560–1563 (2001). * http://science.sciencemag.org/content/291/5508/1560/tab-figures-data == Raster Plots == The Raster plot is another basic method for visualizing the selectivity of individual neurons. The trials around an event of interest, are binned in a user-defined time-period and the spike-counts are computed and normalized for the bin-duration for each neuron. This process will provide information on the selectivity but also the latency of the neurons on the event/trial selected. We have implemented two ways for visualizing the firing rate on the recorded trials. === Raster plot per Neuron === The first one shows the firing rate per neuron: This function computes the spike counts in user-defined periods for each neuron, and sequentially, all the binned trials are stacked together. Users must first drag and drop the imported trials in the process box and then ->. On the example below bins of 50ms were selected. {{attachment:RPNeuronWindow_new.png}} This creates an nxb matrix of the firing rates (where n is the number of trials and b the number of bins). Users can select each individual neuron from the drop-down box. This will create the Raster plot file after the completion of the computations. Users can select each neuron from the drop-sown box and display its raster plot. Each raster plot is a 96x30 (trials x bins) matrix. {{attachment:RPNeuronOutput_new.png||width="700"}} === Raster plot per Electrode === We also included a second method that allows visualization of the binned spiking activity on the topography of the electrodes. As with the previous raster plot method (Raster plot per neuron), users have to define a bin-size where the spiking activity of each neuron will be computed. Since a single electrode might record spiking activity from multiple neurons, this visualization will present only the firing activity for the first neuron. Therefore, each trial will create a separate file that contains the binned firing rates of the first (or only) neuron that was picked up from that electrode. Users need to import the trials and sequentially Run->Electrophysiology->Raster Plot per Electrode. For the tutorial purposes, users should drag and drop the trials that correspond to condition Stim On: pi to the process box and sequentially Run-> Electrophysiology -> Raster plot per Electrode. This will create 96Raster plot files after the completion of the computations. Double clicking on each one will present the spike train for all the electrodes (or only some of the electrodes if a Montage is selected). {{attachment:RPElectrodeWindow.png||width="700"}} Users have the option of visualizing the firing rate on the actual recording sites of the animal. For being able to perform this, users have to manually insert the physical location coordinates of the implant (chronically implanted arrays) or the penetration chamber (probe-electrodes). Instructions can be found [[https://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Editing_the_contacts_positions|here]]''[[file:///C:/Users/McGill/Dropbox/Basic%20Electrophysiology%20analysis%20in%20Brainstorm.docx#_msocom_1|[MOU1]]] ''. Once users have updated the channel file with the electrode coordinates, the visualization can be performed by right-clicking on the raster plot file-> SEEG -> 3D Electrodes (Cortex). Users can navigate through the raster-plot and check the firing-rate on each bin while visualizing on the implanted devices. {{attachment:RPElectrodeOutput.png||width="700"}} <
> == Spike triggered Average == The spike triggered average is a method for measuring the relation between the neuronal spiking and the local field potentials. If a neuron influences a distant electrode, the waveform of the STA should reveal these correlations. Effectively, this can be visualized with the averaging of the LFPs of all electrodes around the timing of a single neuron’s spiking and normalized by the spike-count.For a meaningful representation of this relation, the electrode coordinates should be updated on the Channel File, for displaying on the correct implant geometry. For instruction on how users can import their array’s/probe’s layout, can be found [[https://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Editing_the_contacts_positions|here]].Once the electrode-coordinates are updated, users can drag and drop the trials they want to compute the STA on, and press Run->Electrophysiology->Spike Triggered Average. 1. Parallel Processing: Activate the parallel toolbox and run processes in parallel. Greatly improves the speed of the process (requires Matlab’s parallel toolbox). 1. Time Window:The time-period around the spike-events. The LFP segments from all electrodes will be selected inside this window and the STA will be computed in these segments. {{attachment:STAWindow.png}} Once the STA is computed, this will create as many new files, as individual neurons picked up from all electrodes (electrodes that picked up more than one neuron will create one file per neuron). The example below shows [[file:///C:/Users/McGill/Dropbox/Basic%20Electrophysiology%20analysis%20in%20Brainstorm.docx#_msocom_1|[MOU1]]] new files created after the computation of the STA. ---- . {{attachment:STADatabase.png}} To display the STA on the implant geometry, users have to select one of the STA files, right click -> SEEG -> 2D Layout. The following figure displays the STA for the neuron that was located on electrode AD01. It is clear that the LFPs on the same side of the electrode are affected by this neuron’s firing. {{attachment:STAOutput.png||width="700"}} For easy navigation to the next neuron’s STA, users can press F3. <> <>