Skip to content

Code used for the article "Synchrony, oscillations, and phase relationships in collective neuronal activity: a highly-comparative overview of methods" by F. Baroni and B.D. Fulcher (2024).

License

Notifications You must be signed in to change notification settings

fabaroni/sync_osc_MSTMs

Repository files navigation

sync_osc_MSTMs

Code used for the article "Synchrony, oscillations, and phase relationships in collective neuronal activity: a highly-comparative overview of methods" by F. Baroni and B.D. Fulcher (2024). The code is licensed under the GNU GPL v3 license (or later).

Most code is in Matlab. Some functions use tightPosition for creating figures and hence require a modern version of Matlab (R2022b or newer), but most of the code will run with an older version. Some of the scripts and functions require the Wavelet Toolbox, the Image Processing Toolbox, or the Statistics and Machine Learning Toolbox, but most of the code will run with a basic Matlab installation.

Some of the scripts and functions require a Python environment recognized by Matlab. In particular, these are the functions that perform FOOOF model estimation, and those that estimate intrinsic dimensionality using DADApy.

This repository includes code for:

  • the generation of synthetic spike trains, inside the directory synth_train_generation;
  • the analysis of real and synthetic spike trains, including the generation of all paper figures included in Baroni & Fulcher 2024, inside the directory data_analysis.

The README file includes a description of all high-level scripts and functions. The top-level script script_all.m includes all scripts required for the generation of synthetic data and for the analysis of synthetic and real spike trains, yielding all the results reported in Baroni & Fulcher 2024 in the same order as presented in the article.

Synthetic Spike Train Generation

Multiple synthetic spike trains with parameters spanning a range of values can be generated by using one of the scripts named script_*_train_range.m:

  • script_sin_train_range.m - single-scale, non sequential trains
  • script_sinseq_train_range.m - single-scale, sequential trains
  • script_G_train_range.m - dual-scale, non sequential trains
  • script_Gseq_train_range.m - dual-scale, sequential trains

sin in a script or function name indicates "single-scale" trains (stands for "sinusoidal"). G in a script or function name indicates "dual-scale" trains (stands for "Gaussian"). Spike train raster plots as in Fig 1 can be generated using plot_sinosc_train.m.

Synthetic Spike Train Analysis

Applying the library of Multineuron Spike Train Measures (MSTMs)

The MSTM library is included in the functions:

  • analyze_sinosc_train_ms.m
  • analyze_sinosc_train_fooof.m
  • analyze_sinosc_train_synfireind.m

These are called from the scripts script_*_train_range.m mentioned above, in the "Synthetic Spike Train Generation" section.

Correlation of each MSTM with each generative parameter

The scripts script_all_train_range_ss.m and script_all_train_range_ds.m load (single-scale and dual-scale, respectively) synthetic spike train measures and calculate the correlation of each MSTM with each generative parameter, generating panels such as those shown in Fig 3 using the function multi_all_train_range_anal_corr_bal.m. sync_all_absspearmancorr_thr_scaled_mat_par_color_longn_bs_050723

Organizing the MSTM library using inter-MSTM correlations and clustering

The script script_all_train_range.m loads synthetic spike train measures from both the single-scale and the dual-scale formalisms, and calculates inter-MSTM correlations and the resulting dendrogram, as in Fig 4, using the function multi_all_train_range_anal_bs_cluster_bal.m.

Real Spike Train Analysis

Applying the library of Multineuron Spike Train Measures (MSTMs)

The scripts script_data_train_{See18,Smith08,Form22}.m load, preprocess and analyze each of the three spike train datasets considered in this study:

The MSTM library can be applied to the preprocessed spike train datasets by using the functions:

  • analyze_osc_train_ms_win_{See18,Smith08,data}.m
  • analyze_osc_train_fooof_win_data.m
  • analyze_osc_train_synfireind_win_data.m

which recapitulate the corresponding functions used for the synthetic spike train analysis mentioned above in section "Synthetic Spike Train Analysis".

Organizing data segments using clustering

A visualization of each dataset through the lens of the MSTM library, as in Fig 7, can be obtained by using multi_train_anal_win_cluster.m. fig_see

Augmenting the MSTM library with new measures

To include additional MSTMs, you can write a new "Synthetic Spike Train Analysis" function following the template provided in the functions indicated above (analyze_sinosc_train_ms.m, analyze_sinosc_train_fooof.m or analyze_sinosc_train_synfireind.m).

Then, you can add a new case in get_field_names.m (for the extended set of MSTM, including multiple timescales for the timescale-dependent measures) and get_field_names_bs.m (for the core set of MSTM, including a single timescale---the "best scale"---for the timescale-dependent measures) specifying your new MSTM set. A MSTM set is identified by the field names_string of the structure par.

Then, the new selection of measures will be included in subsequent processing (such as clustering analysis, or correlation with generative parameters, etc.).

Reference

If you use this code in your project, please cite:

Contribute

This project welcomes and encourages contributions from the community, and pull requests are appreciated.

To file bug reports and/or ask questions about this project, please use the Github issue tracker.

Acknowledgements

We include some code developed by others. Please see content of the directory third-party.

Fundings

This project was supported by grants PID2021-122347NB-I00 (PI: Pablo Varona Martinez) and PID2020-114867RB-I00 (PI: Francisco de Borja Rodríguez Ortiz) (MCIN/AEI and ERDF- "A way of making Europe").

About

Code used for the article "Synchrony, oscillations, and phase relationships in collective neuronal activity: a highly-comparative overview of methods" by F. Baroni and B.D. Fulcher (2024).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages