DOI: 10.5061/dryad.ngf1vhj4c
title: A recurrent neural circuit in Drosophila temporally sharpens visual inputs

description: A critical goal of vision is to detect changes in light intensity, even
 when these changes are blurred by the spatial resolution of the eye and
 the motion of the animal. Here we describe a recurrent neural circuit in
 Drosophila that compensates for blur and thereby selectively enhances the
 perceived contrast of moving edges. Using in vivo, two-photon voltage
 imaging, we measured the temporal response properties of L1 and L2, two
 cell types that receive direct synaptic input from photoreceptors. These
 neurons have biphasic responses to brief flashes of light, a hallmark of
 cells that encode changes in stimulus intensity. However, the second phase
 was often much larger in area than the first, creating an unusual temporal
 filter. Genetic dissection revealed that recurrent neural circuitry
 strongly shapes the second phase of the response, informing the structure
 of a dynamical model. By applying this model to moving natural images, we
 demonstrate that rather than veridically representing stimulus changes,
 this temporal processing strategy systematically enhances them, amplifying
 and sharpening responses. Comparing the measured responses of L2 to model
 predictions across both artificial and natural stimuli revealed that L2
 tunes its properties as the model predicts in order to temporally sharpen
 visual inputs. Since this strategy is tunable to behavioral context,
 generalizable to any time-varying sensory input, and implementable with a
 common circuit motif, we propose that it could be broadly used to
 selectively enhance sharp and salient changes.
description: This dataset was collected using two-photon microscopes (Leica
 and Bruker) and Lightcrafter projectors controlled with custom MATLAB data
 (see "stimulus" folder on Github). These imaging and stimulus
 data were processed with custom MATLAB data to draw ROIs, extract deltaF/F
 traces, and generate stimulus-aligned averages (see
 "imaging-analysis" folder on Github).
description: # A recurrent neural circuit in Drosophila temporally sharpens visual
 inputs
 [https://doi.org/10.5061/dryad.ngf1vhj4c](https://doi.org/10.5061/dryad.ngf1vhj4c) ## Description of the data and file structure This dataset contains a metadata spreadsheet, MATLAB files containing analyzed data, and zip files containing raw data. ### Metadata spreadsheet The metadata for all experiments are saved in one spreadsheet (L1L2_Metadata.xlsx), with tabs organized by experiment/figure, except for the first tab ("List of flies") which lists the dates/flies corresponding to each experiment, and the second tab ("All Metadata") which contains metadata for all experiments without extra whitespace and can be saved separately as a tab-delimited note file for use in further analysis if needed. The rows and columns (in all sheets except for the list of flies) are organized as follows, with the header names in bold (there are some differences depending on if recordings were acquired with a Leica or Bruker microscope): * Time series information/parameters: * **Time Series ID**: Each row corresponds to a single live imaging recording with a unique identifier, formatted as YYMMDD_fly#*LDM*### or Tseries-YYMMDD-### (for Leica or Bruker data, respectively). - **Frames**: length of time series in number of frames - **Imaging Frame Rate** in Hz * Fly information: * **Fly ID**: number that uniquely identifies individual flies (which are also separated by empty rows for readability) * **Fly Genotype**: the cell type-specific driver(s), transgene(s) (fluorescent indicators, TNT, ort), genetic background (mutation or deficiency), and/or pharmacological manipulation (CDM) * **Age** and **Sex**: age of the fly in days post eclosion; all flies in this dataset are female (F) * Stimulus parameters: * **Stimulus**: the type of visual stimulus presented during the time series. Each experimental stimulus row is preceded by a search stimulus row with a time series recorded from the same field of view (used during analysis for standardizing the selection of cells). Adjacent rows with the same Z-depth value were recorded from the same field of view. * Optical filters added to the projector (same for all recordings in this dataset): **Color filter** (center wavelength and full width half max of bandpass filter, in nm) and **ND filter** (optical density of neutral density filter) * **PWM** (pulse width modulation): projector brightness setting; this value determines the current applied to the blue LED in the LightCrafter projector (LED Current (mA) = 1.8 * (PWM Value) + 140). Rows without PWM values used 200. * Field of view parameters: * **Rotation** setting in degrees; does not apply to Bruker data (no rotation function) * **Z-depth** setting in μm; adjacent rows with the same Z-depth value were imaged in the same field of view * **Layer**: number corresponding to the neuropil layer that was imaged (1 or 2, for M1 or M2 in the medulla, respectively) * Laser parameters: * **Wavelength** of laser (in nm) * Laser power (Leica settings): **Transmission** (in %), **Gain** (in %), **Offset** (in %); values were selected to keep post-objective power in the 5-15 mW range. Different values were entered in those columns or left blank for Bruker data (Pockels cell power instead of transmission, and PMT/detector gain instead of laser gain, in volts or values to be converted to volts) * **Dither Hold** (Chameleon settings): indicates whether dither hold was active (1) or inactive (0); the default state of Chameleon laser operation is without dither hold (0). This corresponds to whether a filter would be applied (if 0) or not applied (if 1) during data analysis to remove artifacts arising from ~25 Hz laser dither (therefore Bruker recordings using a different laser were denoted 1 even though there was no dither hold function) * **isMoving** and **isResponding**: binary values entered by user during data processing for some time series ### Analyzed data (.mat files) The analyzed data are saved in .mat files, each containing all processed data for one genotype after drawing and selecting ROIs, in the following form: * **iResp** contains the indices of ROIs from roiDataMat selected for averaging. * **roiDataMat** is an nx2 struct in which each row corresponds to a single ROI, which are included for averaging if n is in iResp, and excluded if n is not in iResp. roiDataMat(:,1) contains each ROI's response to the search stimulus, and roiDataMat(:,2) contains each ROI's response to the experimental stimulus. Each cell contains the following: * *Stimulus-aligned responses*: time (**t**) in seconds, and mean (**rats**) and SEM (**stdErr or stdErrs**) in % deltaF/F (as decimal numbers). {1,1} is the dark response, and {1,2} is the light response. The distance between time bins in the moving average is **BIN_SHIFT** (in seconds). * *Processed time series data* (before stimulus alignment): timestamp of frames (**imFrameStartTimes**, in seconds), inter-frame interval (**imIFI**, in seconds), final normalized fluorescence over time (**dFF**, in % deltaF/F but as decimal numbers), and fluorescence over time during intermediate processing stages (arbitrary units); first **avSignal** is computed by averaging intensity values across all pixels in a ROI, then **dSignal** is computed by subtracting the average background intensity value at each timepoint, and finally **fSignal** is computed by applying a 25 Hz filter if laser dither was present (see metadata section above). * *Metadata information*, mostly from the spreadsheet as described above: seriesID, flyID, genotype, stimcode (name of stimulus presented), nFrames (number of frames in time series), zdepth (μm), wavelength (nm), ditherHold (binary). **roiMask** is the index of a ROI within each field of view. * *Processed stimulus data* (**pStimDat**): reconstructed stimulus value for each epoch (**rcStim**, relative luminance values where 0 is the darkest possible projector output and 1 is the brightest possible projector output), reconstructed stimulus index for each epoch (**rcStimInd**; 1 = dark flashes, 2 = light flashes, 3 = gray interleaves), timestamp for each stimulus transition (**stimEpochStartTimes**, in seconds), timestamps sorted by stimulus transition type (**lightStartTimes** and **darkStartTimes**, in seconds), voltage threshold used to separate light from dark in photodiode data (**pdThresh**, in volts), stimulus value at each imaging frame (**stimvalIF**, relative luminance from 0 to 1), start time of stimulus epoch corresponding to each imaging frame (**stimEpochTimesIF**) * *Raw stimulus data* (**stimDat**): variables present depends on stimulus type. Duration, FlashDuration, GrayDuration, and stimIFI are in seconds; BackgroundColor, CenterColor, FlashContrast, GrayContrast, and rawStim are relative luminance values from 0 to 1. * **roiMetaMat** is an nx2 struct with cells corresponding to those in roiDataMat, containing metadata about each cell: **seriesID**, stimulus type (**stimclass**), and index of each ROI out of all n ROIs (**roiMaskInd**). * **interpFrameRate** (Hz) and **binWidthMult** indicate the settings used to compute the stimulus-aligned average (size of the time bins, and number of time bins used in rolling average, respectively) * Variables used in preliminary plots: **yScale** is in % delta F/F; **inv** is a binary indicator for whether to invert the y-axis **Exceptions to the above structure:** * *L2_ASAP2f_jRGECO1b_2s-natstim* - same as above, except: * **rats** and **stdErrs** only contain one cell, since only one type of stimulus epoch was presented, not two * **roiDataMat** and **roiMetaMat** are nx3, since data for the experimental stimulus were collected across two time series in this experiment * **roiDataMatMeans** is nx2 and contains the same set of data after averaging across the two time series * **interpFrameRate** is set to -1 to indicate different method of computing the stimulus-aligned average (no rolling average or resampling to different frame rate) * *L1split_ASAP2f_control and TNT*: * The variable types are the same as above, but organized differently (by individual flies in **allRespFlies**). The added variable **respROIMat** is the subset of roiDataMat selected for averaging (indexed using iResp). * **allRespROIs** has the same structure/content as roiDataMat, but only includes selected ROIs. * **allMetadata** is a simpler version of roiMetaMat (used for generating unique filenames), with metadata information organized as in allRespROIs. ### Raw data (zip files) The raw data are named and organized by imaging session date (main folder named YYMMDD), fly number (subfolders named YYMMDD_fly#), and time series number (subfolders named "LDM" or "LDM_###", each corresponding to one row in the metadata spreadsheet). Each zip file, with a few exceptions, contains a single .lif file with all time series from that imaging session (named LDM_### within the .lif file), and subfolders containing visual stimulus data corresponding to each time series (files named "stim.mat"). Data from some dates are stored in two separate zip files due to limitations in .lif file size or collection by a different experimenter. Imaging data stored in .lif files were collected by two-photon microscopy using a Leica SP5 and can be accessed with Leica software or the Bioformats MATLAB package. Imaging data saved as .tiff files in Tseries folders, and accompanying photodiode data saved as .csv files, were collected using a Bruker Ultima (data from dates starting "22"); corresponding with stimulus files are stored inside a folder named "stim". Visual stimulus data were generated and collected using a Lightcrafter 4500, a Thorlabs photodiode, a NiDAQ, and custom MATLAB software (see "stimulus" folder on Github). Each stim.mat file contains an object that requires stimulus code to access, with variables related to: * *Stimulus presentation*: Duration, FlashDuration, GrayDuration, IFI, and stimIFI are in seconds; BackgroundColor, CenterColor, FlashContrast, GrayContrast, and rawStim are relative luminance values from 0 to 1 * *Stimulus setup*: screenDim and pdDim are in pixels, DegFromEdge is in degrees, and variables in physDist are in cm - *Photodiode data*: photodiode signal over time (in volts) is saved in **Out.pdData** and **Out.pdTime** (data acquired using the Bruker have photodiode data saved in separate .csv files instead) - *Synchronization with microscope*: NIDAQScanRate is in Hz, **Out.imFrameTime** contains the imaging frame number corresponding to each photodiode timepoint (based on triggers sent by Leica software at the start of each imaging frame; not applicable to data collected by Bruker, as both imaging and photodiode data were directly collected with the Bruker software) - *Randomization of stimulus epoch order*: RepeatRNGSeed, Out.rndSeed The following is a list of flies corresponding to each genotype shown in figure panels (raw data from all flies from the same date are saved in the same one or two .zip files). *Figs 1, 3, 5 (L1/L2 ±CDM):* * L2&gt;&gt;ASAP2f (21Dhh-ASAP2f) * 170519_fly1 * 170524_fly1 * 170524_fly2 * 170606_fly4 * 170607_fly4 * 170607_fly5 * 170609_fly4 * 170611_fly3 * 170611_fly4 * 170611_fly5 * 170611_fly7 * 170625_fly1 * 170625_fly2 * L2&gt;&gt;ASAP2f +CDM (21Dhh-ASAP2f-CDM20uM) * 170613_fly1 * 170613_fly2 * 170613_fly3 * 170613_fly4 * 170613_fly5 * 170627_fly2 * 170627_fly3 * L1&gt;&gt;ASAP2f (GMR37E04-ASAP2f) * 170531_fly1 * 170623_fly2 * 170625_fly3 * 170627_fly1 * 170628_fly3 * 170628_fly4 * 170717_fly1 * 170717_fly2 * 170721_fly1 * 170721_fly2 * 170724_fly1 * 170728_fly1 * L1&gt;&gt;ASAP2f +CDM (GMR37E04-ASAP2f-20uMCDM) * 170623_fly3 * 170623_fly4 * 170625_fly7 * 170625_fly8 * 170626_fly6 * 170628_fly1 * 170628_fly2 * 170730_fly1 * 170730_fly2 * 170730_fly3 * 170802_fly1 * 170802_fly2 * 170802_fly3 *Fig 2B-C (L2 ort silencing):* * L2&gt;&gt;ASAP2f, ort&gt;&gt;TNT (21Dhh-ASAP2f_ortC1-3lexA-lexAopTNT) * 161204_fly4 * 161204_fly5 * 161204_fly8 * 161205_fly2 * 170630_fly1 * 170713_fly2 * 170713_fly3 * 170806_fly1 * 170823_fly3 * 170827_fly6 * 170830_fly3 * L2&gt;&gt;ASAP2f + ort-lexA control (21Dhh-ASAP2f_ortC1-3lexA) * 161204_fly1 * 161204_fly3 * 161204_fly6 * 161204_fly9 * 170628_fly10 * 170823_fly1 * 170827_fly4 * 170827_fly7 * 170830_fly1 * L2&gt;&gt;ASAP2f, lexAop-TNT control (21Dhh-ASAP2f-lexAop-TNT) * 161204_fly1 * 161204_fly2 * 161204_fly7 * 161205_fly1 * 170720_fly3 * 170823_fly2 * 170827_fly5 * 170827_fly8 * 170830_fly2 *Fig 2E-F, S1H (L2 ort rescue):* * L2&gt;&gt;ASAP2f, UAS-ort, ort[1]/Df3RBSC809 (21Dhh-ASAP2f_UAS-ort_ort1new_Df(3R)BSC810) * 170328_fly1 * 170407_fly1 * 170409_fly2 * 170410_fly1 * 170411_fly1 * 170411_fly2 * L2&gt;&gt;ASAP2f, UAS-ort, +/Df3RBSC809 control (21Dhh-ASAP2f_UAS-ort_Df(3R)BSC809) * 170327_fly1 * 170329_fly1 * 170331_fly1 * 170331_fly5 * 170416_fly1 * 170416_fly2 * L2&gt;&gt;ASAP2f, UAS-ort, +/ort[1] control (21Dhh-ASAP2f_UAS-ort_ort1new) * 170320_fly2 * 170322_fly1 * 170327_fly1 * 170327_fly2 * 170405_fly2 * L2&gt;&gt;ASAP2f, ort[1]/Df3RBSC809 control (21Dhh-ASAP2f_ort1new_Df(3R)BSC809) * 170331_fly2 * 170331_fly4 * 170402_fly4 * 170402_fly5 * 170409_fly1 * 170409_fly4 *Fig 6 (naturalistic stimulus):* * 220520_fly1 (Tseries-220520-001 through 009) * 220520_fly2 (Tseries-220520-010 through 017) * 220521_fly1 (Tseries-220521-001 through 008) * 220521_fly2 (Tseries-220521-009 through 016) * 220825_fly1 (Tseries-220825-001 through 006) * 220825_fly2 (Tseries-220825-011 through 017) * 220825_fly3 (Tseries-220825-022 through 027) *Fig S1A-F (L1/L2 TNT):* * L1&gt;&gt;ASAP2f, TNT (L1-ASAP2f-TNT) * 240711_fly2 * 240719_fly2 * 240719_fly3 * 240722_fly1 * 240722_fly2 * 240722_fly3 * 240801_fly2 * 240801_fly4 * L1-split&gt;&gt;ASAP2f control (L1-ASAP2f-control) * 240711_fly3 * 240719_fly1 * 240725_fly1 * 240725_fly3 * 240729_fly1 * 240801_fly1 * 240801_fly3 * L2&gt;&gt;ASAP2f, TNT (GMR16H03-lexA_lexAop-ASAP2f_lexAop-TNT) * 170607_fly1 * 170607_fly3 * 170609_fly2 * 170611_fly2 * 170625_fly6 * 170626_fly2 * L2&gt;&gt;ASAP2f, lexA control (GMR16H03-lexA_lexAop-ASAP2f) * 170602_fly1 * 170602_fly2 * 170607_fly2 * 170609_fly1 * 170609_fly3 * 170611_fly1 * 170625_fly5 * 170626_fly1 ## Code/software * Code and software used for stimulus display and analysis: * [https://github.com/ClandininLab/L1L2-recurrent-feedback/tree/main/stimulus](https://github.com/ClandininLab/L1L2-recurrent-feedback/tree/main/stimulus) * [https://www.ti.com/tool/DLPLCR4500EVM](https://www.ti.com/tool/DLPLCR4500EVM) * Code used for imaging analysis: * [https://github.com/ClandininLab/L1L2-recurrent-feedback/tree/main/imaging-analysis](https://github.com/ClandininLab/L1L2-recurrent-feedback/tree/main/imaging-analysis) * [https://www.openmicroscopy.org/bio-formats/](https://www.openmicroscopy.org/bio-formats/)