/SWAVE

Graphing COBRAWAP data

Primary LanguagePythonMIT LicenseMIT

Sleep Wave Analysis Visualization Engine (SWAVE)

SWAVE LOGO

Description

Examining the Sleep Slow Wave changes propagating across the cortex. Initially developed to visualize wave characteristics across three behavioral states—Wake (W), NREM (NR), and REM (R)—SWAVE now supports the implementation of additional 'N' states. This is a data visualization tool that takes processed data from the COBRAWAP pipeline and returns measures to graph the dynamic wave-like activity patterns found in the data.

Documentation

Documentation

Context

image

For researchers studying cortical wave-like activity and Peak/Trough state dynamics, effectively visualizing and interpreting the complex analysis results is crucial for gaining meaningful insights. While COBRAWAP provides a powerful and modular pipeline for analyzing wide-field calcium imaging data, seamless integration with intuitive visualization tools can enhance the accessibility and interpretability of the analysis outcomes.

Our visualization tool is designed to complement and collaborate with COBRAWAP, forming a unified and user-friendly platform for comprehensive cortical wave analysis. By integrating with COBRAWAP's outputs, our tool bridges the gap between raw analysis results and their effective interpretation, empowering researchers with both programming and non-programming backgrounds to explore and understand the dynamics of cortical wave activity and Peak/Trough state detections.

Key features of our visualization solution include:

  1. Polar Histograms: Gain insights into the directional properties of cortical waves by visualizing their propagation directions, facilitating the identification of dominant propagation patterns.
Polar Histogram Example
  1. Velocity Heatmaps: Explore the spatial distribution of wave velocities across the imaging field, revealing regions with distinct wave propagation speeds and potential correlations with underlying cortical structures.
Velocity Heatmap Example
  1. Planarity Visualizations: Assess the planarity (cortical vs. subcortical) of the waves through intuitive visualizations that highlight deviations from planarity.
Planarity Example
  1. Wave Frequency: Analyze the number of waves per unit of time distribution of cortical waves, revealing patterns of activity across different regions.
Wave Frequency Example
  1. FOR THE FUTURE: Locality Index to access local vs global waves

Together, COBRAWAP and SWAVE form a comprehensive and accessible platform for cortical wave research, fostering interdisciplinary collaboration, knowledge sharing, and ultimately driving scientific progress in this field.

Installation/Set-up

Before using our visualization tool, ensure that you have set up and run the COBRAWAP pipeline to process your data. Follow the installation and usage instructions provided in the COBRAWAP documentation to analyze your data and generate the necessary output files and file structure.

To run our tool, you'll need the following packages. Refer to these detailed instructions to install them:

  • pandas, matplotlib, numpy, pathlib, glob, csv, os, argparse, difflib, scipy, seaborn, tkinter, time

How to run your code

input.txt

The input text file serves as a set of instructions for the visualization. Please refer to the documentation for more information.

An example of how input.txt could look:

#filename:wave_ids
--s 'NREM REM KX' # Expecting to see two states, for example NREM and REM within the inputs
--f '_Mice_Name_KX' # The 'KX' is denoting which state this input belongs to
--f '_Mice_Name_NREM' --freq # This runs all waves for the entire input
--f '_Mice_Name_REM':1-30, 52, 54 --freq # This runs for waves: 1-30, 52, 54
--f CUMULATIVE --avg --v --freq --p --norm --n 1 #This line specifies flags to run Step2.py.

Running your Code

  1. Open your terminal or command prompt.
  2. Navigate to the directory where your code is located using the cd command.
  3. Run the script/tool using the appropriate command, providing the necessary arguments if any.

For example, to run run_script.py:

python run_script.py

Using Tkinter, you will be able to select the directory in which the data/files/inputs to analyze are located. An example of this window is provided below

Screenshot 2024-04-16 at 2 42 48 PM

Outputs

For each iteration, a timestamped folder will be created including a text file with parameters and the corresponding visuals. Click here to see an example output folder

Screenshot 2024-04-16 at 3 00 53 PM

Liscenses / Legal

SWAVE is open-source software and is licensed under the MIT License.