Long-term multichannel recordings in Drosophila flies reveal altered predictive processing during sleep compared with wake
Data files
Jul 16, 2025 version files 55.02 GB
-
ForPaper.zip
55.02 GB
-
README.md
23.61 KB
Abstract
During sleep, behavioral responsiveness to external stimuli is decreased. This classical definition of sleep has been applied effectively across the animal kingdom to identify this common behavioral state in a growing list of creatures, from mammals to invertebrates. Yet it remains unclear whether decreased behavioral responsiveness during sleep is necessarily associated with decreased responsiveness in brain activity, especially in insects. Here, we perform long-term multichannel electrophysiology in tethered Drosophila melanogaster flies exposed continuously to repetitive visual stimuli. Flies were still able to sleep under these visual stimulation conditions, as determined by traditional immobility duration criteria for the field. Interestingly, we did not find any difference between responses to repetitive visual stimuli during sleep compared to wake when we recorded local field potentials (LFP) across a transect of the fly brain from optic lobes to the central brain. However, we did find LFP responses to be altered when visual stimuli were variable and of lower probability, especially in the central brain. Central brain responses to less predictable or ‘deviant’ stimuli were lower during the deepest stage of sleep, a time of quiescence characterized by more regular proboscis extensions. This shows that the sleeping fly brain processes low-probability visual stimuli in a different way than more repeated stimuli, and presents Drosophila as a promising model for studying the potential role of sleep in regulating predictive processing.
Dataset DOI: 10.5061/dryad.7pvmcvf5h
Description of the data and file structure
Data processing and analysis scripts
- LFP analysis script can be found on the associated Github (https://github.com/MNVDP/MultichannelLFPAnalysis/tree/main), under the "LFP Processing" subdirectory
Data types
- LFP data is stored in datestamped (e.g., "060721") folders as .mat files, to be loaded by the LFP analysis script
- Processed behavioural data (for overnight experiments) is also stored as .mat files, again to be loaded by the LFP analysis script
Folder structure
- [root folder (e.g. "\LFP\")]
- \Scripts\
- [[LFP analysis script (e.g. "OddballProcessing 14point25 releaseBranch") from the Github]]
- \toolboxes\
- [various functions supplied with the analysis script, from the Github]
- \Lists\
- "33 33 33 greenblue bluegreen clean.csv"
- [etc]
- \SleepData\
- IntegOut
- "fly1Overnight 06 07 21_behavProcessed.mat"
- [etc]
- IntegOut
- \PROCESSED\
- \060721\
- [associated substructure of data]
- [etc]
- \060721\
- \Scripts\
Setup
- Unzip the provided Zip folder in a suitable location with sufficient (>50GB) space
- Place the script/s from the Github into a folder within this unzipped collection (e.g., "Scripts")
- Follow the instructions within the LFP analysis script to run analysis
Problems
- Contact Matthew Van De Poll - m.vandepoll@uq.edu.au if issues encountered with these steps.
Files and variables
File: ForPaper.zip
Description:
This zip file contains the necessary processed data to recapitulate all primary analyses performed in the associated paper, as well as anything else one might want to analyse.
The folder architecture contained herein is not immutable, but it does simplify aspects of the analysis. For example, the LFP analysis script, as currently written, will look for data in ".\PROCESSED", meaning "one folder above script location -> folder named 'PROCESSED' -> data folders" and so on.
Code/software
As mentioned, the code necessary to perform analysis on the processed data is provided at the GitHub linked (https://github.com/MNVDP/MultichannelLFPAnalysis/tree/main).
This GitHub also provides preprocessing scripts designed to work with the raw data, for both LFP and behaviour; Such data is not included here for brevity but can be supplied on request by emailing m.vandepoll@uq.edu.au and we will be happy to assist.
All of the primary analysis script is written for MATLAB, ideally 2020b or 2021a. Newer versions may work, but have not been extensively tested. Older versions are unlikely to work.
As mentioned in the script, a large amount of RAM (>100GB) may be needed to analyse overnight data if certain flags ("memoryEfficient") are not enabled. Also, analysis of said overnight data typically takes ~14h even on suitable hardware, due to the size of the data and associated matrices.
Files and Variables, detailed
- Two types of recordings are included in the PROCESSED folder: Short, daytime recordings, and longer 'overnight' recordings.
Daytime recordings can be variable in length and are generally comprised of different 'blocks', where each block is a particular condition.
Overnight recordings can typically be distinguished by the presence of a "stitchList.csv" file and are usually one condition, across ~16h.- A dataset is defined by the recordings specified to be analysed in the \Lists\ folder, which contains CSVs listing recordings (e.g., overnight 33 33 33 greenblue bluegreen clean.csv)
- These are referenced in the analysis, alongside various flags and parameters to adjust how the analysis is performed
- A dataset is defined by the recordings specified to be analysed in the \Lists\ folder, which contains CSVs listing recordings (e.g., overnight 33 33 33 greenblue bluegreen clean.csv)
- For daytime analysis, individual blocks from the recordings will comprise a dataset, whilst for overnight analysis, individual blocks are stitched into a 'stitched' megablock that encompasses the entire recording span for that fly, which are then grouped as a dataset
- Most of the important data is stored in subfolders denoted "LFP" (e.g., "\080721\LFP"), but daytime recordings may also contain legacy data storage in a "SplicedDataDriftCorrect" and "Stimuli" folders, which are not used under normal conditions
- Daytime recordings are contained in folders \230720\, \040820\, \050820\, and \060820\
- Stimulus information for these datasets is contained in a "\MAT\" folder within the \LFP\ directory (e.g. "\050820\LFP\MAT\")
- LFP data for individual experiments is contained as "blocks" (e.g. "\050820\LFP\Analyzed_Oddball_Block-3\"
- Overnight recordings are contained in \060721\, \070721\, \080721\, \150721\, \210721\, \220721\, \280721\, and \290721\
- Stimulus information is contained in a folder named with the date of the experiment start (e.g. "\080721\LFP\080721"); See below for more details
- LFP data is initially processed in individual blocks, but these are 'stitched' together and analysed later as a singular unit (e.g. "\080721\LFP\Stitched_stitchList_Block-1\"); See below
- Folder, file, and variable architecture is as follows:
- \Lists\ - Folder containing CSVs that denote particular datasets
- overnight 33 33 33 greenblue bluegreen clean.csv (e.g.) - 3 columns, denoting recording date/fly number/block number respectively (e.g. 80721-1-1), one row per recording to be included with this dataset
- \OverVars\ - Intermediary folder, not strictly needed here
- \PROCESSED\ - Folder containing all applicable processed data for analysis, with recordings as separate named folders
- \080721\LFP\ - Folder containing LFP data for an individual overnight recording
- stitchList.csv - Used by preprocessing ("STITCHER") to 'stitch' data files together in order
- 1 column, elements indicate the order in which overnight data blocks are to be stitched together (Not used during normal analysis; Only preprocessing)
- \Stitched_stitchList_Block-1\ - Folder containing preprocessed, 'stitched' data (from individual 1h chunks)
- 080721_chunk_01.mat - Primary data storage file
- stitchEEG - Stores data from stitched hour-long 'chunks' of data that were 'stitched' together to form one continuous block
- setname - Legacy
- filename - Recording name
- PDec - Photodiode data for modern (2021+) recordings
- nbchan - Number of photodiode data channels
- data - Photodiode data
- pnts - Legacy, unused
- chanlocs - Legacy label
- sourceFramerates
- Wave - Original sampling rate for photodiode data, Useful for reference
- epoch_times - Calculated POSIX (epoch) times for photodiode data
- times - Time since experiment start for photodiode data
- InpP - Stimulus information and synchronisation signals
- [same architecture as for photodiode, but for stimulus data]
- Wave - LFP data from 16-channel multielectrode
- [same architecture as for photodiode, but for LFP data]
- OutP - Supplementary stimulus information and synchronisation signals
- [same architecture as above]
- dataFiels - Data fields contained in the file
- stimChannelID/dataChannelID - Define the stimulus and data channels, respectively
- times - Legacy times, unused
- xmax/xmin/icawinv/icaweights/icasphere/icaact/trials - Legacy, unused
- srate - Data sampling rate (post-preprocessing) for all data fields
- timestart/timeend - Legacy, unused
- info - Contains useful ancillary information about the recording
- tankpath - Original location of data during preprocessing
- blockname - Post-preprocessing name of data
- date - Date recording was made
- utcStartTime - Time recording was started, AEST (local time) reference frame
- headerstarttime - Time recording was started, POSIX/epoch reference frame
- utcStopTime/headerstoptime - As above, for recording end
- duration - Total elapsed time in HH:MM:SS
- streamChannel/snipChannel - Legacy, unused
- epoch_start/epoch_end - Start/End times of recording in POSIX/epoch reference frame
- ancillary - Additional extra info
- preprocessident - Identity of the preprocessing script used to make this processed data
- dataIsSynapse - Indicates whether data was made through Synapse software (Not applicable here)
- pnts - Legacy, unused
- Stitch - For overnight data, contains information about separate data blocks merged to create this one
- nPoints - How many data points (Post-preprocessing) comprised each 'chunked' block
- stitchPortionList - Detected ID of individual chunks used in stitching
- setnames - Chunk names used in stitching
- Date - Date of chunk recording
- PDec - Information about photodiode data contained in individual chunks
- startEndTimes - Start/End time (POSIX/epoch reference) of each chunk
- nPoints - Number of data points (Post preprocessing) in each chunk
- InpP/Wave/OutP - As with PDec, for stimulus data/LFP data/Additional stimulus data
- [same architecture as for PDec]
- pad - NaN matrix used to 'pad' data during chunk changeover, when no data being recorded
- stitchEEG - Stores data from stitched hour-long 'chunks' of data that were 'stitched' together to form one continuous block
- Stitched_saveStruct_Oddball_B2.mat - Contains information about the original stimuli sent during recordings
- saveStruct - Stimulus information for each 20s block of stimuli sent to the fly
- CarrierOrder - Legacy, unused
- Channel - Colour ID for each 20s block (Each column represents one block)
- Amplitude - As for Channel, but for the requested LED power
- Stimulus - As for Channel, but for stimulus nature
- TTL - As for Channel, but for gating of colour
- Gating - Also for the gating of colour
- sentStimuli - Master record of sent stimuli, each row represents one 20s stimulus block
- Condition - Stimulus type (e.g., 'oddball')
- oddballType - Oddball stimulus type where applicable (e.g,. Phasic or Jittering)
- TTLvector - TTL signal sent to LEDs during this block
- trialSendDatestr - Date and time that trial information was sent to hardware to be displayed
- trialSendDatenum - As above, but as a MATLAB datenum
- Stims - Unused, legacy
- cycleIdent - Stimulus identity of each event in the 20s block (0 - carrier, 1 - oddball)
- sentTDTCrash - Self-report of whether hardware crashed and had to perform a recovery
- chanGroupList - Contains information about the colour groups displayed for different blocks (Randomised)
- {cell 1} - Block colour grouping 1
- CarrierOnly colour / Carrier colour / Oddball colour
- {cell 2} - Block colour grouping 2
- As above
- {cell 1} - Block colour grouping 1
- ancillary - Contains additional stimulus information
- oddballFractionActive - What fraction of blocks should be oddball
- flagParamSaveStruct - Post-hoc saved record of parameters used to initialise stimulus script
- [flags and parameters]
- stimduration - Duration in seconds for each stimulus block
- StimType - Wave shape for LED power during stimulus event (Square vs Sine)
- CarrierFirst/blockNum/idealisedBlockNum - Unused, legacy
- Stitch - Contains minor data about stitching of saved stimulus data
- sentEndTimes - POSIX/epoch time of last stimulus block (Probably)
- saveStruct - Stimulus information for each 20s block of stimuli sent to the fly
- 080721_chunk_01.mat - Primary data storage file
- \080721\ - Folder containing information about stimuli sent during recordings, referred to as "\MAT" for daytime data
- 20210708T185253_saveStruct_Oddball_B2.mat (e.g.) - As above for Stitched_saveStruct_Oddball_B2.mat, but pertaining only to a single 1h chunk of data
- ..._B3.mat etc - As above
- \Analyzed_Overnight_Block-1\ (e.g.) - Original data storage of a 1h chunk of recording
- [Architecture same as stitched results [e.g. 080721_chunk_01.mat in \Stitched_stitchList_Block-1 folder]]
- \Analyzed_Calib_Block-1\ - Folder for data pertaining to calibration procedure before recording
- 080721_chunk_01.mat - Aforementioned calibration data
- . . .
- data - LFP data during calibration, rows represent channel, columns represent sample
- stims - Combined stimulus and photodiode data during calibration procedure
- times - Time since calibration start for each data sample
- . . .
- detectedPolReversalChan - Programmatically identified polarity reversal channel
- [all other fields as above, for recording data [e.g. 080721_chunk_01.mat]]
- 080721_chunk_01.mat - Aforementioned calibration data
- stitchList.csv - Used by preprocessing ("STITCHER") to 'stitch' data files together in order
- \050820\ - A folder containing an example daytime recording
- \LFP\ - As above for overnight data, except that no 'Stitched' data exists, because daytime recordings are analysed on a per-block level and are not stitched together
- \SplicedDataDriftCorrect\ - Legacy data storage, unused
- \Stimuli\ - Legacy stimulus storage, unused
- \080721\LFP\ - Folder containing LFP data for an individual overnight recording
- \SleepData\IntegOut\ - Folder containing processed behavioural activity data, with each file relating to a specific overnight recording
- These files are generated by the "SASIFRAS" family of scripts- fly1Overnight 08 07 21_behavProcessed.mat (e.g.) - File containing aforementioned behavioural activity data, primarily used for separating LFP data into Sleep vs Wake etc
- overAllPE - Structure containing information about various proboscis activities in the behavioural data
- allPEStruct - Contains proboscis-extension specific data
- allLOCS - Index in behavioural recordings (Video frame time reference) of all proboscis extensions
- allPKS - Amplitude of proboscis extension event (a.u.)
- allW/allP - As above, for Width and Prominence of proboscis extension as represented in data (Not physical coordinates)
- rollingFinderMean - Rolling mean of proboscis data used for PE finding
- flyBodyAngle - Manually calculated angle of fly used for angular correction
- locAngs - Angle of proboscis to body at peak of each proboscis extension event
- inBoutPEsLOCS/inBoutPEsPKS - Only PE indices/amplitudes occurring during a detected sleep bout
- outBoutPEsLOCS/outBoutPEsPKS - As above, for PEs occurring outside of sleep bouts
- inBoutPEAngs/outBoutPEAngs - PE angles at peak extension inside/outside sleep bouts
- allPERail - Simple common point for large amount of PE information, video frame reference (1 row per video frame)
- Column 1 - POSIX/epoch time for each frame
- Col 2 - Single-frame indicator of PE event locations
- Col 3 - Sleep bout number
- Col 4 - Single-frame indicator of PE event location only within sleep bout
- Col 5 - Implied wake bout indicator
- Col 6 - Wake bout PE single frame indicator
- Col 7 - Time in seconds pre/post 5PM local time
- inBoutPEsAvgPerMin - Summary statistic of calculated number of PEs per minute of sleep
- outBoutPEsAvgPerMin - Same, but for wake bouts
- rollPEY/rollPEX - Intermediary analysis variables
- interProbFreqData - Calculated inter-PE interval in Hz
- altStruct - Contains proboscis extension data from an alternate, newer system for detecting them
- probInds - Index in behavioural recording of alternate-detected PEs
- probSizes - Duration in (video) frames of each alternate-detected PE
- probAngs - Angle of proboscis during alternate-detected proboscis extensions, for a fixed frame window
- probAngsMeds - Median of the above, per alt-detected PE
- probUpps - Raw proboscis tracking data during window for each alt-detected PE
- probIndsAll - Index of all frames in window for each alt-detected PE
- inBoutProbUpps/outBoutProbUpps - Raw proboscis tracking data at index for Sleep/Wake alt-detected PEs
- inBoutProbSizes/outBoutProbSizes - As above, separated by Sleep/Wake, respectively
- inBoutProbAngleMeds/outBoutProbAngleMeds - As above, separated by Sleep/Wake, respectively
- autoAltAng/overAltAng - Intermediary analysis variables
- spellStruct - Contains data referring to 'spells' of continuous proboscis activity
- allContigSizes - Sizes (frames) of all detected contiguous PE regions ('spells')(A minimum size threshold will be applied to trim these)
- allLOCCoords - Start/End index of which PEs (original detection [allPEStruct]) comprise each detected contiguous region
- allStartEnd - Similar to above, but the start/end indices of each region
- matchingContigSizes - Sizes of contiguous PE regions that pass the minimum size threshold
- matchingContigLOCS - Indices of each PE comprising the matching spells/contiguous regions
- matchingContigStartEndAbsolute - Start/End indices of each matching spell
- matchingContigPEsPos - Which PEs comprise the matching spells
- matchingContigFreqs - Inter-proboscis frequency of each PE in matching spells
- allPEStruct - Contains proboscis-extension specific data
- overVar - Holds data pertaining to all aspects of behavioural analysis
- flyName - Original name of recording
- inStructCarry - Stores information about sleep/wake bouts
- separationMode - Which processing method was used to find sleep/wake bouts
- holeStarts - Sleep bout starting indices (behavioural reference frame)
- holeEnds - As above, ending indices
- holeSizes - Size of each sleep bout in frames
- holeRanges - Full indices of each sleep bout
- holeStartsTimes/holeEndsTimes - User-friendly time of each sleep bout start/end
- holeSizesSeconds - As above, but converted to seconds
- holeRangesBaseFrameMatched/holeRangesMovFrameMatched - Intermediary analysis variables
- holeStartsZT - Time of each sleep bout start in fractionalised 24h time (e.g., 2:30PM -> 14.5)
- railStruct - Holds variables containing data about frame-by-frame behavioural activity ('rails')
- sleepRail - Master variable describing behavioural activity for entire recording (video reference frame)
- Col 1 - Binary indicator of whether sleep bout (1) or wake (0) occurring at this time
- Col 2 - Posix/Epoch time of video frame
- Col 3 - Binary indicator of PE (original detection method), point indicator (Not full duration)
- Col 4 - Binary indicator of whether periodicity occurring PE activity
- Col 5 - Calculated frequency of said periodicity, where applicable
- Col 6 - Time pre/post 5PM (seconds)
- Col 7 - Inter-frame interval (seconds)
- Note: Where antennal data present, columns 4/5 may be duplicated to account for antennal periodicity/antennal periodicity frequency (e.g. 4/6/8 - PE per./L ant. per./R ant. per., 5/7/9 - Frequencies)
- sleepRailZTCurveCoords - Constituent coordinates of rail separated by specified hours (e.g., 1700, 1800, etc)
- sleepRailZTCurveStartEndTime - Posix/Epoch start/end times for each specified hour the rail is separated by
- sleepRailZTCurveBinned - Binary indicator of sleep in specified hour periods
- sleepRailZTCurveBinnedSumTime - Sum time in seconds spent sleeping in each specified hour
- sleepRailZTPEsBinned/sleepRailZTPEsBinnedSum/sleepRailZTPEsBinnedSumTime - As above, for PEs instead of sleep, also including the number of PEs in each specified hour (sleepRailZTPEsBinnedSum)
- sleepRailZTAntPerioBinned_probData/sleepRailZTAntPerioFreqPos_probData - Equivalent to sleepRail column 4/5, separated by specified hour (Note: 'AntPerio' in this field name is a misnomer, carried over from the original mechanism for detecting periodicity)
- sleepRailZTAntPerioBinnedSum_probData - Sum # of frames with proboscis periodicity in each specified hour
- sleepRailZTAntPerioBinnedTime_probData - As above, but for time (seconds)
- sleepRail - Master variable describing behavioural activity for entire recording (video reference frame)
- dataFrameRate - Post-hoc calculated average framerate of video recording
- probMetric - Stored copy of data used to calculate proboscis metrics, typically a processed form of the average contour size from preprocessed CSVs; A useful variable to display when looking at general proboscis activity
- overGlob - Stores raw data
- acRaw - Raw behavioural activity data (i.e., Locomotion)
- probScatter - Mostly legacy storage of proboscis-related metrics
- probEventsCount - Detected (original method) proboscis events, separated by sleep bout number
- probStartTimes - Decimalised 24h time start time for respective sleep bouts
- probStartZT - Adjusted Zeitgeber time of above (Might be unchanged)
- probEventsDur - Legacy calculation of proboscis extension event duration in this sleep bout (s), may not be accurate
- probEventsDurProp - As above, but divided by the size of the sleep bout
- avProbContourSizeSmoothedEvent - Rolling indicator of whether PE occurring inside sleep bout, video frame reference
- avProbContourSizeSmoothedEventRail - As above, but for the entire time (Not just sleep)
- spellsPooled - Additional spell metrics and info
- matchingContigHoleNum - Sleep bout # of particular spells
- matchingContigSizesPooled - Size (in PEs) of spells
- matchingContigStartEndPooled - Intermediary analysis variable
- matchingContigStartEndAbsolutePooled - Start/end index of spell (Video frame reference)
- matchingContigPEsPos - Indices of component PEs in each spell (PE # reference)
- matchingContigFreqs - Inter-PE frequency of component PEs
- matchingContigLOCS - Indices of component PEs (Video frame reference)
- matchingContigLOCSTime - Posix/Epoch time of component PEs
- findPEs - Stores data relating to PEs detected in sleep bouts, rows relate to sleep bout #
- LOCS - Relative position of PEs within sleep bout (Video frame reference, adjusted to start of sleep bout)
- LOCSAbsolute - Original position of PEs (Video frame reference)
- PKS - Amplitude of PEs (probMetric values)
- W - Width of PEs (Frames)
- P - Prominence of PEs (unknown)
- interProbFreqData - Inter-PE frequency (Hz)
- spells - Same data as spellsPooled, but separated by sleep bout
- matchingContigSizes - Sizes of spells (in PEs) contained in this sleep bout
- matchingContigIndOriginal - Spell # contained in this sleep bout
- matchingContigStartEnd - Start/End indices of spells in this sleep bout, relative to start of sleep bout
- matchingContigStartEndAbsolute - As above, but entire behavioural reference frame
- matchingContigPEsPos - Identities of PEs comprising spells in this sleep bout (Overall PE #)
- matchingContigFreqs - Inter-PE freqs of PEs in each spell in this bout
- overAllPE - Structure containing information about various proboscis activities in the behavioural data
- fly1Overnight 08 07 21_behavProcessed.mat (e.g.) - File containing aforementioned behavioural activity data, primarily used for separating LFP data into Sleep vs Wake etc