DOI: 10.5061/dryad.9w0vt4bnp
title: (variable) Frequency-based Layer Identification Procedure (FLIP and vFLIP) for spectrolaminar analysis

description: The mammalian cerebral cortex is anatomically organized into a six-layer
 motif. In this dataset and associated paper (Mendoza-Halliday et al.,
 2023) we show that a corresponding laminar motif of neuronal activity
 patterns exists across the cortex in the power of local field potentials
 (LFP). Using laminar probes, we recorded LFPs in five macaque monkeys in
 14 cortical areas across the cortical hierarchy. The laminar locations of
 recordings were histologically identified via electrolytic lesions. Across
 all areas, we found a ubiquitous spectrolaminar pattern characterized by
 an increasing deep-to-superficial layer gradient of high-frequency power
 peaking in layers 2/3 and an increasing superficial-to-deep gradient of
 alpha-beta power peaking in layers 5/6. Our results suggest the existence
 of a canonical layer- and frequency-based mechanism for cortical
 computation. To facilitate the detection of these spectrolaminar patterns,
 we are releasing data associated with "Study 1" and "Study
 2" as reported in Mendoza-Halliday et al., 2023. This comprises
 relative power of LFPs recorded in 4 macaque monkeys from areas V4, 7A,
 MT, MST, LIP, and LPFC. The FLIP and vFLIP algorithms were created to
 facilitate electrophysiological characterization of cortical layers based
 on power analysis of the local field potential recordings (LFP) that are
 provided in these datasets. The algorithms can also be used to perform the
 same analysis on any other multi-channel LFP dataset. We have verified
 that the spectrolaminar pattern is highly preserved in macaque monkeys,
 marmosets, and humans, but is more dissimilar in mouse.  In a
 follow-up study, we developed vFLIP2, an updated and optimized version of
 the vFLIP algorithm for automatic identification of spectrolaminar motif
 from LFP data. vFLIP2 improves on previous versions by using a laminar
 data-driven method to define frequency bands, reducing computational
 complexity and increasing robustness. vFLIP2 also introduces omega, a new
 metric that quantifies the quality of the spectrolaminar motif, allowing
 for improved detectability and reliability.
description: Mulit-channel electrode arrays were implanted into different
 areas of the primate visual cortex. Local field potentials were acquired,
 and processed for their spectral power in frequencies ranging from 1–150Hz
 spanning gamma (50–150 Hz) and alpha/beta (10–30 Hz) ranges. A relative
 power metric was computed and analyzed for the spectrolaminar pattern
 across layers. This pattern defines the anatomical position of layers 2/3
 (peak of gamma relative power), layers 5/6 (peak of alpha/beta relative
 power), and layer 4 (cross-over between gamma and alpha/beta).
description: # (variable) Frequency-based Layer Identification Procedure (FLIP and
 vFLIP) for Spectrolaminar analysis
 [https://doi.org/10.5061/dryad.9w0vt4bnp](https://doi.org/10.5061/dryad.9w0vt4bnp) ## **FLIP Algorithm File Descriptions** ### Getting Started There are three files available for download: FLIPAnalysis.m, main_FLIP_script, and data.mat The only file necessary to perform the FLIP algorithm on an existing non-normalized powermatrix is FLIPAnalysis.m. The provided tutorial details how to utilize FLIP. Two supplementary files are provided: data.mat contains the data used in the paper, and main_FLIP_script.m is a script that interact with the FLIPAnalysis function. main_FLIP_script is helpful in demonstrating how FLIP can be used in data analysis. ### File and function Descriptions #### Published_main_FLIP_script.pdf This PDF contains the author's run of main_FLIP_script.m and associated figures produced by that script, so that users can verify they are getting the expected figure outputs when they run main_FLIP_script.m themselves. #### data.mat This data file contains a struct that encompasses the data recorded in experimentation. There are five fields contained in the struct: CSD, relpow, meta, example1_vlPFC_lfp, and example2_7A_lfp * CSD: Current Source Density data contained in a three-dimensional matrix, the first dimension represents each probe, the second dimension represents each channel, and the third dimension represents each time point (from -0.1s pre-stimulus to +0.5s post-stimulus) included in the analysis. The units of CSD are z-score change from baseline (using the standard error across trials to perform the z-score at each point in time). Positive values denote sources and negative values denote sinks. * relpow: Relative Power data is contained in a three-dimensional matrix, like CSD, the first dimension represents each probe, the second dimension represents each channel, and the third dimension represents each frequency (from 1-150 Hz) included in the analysis. The units of the relpow data are normalized units between 0 and 1 (1=the channel with the highest power at that frequency). * example1_vIPFC_lfp: a sample LFP dataset, a three-dimensional matrix, the first dimension represents probe channels, the second dimension represents trials, and the third dimension represents time. Units of these local field potentials (LFP) are in microvolts by time (sampling rate = 1,000 Hz) * example2_7A_lfp: also a sample LFP dataset, a three-dimensional matrix, the first dimension represents probe channels, the second dimension represents trials, and the third dimension represents time. Units of these local field potentials (LFP) are in microvolts by time (sampling rate = 1,000 Hz) * meta: Metadata about each probe used in the analysis. The rows of meta correspond to the rows of CSD and relpow. Filename: The filename of the associated session, including the date of recording. probenumber: The probenumber on that session. study_number refers to study 1/2 reported in Mendoza-Halliday et al., 2023. monkey_number identifies the research subject. brain_area_num identifies the brain area numerically. interchannel_distance identifies the distance between contacts on a probe in units of microns. brain_area denotes each area's name. crossover_default is the cross identified by the FLIP algorithm with default settings. crossover_VFLIP is cross-identified by the vFLIP algorithm. CSD_sink_channel is the channel corresponding to the "early" current sink identified with a manual inspection method. #### FLIPAnalysis.m This file contains the FLIP and vFLIP algorithms. #### main_FLIP_script.m This file contains a few sample interactions with the FLIPAnalysis function. To use this file, ensure the data.mat and FLIPAnalysis.m files are downloaded. Additionally, ensure it is in the same folder as FLIPAnalysis.m or add FLIPAnalysis.m to the path. #### FLIP Algorithm Introduction.pdf A step-by-step tutorial that reviews how to use the FLIP and vFLIP algorithms for spectrolaminar analysis. --- # variable Frequency-based Layer Identification Procedure, version 2 (vFLIP2) ## **vFLIP2 Algorithm File Descriptions** ### Getting Started Open vFLIP2_readme.mlx for an interactive, hands-on walkthrough showcasing how vFLIP2.m analyzes laminar LFP data from vFLIP2_testdata.mat.To better understand the logic behind the pipeline and its parameters, explore vFLIP2_Description.pdf and vFLIP2_Tutorial.pdf, which unpack the algorithm’s steps and data structure in detail. ### File and function Descriptions #### vFLIP2.m Main MATLAB function implementing the vFLIP2 pipeline for analyzing functional LFP interactions. #### vFLIP2_readme.mlx MATLAB Live Script providing an interactive walk-through of the vFLIP2 analysis workflow. #### vFLIP2_testdata.mat The dataset comprises three primary fields, trialcut, power_example, and raw, each representing a distinct level of preprocessing of the local field potential (LFP) data. These fields can be analyzed using **vFLIP2**, as detailed in the accompanying documentation file **vFLIP2_readme.mlx**. Variables: * The **power_example** field is a two-dimensional matrix of size 31 × 250. It represents example power spectra calculated from 31 recording channels and across 250 Frequency bins (from 1-250 Hz). * The **trialcut** field is a three-dimensional matrix with dimensions 16 × 5501 × 521. It contains time-segmented LFP trials, where each of the 16 entries along the first dimension corresponds to an individual recording channel. The second dimension (5501 samples) represents the time samples within each trial, and the third dimension (521) indexes the number of trials. * The **raw** field consists of a large two-dimensional matrix with dimensions 16 × 2,866,021. It contains the continuous, unsegmented LFP recordings obtained from 16 electrodes before any trial segmentation or preprocessing. #### vFLIP2_Description.pdf Documentation detailing vFLIP2 algorithm logic and steps of analysis. #### vFLIP2_Tutorial.pdf Documentation detailing vFLIP2 input/output structure, and key parameters. #### relpow_from_rawLFP.m MATLAB script for computing laminar relative power from raw LFP data. ## Code/software The vFLIP2 code was developed using MATLAB R2023a. To run the code, you must download the following dependencies: * Signal Processing Toolbox. * Statistics and Machine Learning Toolbox.