DOI: 10.7272/q6vd6wm2
title: iEEG, Direct Electrical Stimulation, and Assessment of Mood in Human Subjects

description: This dataset contains iEEG neural recordings and mood measurements from
 adult human subjects undergoing inpatient monitoring for seizure
 localization. The experimental design, including explanation of metrics of
 interest, is detailed in Rao et al (2018) Current Biology. Each
 subject received an identifier: EC##. Electrode coverage varied across
 subjects and was solely dictated by clinical need. Note, each probe (with
 multiple channels) was named by the anatomical target of the probe. The
 spacing of electrodes and size of targets means that not all electrodes
 within a given probe will contact tissue in the anatomical target. MRI and
 CT reconstructions allowed us to assign the activity recorded on specific
 electrodes to different brain regions of interest.
description: A series of MATLAB scripts
 was used for extracting data, preprocessing, calculating spectral power,
 and statistics. A number of functions are called within scripts (included
 in this repository). EEGLAB functions are used for plotting to aid
 visualization and artifact rejection.   <b>Data
 Description</b> iEEG during Continuous
 Stimulation Each subject’s raw iEEG during continuous stimulation are
 saved in a separate folder. Three recording systems were used to acquire
 iEEG, and the data format differs slightly.   <i>Natus system (‘Clinical’
 data)</i>: Files are named using subject identifier,
 ‘rawDuringContinous’, and the amplitude of stimulation applied. For
 non-OFC stimulation locations, the location of stimulation is also
 included in the file name. If no location is included in the file name,
 lateral OFC was the stimulation location. Each file contains:
 rawData: iEEG data, channels x samples selectAnatmy: Electrode names and locations; order
 corresponds to the order of data in rawData Fs: Sampling rate (Hz) patientID: Subject identifier numChannels: Number f channels included in
 rawData   <i>TDT (Tucker-Davis Technologies)</i>: Files
 are named using subject identifier and a block number (e.g. B30), or can
 be identified by accompanying ‘TDT_elecs_all.mat’ or
 ‘TDT_elecs_special.mat’ files with electrode information. Each file
 contains the same variables as Clinical data.   <i>NeuroOmega
 data</i>: Files are named using subject identifier and ‘NO’ appears
 in file name. Each file contains: rawData: iEEG data, channels x samples selectAnatmy: Electrode names; order corresponds to the
 order of data in rawData Fs: Sampling rate (Hz) 
  
 iEEG during
 Single-Pulse Stimulation Each subject’s raw iEEG during single-pulse stimulation
 are saved as EC##_rawData_SPS.mat. Each of these files contains:
 RawData: iEEG data, channels x samples Fs: Sampling rate (Hz) Anatmy: Electrode names and locations; order corresponds
 to the order of data in rawData 
  
 Group data are saved in
 SPS_Group.mat, which contains: patientID: Subject identifiers fr electrodes in group
 analysis, corresponds to order of data in peakValuesBefore and
 peakValuesAfter peakValuesBefre: Peak values of ERP before continuous
 stimulation, pulses x subjects peakValueAfter: Peak values f ERP after continuous
 stimulation, pulses x subjects 
   iEEG during Natural Behavior
 Each data file
 EC##_data.mat contains: IMS: Structure array with IMS scres for this subject (time
 excluded to preserve PHI) ECG: Structure array with raw ECoG data (from OFC
 channels) from a 4-minute window around each IMS. 
 Note: For each ECoG
 segment, "data" and sampling rate "Fs" are stored;
 data around one IMS may be broken into multiple segments by the recording
 device. Thus, the ECoG structure array may have more elements than the IMS
 structure array.   Behavior Spreadsheets and mat files
 contain subject trait and behavior metrics: KS_OFCStim_BehavirData.mat: IMS, word valence, and CMS for
 stimulation tested in lateral OFC. KS_NnOFCStim_BehaviorData.mat: IMS, word valence, and CMS
 for stimulation testing in non-lateral OFC locations. KS_SpeechRate_6mA.mat: Speech rate fr each subject during
 sham and 6mA OFC stimulation. KS_TraitScres.mat: BDI and trait score for each
 subject. KS_AllNrmIMS.mat: Normalized score for every IMS
 datapoint, with identification of subject trait depression
 status. KS_AllNrmIMS.xlsx: Normalized score for every IMS
 datapoint. KS_NumberIMSPerDat.xlsx: Number f IMS each subject
 completed each day; days are numbered sequentially (Day 1, Day 2, etc.) to
 help protect confidentiality. 
  
 <b>Description of
 Analysis Scripts and Outputs</b> iEEG Analysis during
 Continuous Stimulation:  KS_DuringContinuousStim_ArtifactRejection.m: First
 processing script for iEEG recorded immediately before, during, and after
 continuous 100Hz stimulation; input are raw data in mat format from one of
 the three recording systems used (more information below); anatomical
 labels of electrode locations are also required (saved in an accompanying
 file for two data formats). This script removes stimulation artifact from
 iEEG and performs other preprocessing steps. Recording and subject
 specific parameters are applied to extract data from channels within brain
 regions of interest. The processed data are saved and used by subsequent
 scripts (# replaced by appropriate numbers):
 EC##_preprocessedDuringContinuous_#mA_FreqBands.mat, which contains
 variables: preprcessedStimData: Preprocessed data from channels in
 regions of interest, channels x samples; these data are
 downsampled selectVerifiedAnatmy: Electrode names and locations
 corresponding to channels in preprocessedStimdata patientID: Subject identifier stimFreq: Frequency f electrical stimulation
 remveOrReplace: User selection to remove or replace (with
 Nans) time periods of data which were manually rejected rejectinTimes: Start and end indices of original data (Fs
 sampling rate) that were manually marked for rejection dsFs: Sampling rate f downsampled data (Hz)
 Fs: Original sampling rate (Hz) allRejectedChans: Channel numbers (based n selectAnatomy)
 that were selected for rejection numVerifiedChans: Number f channels in
 preprocessedStimData reginNames: Names of brain regions of interest
 finalVerifiedRegins: For each channel, identifier of which
 region this channel is assigned to (order corresponds to
 regionNames) finalVerifiedChanNames: Channel names and rder
 corresponding to channels in preprocessedStimData artifactBufferBefre: Number of samples (in Fs) before peak
 of stimulation artifact that should be rejected artifactBufferAfter: Number f samples (in Fs) after peak
 of stimulation artifact that should be rejected artifactStarts: Indices fr the start of all artifact
 periods (each corresponding to a single stimulation pulse, in
 Fs) artifactEnds: Indices fr end of all artifact periods (each
 corresponding to a single stimulation pulse, in Fs) pltStimStart: Index for start of stimulation block (in
 Fs) pltStimEnd: Index for end of stimulation block (in
 Fs) KS_DuringContinuousStim_TimeAveragedSpectra.m: Input are
 preprocessed data during continuous stimulation. Mean spectral power is
 calculated before, during, and after stimulation for each channel.
 Processed data are saved for use in subsequent scripts (# replaced by
 appropriate numbers): EC##_TimeAveragedSpectraPower_#mA.mat, which
 contains variables: 
 meanBefreStim: Average power before stimulation, channels
 x frequencies meanDuringStim: Average pwer during stimulation, channels
 x frequencies meanAfterStim: Average pwer after stimulation, channels x
 frequencies freqs: Center frequencies at which spectral pwer was
 calculated finalVerifiedRegins: For each channel, identifier of which
 region this channel is assigned to (order corresponds to
 regionNames) finalVerifiedChanNames: Channel names and rder
 corresponding to channels in preprocessedStimData numVerifiedChans: Number f channels in
 preprocessedStimData currentStim: Name f stimulation condition in this
 file reginNames: Names of brain regions of interest
 stimStartSample: Index fr start of stimulation block (in
 dsFs) stimEndSample: Index fr end of stimulation block (in
 dsFs) dsFs: Sampling rate f downsampled data (Hz)
 Fs: Original sampling rate (Hz) 
 KS_DuringContinuousStim_GroupLevel_Power.m: Creates
 grouplevel plot and calculates statistics of changes in power across
 subjects. Input are EC##_TimeAveragedSpectraPower_#mA.mat files for all
 subjects. KS_DuringContinuousStim_GroupLevel_PlotChangePower.m:
 Creates grouplevel plot and calculates statistics of changes in power
 across subjects. Input are EC##_TimeAveragedSpectraPower_#mA.mat files for
 all subjects.   iEEG Analysis during Single-Pulse Stimulation (SPS)
 MB_CalculateERP.m: Processing script to calculate evoked
 potentials caused by single pulses of electrical stimulation. Input is raw
 data in mat format recorded during stimulation. MB_PlotFigure4E.m: Plotting and statistics for Figure
 4E MB_PlotFigure4F.m: Plotting and statistics for Figure
 4F MB_PlotFigureS4.m: Plotting and statistics for Figure
 S4   iEEG Correlated with Mood Reports:
 Analysis for correlation of OFC power with IMS consists of 4
 main steps, each corresponding to one function: 
 F1_extractPowerFeatures.m: For each subject, extract log
 power features in 3 frequency bands from nonoverlapping 10s
 windows. F2_averagePowerFeatures.m: For each subject, average the
 extracted power features in a 4minute window around each IMS datapoint and
 across all OFC channels. F3_zScoreFeaturesAndIMS.m: For each subject, zscore the
 averaged power features and z-score the IMS scores. F4_poolResultsAndComputeCorr.m: Pool the zscored averaged
 power features and the z-scored IMS datapoints from all subjects together
 and correlate the two.   Behavior: KS_OFCStim_BehaviorData.m: Plotting and statistics of
 composite mood scores based on stimulation condition and subject trait
 (depressed/not depressed). Input is KS_OFCStim_BehaviorData.mat
 KS_NonOFCstim_BehaviorData.m: Plotting of composite mood
 score for stimulation in multiple brain regions. Input is
 KS_NonOFCStim_BehaviorData.mat KS_SpeechRateAnalysis.m: Statistics and plotting to
 compare speech rate during sham and 6mA OFC stimulation. Input is
 KS_SpeechRate_6mA.mat KS_PlotBDI.m: Script to create figure showing BDI scores
 for all subjects. Input is KS_TraitScores.mat KS_PlotIMS.m: Script to create boxplots of all IMS scores
 for all subjects. Input is KS_AllNormIMS.mat KS_OFCStim_DiffCMS.m: Plotting of composite mood scores
 per subject. Input is KS_OFCStim_BehaviorData.mat