The Dynamic Synchronization Toolbox allows the calculation of dynamic graphs based on phase synchronization in experimental data. This enables an analysis of the time-development of network connectivity between multiple recording sites (e.g. in electroencephalography (EEG) or magnetoencephalography (MEG) data) with a high temporal resolution. Optionally, the toolbox offers the possibility to compute several graph metrics (such as cluster dynamics, node degree, HUB nodes) via the Brain Connectivity toolbox.

The Dynamic Synchronization Toolbox (DST) is an implementation of the pipeline used in our previous article [

The Brain Connectivity Toolbox (BCT, [

The scripts presented here have been generalized as much as possible to allow application not only to EEG data as in our prior publication, but to a wide variety of data as long as they were transformed to

The toolbox presented here provides a MATLAB implementation of the pipeline for creating and graph theoretically analyzing dynamic networks as has been introduced in [

Schematic drawing of the three software parts: connectivity, statistics and graph measures.

In the first step, the input data, that has been epoched and transformed to phase space prior application, undergoes a connectivity analysis based on the relative phase-locking value (rPLV), which is defined as follows:

where

In the second step, t-tests are used to define periods of significally increased phase-connectivity for each signal pair. In the toolbox we included the options to compare the rPLV against zero or against an artificially computed baseline signal consisting of random noise with the same mean and standard deviation as the baseline period and of the same length as the test interval. We further implemented three options for dealing with multiple comparisons: (i) no correction (for simple checks), (ii) false discovery rate (FDR) correction for single pairs and (iii) FDR correction pooled over all timepoints and signal pairs. A connection is assigned between a signal pair if the rPLV is significantly greater than zero or the artificial baseline.

Dynamic graphs were then defined as the ordered set _{t} |t ϵ_{t}_{t}_{t}: V × V

In the last step, we added the option to compute several graph measures from the BCT. These are, the node degree (i.e. the number of connections of a node), a Louvain community detection (also called clustering), the node flexibility (i.e. how often the nodes switch between the clusters) and the HUB nodes (i.e. the most influencial nodes) of the networks. We determined all of these measures at all given points in time to obtain their overall dynamics. For a better overview, we added an optimization step for community detection. Here, we always used the previous cluster configuration as the initial condition for the following community detection. Additionally, we post-hoc assigned the label for each community, minimizing the number of label switches between time points, which prevents the same cluster from being assigned different cluster labels at consecutive time points.

A more detailed description of the methods used can be found in [

The DST is fully implemented in MATLAB. It includes a main directory consisting of the master function

The master script is used to specify various options used for further processing. In this script we define the subject IDs, which will afterwards be loaded from the subfolders of the same name in the subject folder, e.g.:

These subject folders are organized in a BIDS (Brain Imaging Data Structure; [

Within the master script, an

Options for rPLV calculation in step 1.

OPTION | TYPE | DESCRIPTION |
---|---|---|

electrodes | integer list | subset of electrode indices of interest |

freqs | integer list | frequency range for time-frequency decomposition |

baseline | integer | (begin, end) of time-interval for relative baseline |

multiple_conds | boolean | single (false) or multiple (true) conditions |

switch_hands | boolean | enables mapping of electrodes to other hemisphere |

channels_new | integer list | new order of electrodes for mapped condition |

channels_old | integer list | old order of electrodes for mapped condition |

contrast | boolean | enabling contrasting conditions |

contrast_conds | integer list | indices of two conditions to contrast |

avg_freqs | integer list | frequencies of interest for averaging |

Flowchart depicting the logical sequence of the dynamic graph calculations.

Furthermore, we define the

Options for statistical testing and dynamic graph construction in step 2.

OPTION | TYPE | DESCRIPTION |
---|---|---|

pid | string | multiple comparisons ‘original’, ‘individual’, ‘uncorr’ |

pID_fix | double | fixed p-value for corrected stats |

p_fix | double | fixed p-value for uncorrected stats |

q_FDR | double | q-value for FDR-correction |

comp | string | type of comparison ‘baseline’ or ‘zero’ |

test_interval_start | integer | start of testinterval in ms |

test_interval_end | integer | end of testinterval in ms |

baseline_start | integer | start of baseline in ms |

baseline_end | integer | end of baseline in ms |

task | integer | definition of task by id (contrast appears last) |

contrast | boolean | enabling contrasting conditions |

time | integer list | sampling timepoints |

sampling_rate | integer | sampling rate of the data |

The optional calculation of node degree, community detection, node flexibility and HUB nodes can be altered by adjusting the variable

The first step for using the DST pipeline is to arrange the preprocessed data in a BIDS-like data structure in the Data subfolder. The data set of each subject should be stored in a subfolder

rplv: | relative phase-locking value for each dataset in a cell {num, subjects, 1}, each cell stores the rPLV with dimensions [time, channel, channel, conditions]. |

trials: | number of trials in each experimental condition and subject. |

rplv_mean: | group average of rPLV in [time, channel, channel, conditions]. |

sig_ti_FDR: | significant timepoints after statistics and multiple comparisons as a cell {channel, channel}. |

xa: | list of significant intervals [intervals, 3] with information about start timepoint, stop timepoint and the amount of timepoints to the next interval for each channel pair stored in a cell {channel, channel}. |

length: | list of length of significant intervals for each channel pair stored in a cell {channel, channel}. |

The optional graph metric generates the following additional outputs:

Agg: | aggregated graph showing the frequency of all connections over the whole interval in a matrix [channel, channel]. |

bet: | temporal betweenness centrality in a matrix [timepoint, channel]. |

hub: | temporal hub nodes, i.e. nodes with highest betweenness centrality, in a matrix [timepoint, 2]. |

clusters: | clusters assignment for each channel and timepoint [channel, timepoints]. |

node_flex: | node flexibility for each channel stored in a matrix [2, channel]. |

deg: | each channels node degree over time in a matrix [timepoint, channel]. |

To ensure sufficient quality control, two sample datasets of artificial data each consisting of four conditions were added to the scripts, one exhibiting a high degree of connectivity and the other a low degree of connectivity. The data are created by running the script

The data associated with the original article, analyzed with the toolbox, has been made available [

DST is a pure MATLAB code, and should function on all operating systems in which MATLAB is supported.

MATLAB (developed in vR2018b).

None.

The graph analysis is based on significant edges which depend on the Statistic toolbox [

Nils Rosjat wrote the software and is its current maintainer. Silvia Daun: Conceptualization, Supervision, Project administration, Funding acquisition.

Support requests of any kind are preferably to be submitted in GitHub as an issue or sent to the corresponding author Nils Rosjat via email.

English.

This toolbox is of great importance for researchers interested in investigating dynamic connectivity patterns in EEG data based on phase-synchronization. Even though the scripts were developed for a specific analysis of EEG data and performed at the electrode level, they could also be useful for researchers interested in performing source-based connectivity analyses or using different modalities such as MEG. Since the only requirement for the input data of the toolbox is that the signals have to be phase-transformed, the analysis can be applied to any signals with expected phase-locking between different recording sites. Additionally, we generalized the scripts as much as possible, not focusing too much on modality specific features, to increase its reuse potential even further. In the current version the connectivity is calculated based on rPLVs. Here, we presented the scripts as they were used for our prior connectivity analysis [

This toolbox provides a pipeline beginning at the level of phase-transformed data, constructing dynamic connectivity networks using statistical analysis and ending with the application of certain graph metrics from the BCT [

This work has been funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 431549029 – SFB 1451.

Deutsche Forschungsgemeinschaft. Grant Number: DA1953/5-2.

The authors have no competing interests to declare.