Package for functional imaging postprocessing analysis. The primary goal is to take time-series data from simultaneously-recorded cells/ROIs and event (behavior and/or manipulations) timing to gain an understanding of how individual and groups of cells relate to such external manipulations.
- After cloning/downloading the repository, open Anaconda Prompt (the following processes can also be performed in Anaconda Navigator)
- Locate the full path to the repository and in the prompt, execute
cd *path_to_repo*
. Example:cd C:\Users\napeadmin\Documents\GitHub\NAPE_imaging_postprocess
- Execute
conda env create -n napeca_post -f napeca_post.yml
. This should create a new anaconda environment called napeca_post that contains the relevant packages for running the post-processing scripts - Execute
conda activate napeca_post
to enable the newly created environment
- whole_session_event_ticks: Plot activity traces for each ROI across whole session (Optional - primarily for sanity check/prelim viz purposes)
- plot_activity_contours: Work-in-progress; Plots the cell ROI contours onto the projection image. ROI contours are color-coded based on the amplitude of the mean event-triggered response for each condition. Bar plots at the end illustrate condition preference.
- event_rel_analysis: Primary event-related analysis script: Plots trial-, roi-, time-resolved event-triggered responses for each and across all ROIs. Also plots average responses in each dimension.
- Example of spectral clustering: Kmeans/Spectral clustering of ROIs based on event-related responses. REQUIRES the above script to be run (event_rel_analysis)
- s2p_conversion: Processes and converts suite2p output signals, and saves a dataframe or np array of neuropil-corrected roi activity traces as both a csv and npy file. Either output files can be used for downstream analyses (eg. event_rel_analysis, s2p_plot_rois_and_activity)
- s2p_plot_rois_and_activity: Plot the cell ROI contours from Suite2p onto the session's projection image, and generates lineplots for each ROI's whole-session activity trace
- sima_plot_ROI_contours: Plot the cell ROI contours from SIMA/NAPECA onto the session's projection image, and generates lineplots for each ROI's whole-session activity trace
- Preprocess (motion correct, signal extract, neuropil correct) using NAPECA pipeline
- If you want to plot ROI contours and associated whole-session activity, run sima_plot_ROI_contours.ipynb
- The user should create an event CSV that contains trial event types and their timing (see example below) or if using Bruker data, generate a pickle file using the Bruker prepreprocessing code in NAPECA preprocessing repository (https://github.com/zhounapeuw/NAPE_imaging_analysis/blob/master/napeca/prepreprocess/bruker_data_process.ipynb)
- Run any of the main modules (with the fnames pointing to the NAPECA output; eg. VJ_OFCVTA_7_260_D6_neuropil_corrected_signals_15_50_beta_0.8.npy, and framenumberforevents_VJ_OFCVTA_7_260_D6_trained.pkl. Data from NAPECA are immediately compatible with the main postprocessing modules.
- Run s2p_conversion.ipynb to convert s2p output signals into either a csv or npy
- If you want to plot ROI contours and associated whole-session activity, run s2p_plot_rois_and_activity.ipynb
- The user should create an event CSV that contains trial event types and their timing (see example below)
- Run any of the main modules
- If you are using Inscopix: reference the csv containing ROI signals
- If you preprocessed your 2p data using Suite2p: Run the s2p_conversion.ipynb code first before moving to the main scripts
- If you are using the NAPECA Preprocessing pipeline: Run the main scripts while referencing the extracted signals or neuropil-corrected signals (npy files)
- All other data sources: The most straightforward approach is to create CSV files with the dimensions illustrated in the picture below
How should you format your behavioral data (if not using Bruker prepreprocess script for behavioral event extraction):
- The code is looking primarily for a dictionary where keys are the trial conditon names and the values are lists containing the event occurrences in samples/frames
- The most straightforward, general approach is to create a CSV file containing event data in the tidy format illustrated in the picture below
Activity traces for each ROI across whole session, with event occurrences plotted (whole_session_event_ticks):
Spectral clustering of ROIs based on event-related response profiles (Example of spectral clustering; to be renamed):
- Zhe Charles Zhou - Initial and ongoing work; Director - Zhou NAPE UW
- Lauren Ran Liao - Machine Learning Development - Lauren Liao