OSCR

Early Trajectories of Resting-State EEG power in autistic children: a longitudinal study across language profiles.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Material and methods › Statistical analyses › Cross-sectional classification analysis ↔ rsEEG_ASD.ipynb, lines 36–143 · score 0.89 · GridSearchCV, SelectKBest, nested cross validation, feature selection, SVC, SVM
  2. [2] § Material and methods › Statistical analyses › Cross-sectional classification analysis ↔ rsEEG_ASD.ipynb, lines 36–143 · score 0.73 · nested cross validation, accuracy scores, confusion matrix, sample predictions, fold, shuffled

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Jupyter notebook · 220 lines · 9.5 KB · no license · 2 matches

  1. # %%
  2. ####### --- Imports ---
  3. import numpy as np
  4. import pandas as pd
  5. import matplotlib.pyplot as plt
  6. import seaborn as sns
  7. import warnings
  8. import os
  9. import json
  10. from sklearn.model_selection import StratifiedKFold, GridSearchCV
  11. from sklearn.svm import SVC
  12. from sklearn.preprocessing import StandardScaler, LabelEncoder
  13. from sklearn.pipeline import Pipeline
  14. from sklearn.feature_selection import SelectKBest, f_classif
  15. from sklearn.metrics import accuracy_score, confusion_matrix, ConfusionMatrixDisplay
  16. # %%
  17. ####### --- Configuration ---
  18. # Use a dictionary to store parameters for easy modification.
  19. config = {
  20. 'load_results_if_exist': False, # Set to True to load saved results instead of re-running
  21. 'data_dir': '/Users/borghesani/Documents/5_Students/UNIGE_PhD/LATRECHE_Kenza/stats/',
  22. 'file_4_groups': 'New_NoICA_Cross-Sectional_New.xlsx',
  23. 'file_asd_td': 'New_NoICA_Cross-Sectional_New_ASD_TD.xlsx',
  24. 'results_dir': 'results',
  25. 'n_splits_outer': 5,
  26. 'n_splits_inner': 3,
  27. 'n_permutations': 10000,
  28. 'n_features_to_select': 500
  29. }
  30. warnings.filterwarnings('ignore')
  31. # %%
  32. ####### --- Helper Functions (Data Loading, ML, Plotting) ---
  33. def load_data(file_path, target_column='Dx'):
  34. """Loads data and prepares it for classification."""
  35. data = pd.read_excel(file_path)
  36. X = data.drop(columns=['ID', 'Dx', 'Visite']).values
  37. y_raw = data[target_column]
  38. le = LabelEncoder()
  39. y = le.fit_transform(y_raw)
  40. print(f"Loaded data from {file_path}")
  41. return X, y, le
  42. def run_classification(X, y, n_splits_outer, n_splits_inner, n_features):
  43. """
  44. Performs nested cross-validation to train and evaluate an SVM.
  45. Returns mean accuracy and out-of-sample predictions.
  46. """
  47. pipeline = Pipeline([
  48. ('scaler', StandardScaler()),
  49. ('feature_selection', SelectKBest(f_classif, k=n_features)),
  50. ('svm', SVC(kernel='linear', random_state=42))
  51. ])
  52. param_grid = {'svm__C': [0.01, 0.1, 1, 10, 100]}
  53. outer_cv = StratifiedKFold(n_splits=n_splits_outer, shuffle=True, random_state=42)
  54. accuracies = []
  55. all_y_test = []
  56. all_y_pred = []
  57. for train_idx, test_idx in outer_cv.split(X, y):
  58. X_train, X_test = X[train_idx], X[test_idx]
  59. y_train, y_test = y[train_idx], y[test_idx]
  60. inner_cv = StratifiedKFold(n_splits=n_splits_inner, shuffle=True, random_state=42)
  61. clf = GridSearchCV(estimator=pipeline, param_grid=param_grid, cv=inner_cv, scoring='accuracy')
  62. clf.fit(X_train, y_train)
  63. y_pred = clf.predict(X_test)
  64. accuracy = accuracy_score(y_test, y_pred)
  65. accuracies.append(accuracy)
  66. # Store true and predicted labels for the confusion matrix
  67. all_y_test.extend(y_test)
  68. all_y_pred.extend(y_pred)
  69. # Return mean accuracy and the collected out-of-sample labels
  70. return np.mean(accuracies), np.array(all_y_test), np.array(all_y_pred)
  71. def run_permutation_test(X, y, true_accuracy, n_permutations, n_splits_outer, n_splits_inner, n_features):
  72. """Performs a permutation test to assess statistical significance."""
  73. permutation_accuracies = []
  74. for i in range(n_permutations):
  75. print(f"Running permutation {i+1}/{n_permutations}", end="\r")
  76. y_shuffled = np.random.permutation(y)
  77. # Call the updated function but only store the accuracy
  78. perm_accuracy, _, _ = run_classification(X, y_shuffled, n_splits_outer, n_splits_inner, n_features)
  79. permutation_accuracies.append(perm_accuracy)
  80. print("\nPermutation testing complete.")
  81. p_value = np.mean(np.array(permutation_accuracies) >= true_accuracy)
  82. return p_value, permutation_accuracies
  83. def plot_permutation_results(true_accuracy, permutation_accuracies, p_value, title, filename=None):
  84. """Plots the permutation distribution and saves the figure."""
  85. cleaned_scores = [score for score in permutation_accuracies if score is not None]
  86. if not cleaned_scores:
  87. print(f"Warning: Cannot generate plot for '{title}' because no valid permutation scores were found.")
  88. return
  89. final_scores = np.array(cleaned_scores, dtype=float)
  90. fig, ax = plt.subplots(figsize=(10, 6))
  91. sns.histplot(data=final_scores, bins=30, kde=False, label='Permutation Accuracies', ax=ax)
  92. ax.axvline(true_accuracy, color='red', linestyle='--', linewidth=2, label=f'True Accuracy = {true_accuracy:.2f}')
  93. ax.set_title(title)
  94. ax.set_xlabel('Accuracy')
  95. ax.set_ylabel('Frequency')
  96. ax.legend()
  97. ax.text(0.05, 0.9, f'p-value = {p_value:.4f}', transform=ax.transAxes,
  98. bbox=dict(boxstyle='round,pad=0.5', fc='wheat', alpha=0.5))
  99. if filename:
  100. plt.savefig(filename, bbox_inches='tight')
  101. print(f"Saved permutation plot to {filename}")
  102. plt.close(fig)
  103. def plot_confusion_matrix_for_analysis(y_true, y_pred, display_labels, title, filename=None):
  104. """ Plots a confusion matrix from pre-computed labels and saves the figure."""
  105. cm = confusion_matrix(y_true, y_pred)
  106. disp = ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=display_labels)
  107. fig, ax = plt.subplots(figsize=(8, 6))
  108. disp.plot(ax=ax, cmap='Blues')
  109. ax.set_title(title)
  110. if filename:
  111. plt.savefig(filename, bbox_inches='tight')
  112. print(f"Saved confusion matrix to {filename}")
  113. plt.close(fig)
  114. def save_results_to_json(filename, analysis_name, accuracy, p_value, perm_scores, y_true, y_pred, class_labels):
  115. """ Saves detailed results, including data for the confusion matrix."""
  116. results_data = {
  117. 'analysis_name': analysis_name,
  118. 'true_accuracy': accuracy,
  119. 'p_value': p_value,
  120. 'permutation_accuracies': np.array(perm_scores, dtype=float).tolist(),
  121. 'y_true': y_true.tolist(),
  122. 'y_pred': y_pred.tolist(),
  123. 'class_labels': class_labels.tolist()
  124. }
  125. with open(filename, 'w') as f:
  126. json.dump(results_data, f, indent=4)
  127. print(f"Saved detailed results for '{analysis_name}' to {filename}")
  128. def load_results_from_json(filename):
  129. """Loads detailed results from a JSON file."""
  130. with open(filename, 'r') as f:
  131. return json.load(f)
  132. # %%
  133. def main():
  134. """Main function to run classification analyses, with option to load existing results."""
  135. os.makedirs(config['results_dir'], exist_ok=True)
  136. analyses = [
  137. {'name': 'ASD_vs_TD', 'file': config['file_asd_td'], 'title': 'ASD vs. TD'},
  138. {'name': '4_Groups', 'file': config['file_4_groups'], 'title': '4 Language Profiles'}
  139. ]
  140. for analysis in analyses:
  141. print(f"\n--- Starting Analysis: {analysis['title']} ---")
  142. analysis_name = analysis['name']
  143. json_path = os.path.join(config['results_dir'], f'results_{analysis_name}.json')
  144. if config['load_results_if_exist'] and os.path.exists(json_path):
  145. print(f"Found existing results. Loading from {json_path}...")
  146. # This part for loading results remains the same
  147. results = load_results_from_json(json_path)
  148. print(f"Loaded Results for {results['analysis_name']}: Accuracy={results['true_accuracy']:.4f}, p-value={results['p_value']:.4f}\n")
  149. plot_permutation_results(
  150. results['true_accuracy'],
  151. results['permutation_accuracies'],
  152. results['p_value'],
  153. f"Permutation Test Results: {analysis['title']}",
  154. filename=os.path.join(config['results_dir'], f"permutation_plot_{analysis_name}.png")
  155. )
  156. plot_confusion_matrix_for_analysis(
  157. results['y_true'],
  158. results['y_pred'],
  159. results['class_labels'],
  160. f"Confusion Matrix: {analysis['title']} (from Cross-Validation)",
  161. filename=os.path.join(config['results_dir'], f"confusion_matrix_{analysis_name}.png")
  162. )
  163. print("Plotting complete.")
  164. else:
  165. if config['load_results_if_exist']:
  166. print(f"No results file found at {json_path}. Running full analysis...")
  167. X, y, le = load_data(os.path.join(config['data_dir'], analysis['file']))
  168. # Run main analysis and get out-of-sample predictions
  169. true_accuracy, y_true_cv, y_pred_cv = run_classification(X, y, config['n_splits_outer'], config['n_splits_inner'], config['n_features_to_select'])
  170. p_value, perms = run_permutation_test(X, y, true_accuracy, config['n_permutations'], config['n_splits_outer'], config['n_splits_inner'], config['n_features_to_select'])
  171. print(f"Results for {analysis_name}: Accuracy={true_accuracy:.4f}, p-value={p_value:.4f}\n")
  172. # The block for generating a separate confusion matrix is now removed.
  173. # We use y_true_cv and y_pred_cv directly.
  174. # Save all results and plot
  175. save_results_to_json(json_path, analysis_name, true_accuracy, p_value, perms, y_true_cv, y_pred_cv, le.classes_)
  176. plot_permutation_results(
  177. true_accuracy, perms, p_value,
  178. f"Permutation Test Results: {analysis['title']}",
  179. filename=os.path.join(config['results_dir'], f"permutation_plot_{analysis_name}.png")
  180. )
  181. # Plot confusion matrix using the cross-validated predictions
  182. plot_confusion_matrix_for_analysis(
  183. y_true_cv, y_pred_cv, le.classes_,
  184. f"Confusion Matrix: {analysis['title']} (from Cross-Validation)",
  185. filename=os.path.join(config['results_dir'], f"confusion_matrix_{analysis_name}.png")
  186. )
  187. if __name__ == '__main__':
  188. main()
  189. # %%
  190. # %%

rsEEG_ASD.ipynb at commit ad9bfcf, no license · at the source

Overview

  1. Autism Brain and Behavior Lab, Faculty of Medicine, University of Geneva,Geneva, Switzerland
  2. Division of Adult Psychiatry, Department of Psychiatry, University Hospitals of Geneva,Geneva, Switzerland
  3. Department of Psychiatry, University School of Medicine, Geneva, Switzerland
  4. Cognitive Neuroimaging Unit, Université Paris Saclay, NeuroSpin center,Gif-sur-Yvette, France
  5. Department of Developmental Psychology and Socialisation and Department of Neuroscience, University of Padova,Padova, Italy
  6. Neurobiology of Concepts Expression Laboratory, Faculty of Psychology and Educational Sciences, University of Geneva,Geneva, Switzerland
Institutions: University of Geneva (Switzerland); University Hospital of Geneva (Switzerland); Université Paris-Saclay (France); University of Padua (Italy)
Journal: Translational psychiatry, volume 16, issue 1, article 371
Dates: received 28 July 2025; accepted 19 May 2026; published online 25 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41398-026-04132-0 · PMID 42185252 · PMCID PMC13385626 · OpenAlex W4412691398
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), autism (population)
Methods: Preprocessing, Statistics, Smoothing, state filtering, decompositions, Machine learning, Spectral & time-frequency, Connectivity
Keywords: Diagnostic markers, Neuroscience
MeSH: Autism Spectrum Disorder*, Brain*, Brain Waves*, Language Development*, Language Development Disorders*, Child, Child, Preschool, Electroencephalography, Female, Humans, Infant, Longitudinal Studies, Male (* major topic)
Topic: Autism Spectrum Disorder Research (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung (Swiss National Science Foundation) (51NF40–185897, 163859, 190084, 202235, 212653); Fondation Privée des Hôpitaux Universitaires de Genève (https://www.fondationhug. org) Fondation Pôle Autisme (https://www.pole- autisme.ch)
Citations: cited by 2 papers (Europe PMC); 55 references in the paper

Abstract

Language development in autism spectrum disorder (ASD) is heterogeneous, ranging from subtle differences to significant delays. In previous work, we identified three autistic language profiles in early childhood: Language Unimpaired (LU), Language Impaired (LI), and Minimally-Verbal (MV). While these profiles show distinct vocabulary, grammar, and pragmatic development, understanding their underlying neural correlates is essential to predict outcomes and develop targeted interventions. Here, we examined whole-brain resting-state EEG power across five canonical frequency bands in a longitudinal sample comprising 66 typically developing (TD) children and 122 autistic children (ages 1.6–6.0 years), yielding 358 time points. Within the ASD group, 61 children belonged to the LU profile, 44 children to LI, and 17 children to MV. Compared to TD peers, autistic children showed increased power in low-frequency (delta, theta) and high-frequency bands (beta, gamma). Gamma power varied by autistic language profile, with the highest levels in MV children. Moreover, gamma power within ASD followed a quadratic trajectory in relation to word combination acquisition, peaking around the time of acquisition and decreasing afterward. This pattern suggests a dynamic, compensatory mechanism supporting the transition to phrase speech, which is a critical milestone toward functional speech that may predict language outcomes in ASD.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

NoCe-Lab/rsEEG_ASD

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: ad9bfcfc4506d6e40745dd862fd5661c55d1047e, 6 July 2025
Languages: Jupyter (1)
Size: 1 file, 1 script
Software Heritage: not archived
Found in: the text, “Cross-sectional classification analysis”
Holds: 1 notebook
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (1 file), NumPy (1 file), pandas (1 file), scikit-learn (1 file), seaborn (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
1 file

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability

The datasets analyzed during the current study are not publicly available due to privacy and ethical restrictions but are available from the corresponding author upon reasonable request.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 2 keywords, 13 MeSH terms, 2 funders, 48 references.

Cite

This paper

Latrèche, K., Godel, M., Flò, A., Journal, F., Borghesani, V., & Schaer, M. (2026). Early Trajectories of Resting-State EEG power in autistic children: a longitudinal study across language profiles. Translational psychiatry, 16(1), 371. https://doi.org/10.1038/s41398-026-04132-0

BibTeX

@article{latreche2026early,
author = {Latrèche, Kenza and Godel, Michel and Flò, Ana and Journal, Fiona and Borghesani, Valentina and Schaer, Marie},
title = {{Early Trajectories of Resting-State EEG power in autistic children: a longitudinal study across language profiles}},
journal = {Translational psychiatry},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {371},
publisher = {Nature Publishing Group},
issn = {2158-3188},
doi = {10.1038/s41398-026-04132-0},
url = {https://doi.org/10.1038/s41398-026-04132-0},
pmid = {42185252},
pmcid = {PMC13385626}
}

RIS

TY - JOUR
AU - Latrèche, Kenza
AU - Godel, Michel
AU - Flò, Ana
AU - Journal, Fiona
AU - Borghesani, Valentina
AU - Schaer, Marie
TI - Early Trajectories of Resting-State EEG power in autistic children: a longitudinal study across language profiles
T2 - Translational psychiatry
J2 - Transl Psychiatry
PY - 2026
DA - 2026/05/25
VL - 16
IS - 1
SP - 371
SN - 2158-3188
PB - Nature Publishing Group
DO - 10.1038/s41398-026-04132-0
UR - https://doi.org/10.1038/s41398-026-04132-0
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41398-026-04132-0",
"type": "article-journal",
"title": "Early Trajectories of Resting-State EEG power in autistic children: a longitudinal study across language profiles",
"container-title": "Translational psychiatry",
"author": [
{
"family": "Latrèche",
"given": "Kenza"
},
{
"family": "Godel",
"given": "Michel"
},
{
"family": "Flò",
"given": "Ana"
},
{
"family": "Journal",
"given": "Fiona"
},
{
"family": "Borghesani",
"given": "Valentina"
},
{
"family": "Schaer",
"given": "Marie"
}
],
"container-title-short": "Transl Psychiatry",
"volume": "16",
"issue": "1",
"page": "371",
"DOI": "10.1038/s41398-026-04132-0",
"PMID": "42185252",
"PMCID": "PMC13385626",
"ISSN": "2158-3188",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41398-026-04132-0",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
25
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1111/cge.70204 [code]
Phenotypic Characterization of Five Children With PACS1-NDD: Longitudinal Insights Into Development, Behavior, and Brain.
Journal: Clinical genetics
In common: autism, 5 references, 3 authors
[2] doi:10.7554/elife.109901
Infants at high and low likelihood for autism show different EEG developmental trajectories in speech tracking and statistical learning.
Journal: eLife
In common: autism, EEG, 8 references, 2 authors
[3] doi:10.1038/s41598-026-42120-y [code]
Qualitative EEG abnormalities in ASD reflect inhibition-dominated brain dynamics.
Journal: Scientific reports
In common: seaborn, pandas, Matplotlib, 1 other tool, autism, EEG, 5 references
[4] doi:10.1162/imag.a.1256 [code]
Gamer in the scanner: Event-related analysis of fMRI activity during retro videogame play guided by automated annotations of game content.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: seaborn, scikit-learn, pandas, 2 other tools, author Valentina Borghesani
[5] doi:10.3389/fpsyt.2026.1803720 [code]
NeuroCon-AutismNet: a privacy-preserving multimodal framework toward autism screening via diffusion-regularized EEG biomarkers and empathy-aware multilingual dialogue.
Journal: Frontiers in psychiatry
In common: scikit-learn, pandas, Matplotlib, 1 other tool, autism, EEG, 2 references
[6] doi:10.1002/dad2.70366 [code]
Redefining the norms: an interdisciplinary perspective on language testing in multilinguals with acquired and progressive neurogenic disorders.
Journal: Alzheimer's & dementia (Amsterdam, Netherlands)
In common: pandas, Matplotlib, NumPy, author Valentina Borghesani
[7] doi:10.1093/cercor/bhag077 [code]
The longitudinal development of intrinsic timescales in infancy and their relation to alpha brain rhythm.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: seaborn, scikit-learn, pandas, 2 other tools, EEG, 2 references
[8] doi:10.21203/rs.3.rs-9839901/v1 [code]
Early life ventricular enlargement precedes emergence of autistic traits
Journal: Research Square (preprint)
In common: NumPy, autism, 3 references
[9] doi:10.1038/s41593-026-02287-z [code]
Autism subtypes identified using cross-species functional connectivity analyses.
Journal: Nature neuroscience
In common: NumPy, autism, 3 references
[10] doi:10.1162/imag.a.1269 [code]
From early to contemporary normative modeling: Mapping individual differences in neurophysiological signals.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: seaborn, scikit-learn, pandas, 2 other tools, EEG, 2 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.