# Frites: A Python package for functional connectivity analysis and group-level statistics of neurophysiological data

Etienne Combriss, Ruggero Basanisi, Vinicius Lima Cordeiro, Robin a A Ince, Andrea Brovelli

► To cite this version:

Etienne Combriss, Ruggero Basanisi, Vinicius Lima Cordeiro, Robin a A Ince, Andrea Brovelli. Frites: A Python package for functional connectivity analysis and group-level statistics of neurophysiological data. Journal of Open Source Software, In press, 7 (79), pp.3842. 10.21105/joss.03842. hal-03843440

HAL Id: hal-03843440

https://hal.science/hal-03843440

Submitted on 8 Nov 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Frites: A Python package for functional connectivity analysis and group-level statistics of neurophysiological data

Etienne Combrisson¹, Ruggero Basanisi¹, Vinicius Lima Cordeiro¹,², Robin A. A Ince³, and Andrea Brovelli¹

1 Institut de Neurosciences de la Timone, Aix Marseille Université, UMR 7289 CNRS, 13005, Marseille, France
2 Institut de Neurosciences des Systèmes, Aix-Marseille Université, UMR 1106 Inserm, 13005, Marseille, France
3 Institute of Neuroscience and Psychology, University of Glasgow, Glasgow, UK

DOI: 10.21105/joss.03842

Software

- Review ⚗

- Repository ⚗

- Archive ⚗

Editor: Marie E. Rognes ⚗

Reviewers:

- @madvn

- @travisbthomp

Submitted: 21 September 2021

Published: 03 November 2022

License

Authors of papers retain copyright
and release the work under a
Creative Commons Attribution 4.0
International License (CC BY 4.0).

## Summary

The field of cognitive computational neuroscience addresses open questions regarding the complex relation between cognitive functions and the dynamic coordination of neural activity over large-scale and hierarchical brain networks. State-of-the-art approaches involve the characterization of brain regions and inter-areal interactions that participate in cognitive processes (Battaglia & Brovelli, 2020). More precisely, the study of cognitive brain networks underlies linking local neural activity or interactions between brain regions to experimental variables, such as sensory stimuli or behavioral responses. The relation between the brain data and external variables might take complex forms (e.g. non-linear relationships) with strong variations across brain regions and participants. Therefore, powerful measures of information are required to detect complex relations and the statistical relevance at the population level should be able to adapt to the inter subject variability.

## Statement of need

Frites (Framework for Information Theoretical analysis of Electrophysiological data and Statistics) is an open-source Python package, designed for researchers and students with little programming knowledge and working on the discovery of cognitive brain networks using neurophysiological data. It combines in a single framework information-based analyses of neurophysiological recordings and group-level statistical inference that can adapt to the inherent variability across participants. The measures of information and the group-level statistics functionalities are wrapped into high-level workflows. In addition, Frites also includes several measures of functional connectivity (FC) for measuring pairwise interactions between brain regions. To the best of our knowledge, Frites is the only Python software combining information-theoretical approaches with flexible group-level analyses for the discovery of cognitive brain networks.

## Supported neurophysiological recordings and link with other softwares

Frites is suitable for the analysis of continuous and multi-channel neurophysiological data, encompassing non-invasive recordings with uniform spatial sampling (e.g., M/EEG data) such as invasive and spatially sparse recordings, such as intracranial EEG or Local Field Potentials (LFPs). The package supports standard NumPy array inputs (Harris et al., 2020), neuro-oriented objects from the MNE-Python software (Gramfort et al., 2013), but also multi-dimensional labelled Xarray objects (Hoyer & Hamman, 2017).
## Measures of information and group-level statistics

Frites is equipped with a set of information theoretic tools for the analysis of interactions between brain signals and their relation with experimental task-related variables. By default, Frites is using the Gaussian Copula Mutual-Information (Ince et al., 2017) to study the relation between either local brain activity, cross-frequency coupling (Combrisson et al., 2020) or inter-areal FC with experimental variables (i.e., cognitive tasks). For what concerns FC, the toolbox allows the estimate of dynamic (i.e., time-resolve) (Brovelli et al., 2017), undirected (e.g., mutual information) and directed (e.g., Granger causality) FC on a single-trial basis (Brovelli et al., 2015). The networks built from the FC can then be further analyzed using graph-theoretical approaches from the Brain Connectivity Toolbox (Rubinov & Sporns, 2010). Nevertheless, Frites is not limited to the included estimators as the definition of custom ones is also supported, such as IDTx1 kernel methods (Wollstadt et al., 2019), infotheory information decomposition (Candadai & Izquierdo, 2019) or scikit-learn cross-validated classifiers (Pedregosa et al., 2011). The estimated information can then be combined with the group-level statistics for the identification of feature-specific networks. While Frites is strongly oriented toward neuroscience applications, the estimators of information are agnostic to data types and can therefore be applied to different fields.

For statistical inferences, the package integrates a non-parametric permutation-based statistical framework (Maris & Oostenveld, 2007) to perform group-level inferences on non-negative measures of information. The toolbox includes different methods that cope with multiple-comparison correction problems, such as test- and cluster-wise p-value corrections. The implemented framework also supports both fixed- and random-effect models to adapt to inter-individuals and inter-sessions variability (Combrisson et al., 2022).

## Workflows

Frites provides a set of workflows that integrate several analysis steps. Those workflows take as inputs the neural data coming from single or multi-participants (or single / multi sessions), estimate the amount of information shared between the brain data and the external variable, at each brain region and time bins, and finally perform network-level statistical inference, corrected for multiple comparisons. Those high-level workflows are particularly useful for users with no or little programming knowledge as all of those steps can be performed in a very few lines of code, with standard inputs like MNE-Python epochs.

## Performance

Several computations implemented in the workflows, such as permutation tests, are computationally demanding. To decrease computing time, the core functions for information measures exploit a NumPy tensor-based implementation or can be accelerated using the Numba compiler (Lam et al., 2015). Then, Frites natively supports parallel processing using the Joblib package.

## Acknowledgements

EC and AB were supported by the PRC project "CausaL" (ANR-18-CE28-0016). This project/research has received funding from the European Union's Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3). RB acknowledges support through a PhD Scholarship awarded by the Neuroschool. This work has received support from the French government under the Programme Investissements d'Avenir, Initiative d'Excellence d'Aix-Marseille Université via A*Midex (AMX-19-IET-004) and ANR (ANR-17-EURE-0029) funding. RAAI was supported by the Wellcome Trust [214120/Z/18/Z]. VLC is supported by a scholarship from the European
Union's Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 859937.

## References

Battaglia, D., & Brovelli, A. (2020). Functional connectivity and neuronal dynamics: Insights from computational methods. *The Cognitive Neurosciences*. https://doi.org/10.7551/mitpress/11442.001.0001

Brovelli, A., Badier, J.-M., Bonini, F., Bartolomei, F., Coulon, O., & Auzias, G. (2017). Dynamic Reconfiguration of Visuomotor-Related Functional Connectivity Networks. *The Journal of Neuroscience*, 37(4), 839–853. https://doi.org/10.1523/JNEUROSCI.1672-16.2016

Brovelli, A., Chicharro, D., Badier, J.-M., Wang, H., & Jirsa, V. (2015). Characterization of Cortical Networks and Corticocortical Functional Connectivity Mediating Arbitrary Visuomotor Mapping. *The Journal of Neuroscience*, 35(37), 12643–12658. https://doi.org/10.1523/jneurosci.4892-14.2015

Candadai, M., & Izquierdo, E. J. (2019). Infotheory: A c++/python package for multivariate information theoretic analysis. *arXiv Preprint arXiv:1907.02339*. https://doi.org/10.21105/joss.01609

Combrisson, E., Allegra, M., Basanisi, R., Ince, R. A. A., Giordano, B. L., Bastin, J., & Brovelli, A. (2022). Group-level inference of information-based measures for the analyses of cognitive brain networks from neurophysiological data. *NeuroImage*, 258, 119347. https://doi.org/10.1016/j.neuroimage.2022.119347

Combrisson, E., Nest, T., Brovelli, A., Ince, R. A. A., Soto, J. L. P., Guillot, A., & Jerbi, K. (2020). Tensorpac: An open-source Python toolbox for tensor-based phase-amplitude coupling measurement in electrophysiological brain signals. *PLoS Computational Biology*, 16(10), e1008302. https://doi.org/10.1371/journal.pcbi.1008302

Gramfort, A., Luessi, M., Larson, E., Engemann, D. A., Strohmeier, D., Brodbeck, C., Goj, R., Jas, M., Brooks, T., Parkkonen, L., & Hämäläinen, M. S. (2013). MEG and EEG data analysis with MNE-Python. *Frontiers in Neuroscience*, 7(267), 1–13. https://doi.org/10.3389/fnins.2013.00267

Harris, C. R., Millman, K. J., Walt, S. J. van der, Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., & others. (2020). Array programming with NumPy. *Nature*, 585(7825), 357–362.

Hoyer, S., & Hamman, J. (2017). Xarray: ND labeled arrays and datasets in Python. *Journal of Open Research Software*, 5(1). https://doi.org/10.5334/jors.148

Ince, R. A. A., Giordano, B. L., Kayser, C., Rousselet, G. A., Gross, J., & Schyns, P. G. (2017). A statistical framework for neuroimaging data analysis based on mutual information estimated via a gaussian copula: Gaussian Copula Mutual Information. *Human Brain Mapping*, 38(3), 1541–1573. https://doi.org/10.1002/hbm.23471

Lam, S. K., Pitrou, A., & Seibert, S. (2015). Numba: A LLVM-based Python JIT compiler. *Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC*, 1–6. https://doi.org/10.1145/2833157.2833162

Maris, E., & Oostenveld, R. (2007). Nonparametric statistical testing of EEG- and MEG-data. *Journal of Neuroscience Methods*, 164(1), 177–190. https://doi.org/10.1016/j.jneumeth.2007.03.024

Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D.,
Brucher, M., Perrot, M., & Duchesnay, E. (2011). Scikit learn : Machine Learning in Python. *Journal of Machine Learning Research*, *12*, 2825–2830.

Rubinov, M., & Sporns, O. (2010). Complex network measures of brain connectivity: Uses and interpretations. *Neuroimage*, *52*(3), 1059–1069. https://doi.org/10.1016/j.neuroimage.2009.10.003

Wollstadt, P., Lizier, J. T., Vicente, R., Finn, C., Martinez-Zarzuela, M., Mediano, P., Novelli, L., & Wibral, M. (2019). IDTxl: The information dynamics toolkit xl: A python package for the efficient analysis of multivariate information dynamics in networks. *Journal of Open Source Software*, *4*(34), 1081. https://doi.org/10.21105/joss.01081