OSCR

Anatomical-connectivity-guided functional connectivity reveals task-relevant pathways during proactive task-switching via recurrent graph neural networks.

Code ↔ Paper

3 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 3 matches
  1. [1] § Methods › Dataset description › Stimuli and procedure ↔ DataProcessing/source_est_obj.py, lines 38–75 · score 0.71 · blue circle, blue square, red circle, red square, switch
  2. [2] § Methods › Behavioral analysis and data preparation › Source reconstruction ↔ DataProcessing/source_est_obj.py, lines 77–154 · score 0.62 · dSPM, covariance, depth, BEM, inverse, noise
  3. [3] § Methods › Behavioral analysis and data preparation › EEG data preprocessing ↔ DataProcessing/preprocessing_obj.py, lines 108–154 · score 0.61 · ICA components, 1–50 Hz, blinks, preprocessing, EEG, raw

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

Python · 238 lines · 12 KB · no license · 2 matches

  1. import dill
  2. import os, mne, sys
  3. import numpy as np
  4. from pathlib import Path
  5. from mne.datasets import sample
  6. sys.path.append('../Study/Model/')
  7. from utils import SampleModule
  8. class EEGProcessor:
  9. def __init__(self, raw_folder_path, scratch=False, candidate_events=['repeat', 'switch']):
  10. self.raw_folder_path = raw_folder_path
  11. self.subjects_dir = str(sample.data_path())+'/subjects'
  12. self.src_path = os.path.join(self.subjects_dir, 'fsaverage' , 'bem' , 'fsaverage-ico-5-src.fif')
  13. self.bem_path = os.path.join(self.subjects_dir, 'fsaverage' , 'bem' , 'fsaverage-5120-5120-5120-bem-sol.fif')
  14. self.subj_data_dict = {}
  15. self.events_id = {'left_key': 1, 'right_key': 2, 'red_circle': 5,
  16. 'blue_circle': 6, 'red_square': 7, 'blue_square': 8,
  17. 'color_fail': 9, 'shape_fail': 10, 'init_color': 11,
  18. 'init_shape': 12, 'repeat': 64, 'switch': 128,}
  19. self.candidate_events = candidate_events
  20. # 读取映射模板数据
  21. all_labels = mne.read_labels_from_annot('fsaverage', 'aparc', subjects_dir=self.subjects_dir) # 加载Desikan-Killiany区域的标签
  22. self.labels = [label for label in all_labels if label.name not in ['unknown-lh', 'unknown-rh']] # 移除'unknown-lh'和'unknown-rh'标签
  23. if scratch:
  24. # 创建MNI源空间
  25. self.src = mne.setup_source_space(subject='fsaverage', subjects_dir=self.subjects_dir, spacing='oct6', add_dist=False)
  26. # 计算传导模型
  27. model = mne.make_bem_model(subject='fsaverage', ico=5, subjects_dir=self.subjects_dir)
  28. self.bem = mne.make_bem_solution(model)
  29. else:
  30. # 创建MNI源空间
  31. self.src = mne.read_source_spaces(self.src_path)
  32. # 计算传导模型
  33. self.bem = mne.read_bem_solution(self.bem_path)
  34. def valid_events(self, all_events, success=False):
  35. if success:
  36. # 创建一个新的事件列表,只包含有效的 repeat 和 switch 事件
  37. valid_events = []
  38. # 定义目标事件和失败事件
  39. target_events = [self.events_id['red_circle'], self.events_id['blue_circle'],
  40. self.events_id['red_square'], self.events_id['blue_square']]
  41. fail_events = [self.events_id['shape_fail'], self.events_id['color_fail']]
  42. # 遍历所有的 repeat 和 switch 事件
  43. for event in all_events:
  44. if event[2] in [self.events_id['repeat'], self.events_id['switch']]:
  45. # 查找事件之后的所有事件
  46. next_events = all_events[np.where(all_events[:, 0] > event[0])[0]]
  47. # 筛选出后续事件中是目标事件的前三个
  48. target_occurrences = next_events[np.isin(next_events[:, 2], target_events)][:3]
  49. # 检查这些目标事件后的下一个事件是否为失败事件
  50. is_valid = True
  51. for target_event in target_occurrences:
  52. # 找到目标事件之后的第一个事件
  53. following_events = next_events[np.where(next_events[:, 0] > target_event[0])[0]]
  54. if following_events.shape[0] > 1:
  55. if following_events[1, 2] in fail_events:
  56. is_valid = False
  57. break
  58. # 如果没有发现任何不满足条件的情况,则当前事件有效
  59. if is_valid:
  60. valid_events.append(event)
  61. return np.array(valid_events)
  62. else:
  63. return all_events
  64. def rough_source_recon(self, raw_clean, success=False):
  65. '''
  66. 用于粗略的源重建
  67. method: 'dSPM' 'MNE' 'sLORETA'
  68. '''
  69. snr=3.0
  70. method='dSPM'
  71. lambda2 = 1.0 / snr ** 2
  72. # 读取事件
  73. events = mne.find_events(raw_clean)
  74. events = self.valid_events(events, success=success)
  75. event_info_dict = {}
  76. # 挑选EEG通道
  77. picks = mne.pick_types(raw_clean.info, eeg=True)
  78. # 挑选事件
  79. new_events_dict = {key:self.events_id[key] for key in self.candidate_events}
  80. # 遍历event_id字典的键值对
  81. for key, value in new_events_dict.items():
  82. # 获取每个event_id的epochs
  83. epochs_temp = mne.Epochs(raw_clean, events, {key: value},
  84. tmin=-0.2, tmax=1.2,
  85. picks=picks,
  86. baseline=(None, 0),
  87. preload=True)
  88. # 计算噪声协方差矩阵
  89. noise_cov_temp = mne.compute_covariance(epochs_temp,
  90. tmin=None, tmax=0,
  91. method='shrunk')
  92. # 计算前向模型
  93. fwd_temp = mne.make_forward_solution(epochs_temp.info,
  94. trans=None, src=self.src, bem=self.bem,
  95. eeg=True, meg=False)
  96. # 计算逆向模型(源估计)
  97. inverse_operator = mne.minimum_norm.make_inverse_operator(epochs_temp.info,
  98. fwd_temp,
  99. noise_cov_temp,
  100. loose=0.2, depth=0.8)
  101. # 计算源估计
  102. stc_average = mne.minimum_norm.apply_inverse(epochs_temp.average(),
  103. inverse_operator,
  104. lambda2,
  105. method) #'dSPM' 'MNE' 'sLORETA'
  106. # 计算源活动的时间序列
  107. stcs_individual = mne.minimum_norm.apply_inverse_epochs(epochs_temp,
  108. inverse_operator,
  109. lambda2,
  110. method)
  111. # 投影源估计到Desikan-Killiany区域
  112. label_time_courses = mne.extract_label_time_course(stcs_individual,
  113. self.labels,
  114. inverse_operator['src'],
  115. mode='mean_flip',
  116. return_generator=False)
  117. # 计算repeat和switch事件在源数据中的发生时点
  118. time_samp_list = self.relative_time(epochs_temp.times, raw_clean.first_samp, events, value)
  119. # 将事件ID、epochs和噪声协方差矩阵添加到字典中
  120. event_info_dict[key] = {'event_id': value,
  121. 'epochs': epochs_temp,
  122. 'stc_average': stc_average,
  123. 'inverse_operator': inverse_operator,
  124. 'label_time_courses': label_time_courses,
  125. 'time_samp_list': time_samp_list}
  126. return event_info_dict
  127. def recon_base(self, suffix='sep1', prefix='sep1', success=False, subj=None):
  128. base_path = Path(self.raw_folder_path)
  129. subjects = [folder for folder in base_path.iterdir() if folder.is_dir() and folder.name.startswith("subject")]
  130. for subject_folder in subjects:
  131. if subj is not None:
  132. if subject_folder.name not in subj:
  133. continue
  134. src_recon_folder = subject_folder / 'src_recon'
  135. src_recon_folder.mkdir(exist_ok=True)
  136. fif_file = next(subject_folder.glob(f"*{prefix}.fif"))
  137. raw_clean = mne.io.read_raw_fif(fif_file)
  138. print(f"Processing {fif_file.name}...")
  139. event_info_dict = self.rough_source_recon(raw_clean, success=success)
  140. with open(src_recon_folder / f"{subject_folder.name}_event_{suffix}.pkl", "wb") as output_file:
  141. dill.dump(event_info_dict, output_file)
  142. def deep_learning_data(self, suffix='sep1', dim_type='region', time_range=None, sample_fraction=1):
  143. subj_data_dict = {}
  144. for i in range(1, 21):
  145. event_info_path = os.path.join(self.raw_folder_path,
  146. f'subject{i:03d}',
  147. f'src_recon/subject{i:03d}_event_{suffix}.pkl')
  148. with open(event_info_path, 'rb') as file:
  149. event_info_dict = dill.load(file)
  150. for key, value in event_info_dict.items():
  151. # Filter by time range
  152. if time_range is not None:
  153. start_time, end_time = time_range
  154. time_mask = (value['epochs'].times >= start_time) & (value['epochs'].times <= end_time)
  155. else:
  156. time_mask = np.ones(len(value['epochs'].times), dtype=bool)
  157. # Filter by sample fraction
  158. sample_indices = np.arange(0, len(value['epochs'].times), sample_fraction)
  159. sample_mask = np.zeros(len(value['epochs'].times), dtype=bool)
  160. sample_mask[sample_indices] = True
  161. # Apply the masks
  162. mask = time_mask & sample_mask
  163. if dim_type == 'region':
  164. filtered_label_time_courses = [ltc[:, mask] for ltc in value['label_time_courses']]
  165. elif dim_type == 'channel':
  166. filtered_label_time_courses = [ltc[:, mask] for ltc in value['epochs'].get_data()]
  167. if f'subject{i:03d}' not in subj_data_dict.keys():
  168. subj_data_dict[f'subject{i:03d}'] = [(one_sample, key) for one_sample in filtered_label_time_courses]
  169. else:
  170. subj_data_dict[f'subject{i:03d}'].extend([(one_sample, key) for one_sample in filtered_label_time_courses])
  171. print(f'subject{i:03d} finished!')
  172. # Serialize the subj_data_dict
  173. output_folder = os.path.join(self.raw_folder_path, 'group', 'model')
  174. os.makedirs(output_folder, exist_ok=True) # Ensure the directory exists
  175. with open(os.path.join(output_folder, f'subj_data_{suffix}_{dim_type}_dict.pkl'), 'rb') as file:
  176. _, sampling_points, sampling_freq = dill.load(file)
  177. with open(os.path.join(output_folder, f'subj_data_{suffix}_{dim_type}_dict.pkl'), 'wb') as f:
  178. dill.dump((subj_data_dict, sampling_points, sampling_freq), f)
  179. @staticmethod
  180. def relative_time(raw_times, first_samp, events, value):
  181. time_samp_list = []
  182. for event in events:
  183. if event[-1] == value:
  184. event_samp = event[0]
  185. start = int(round(event_samp + raw_times[0] * 1024))-first_samp
  186. stop = start + len(raw_times)
  187. imin, imax = 0, int(np.where(raw_times<= 0)[0][-1])+1
  188. time_samp_list.append((start, stop, imin, imax))
  189. return time_samp_list

source_est_obj.py, no license · at the source

Overview

Authors: Siyu Wang1, Atsushi Miyata2, Teruhisa Okuya2, Hiroto Yanagawa2, Ayaka Sakaki1, Natsuhiro Ichinose3, Takatsune Kumada1
  1. Graduate School of Informatics, Kyoto University,36-1 Yoshida-Honmachi, Sakyo-ku, Kyoto, 606-8501 Japan
  2. Panasonic Holdings Corporation,Osaka, Japan
  3. Kyoto Women’s University,Kyoto, Japan
Institutions: Kyoto University (Japan); Panasonic (Japan) (Japan); Kyoto Women's University (Japan)
Journal: Brain informatics, volume 13, issue 1, article 20
Dates: received 4 November 2025; accepted 14 March 2026; published online 26 April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1186/s40708-026-00300-6 · PMID 42035367 · PMCID PMC13237348 · OpenAlex W7155705730
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), cognitive (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing, Evoked potentials, Graphs, fMRI & imaging, Physiology & signal measures
Keywords: EEG, Recurrent graph neural network, Task-switching paradigm, Proactive control, Temporal expectation, Functional network, Anatomical network, Cognitive neuroscience
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 146 references in the paper

Abstract

In an increasingly complex society, cognitive flexibility is essential for effective multitasking. We developed a novel approach—Anatomical-Connectivity-Guided Functional Connectivity (ACG-FC)—and applied it to the preparatory phase of a task-cueing paradigm to examine functional coordination mechanisms among brain regions critical for cognitive flexibility during proactive control and temporal expectation. This approach emphasizes the importance of inter-regional collaboration by integrating the cortical structural connectome, which reflects transmission pathways with electroencephalography (EEG) data within recurrent graph neural networks (RGNNs) to evaluate the functional relevance of brain regions and their associated neural connections. In generalizing signal pattern differences across proactive control processes, RGNNs outperformed other symbolic machine learning and deep neural network (DNN) models commonly applied to neurophysiological data, indicating that spatial information from the structural connectome enhances EEG pattern recognition during executive control. Meanwhile, single-population attribution analysis revealed that general proactive task preparation involves functional coordination within three synchronous ACG-FC subnetworks clustered around the frontoparietal "multiple demand" system. This supports multiple late-latency neural priming processes during execution preparation, associated with functionally distinct yet highly complementary subnetworks in the prefrontal, cingulate, and temporal cortices. Furthermore, dual-population attribution analysis indicated that scattered ACG-FC differences specifically underlie distinct modes of proactive control or target anticipation. ACG-FC extends conventional functional connectivity (FC) from signal-dependent pairwise analyses to signal-structure-dependent network analyses by using a group-level anatomical connectome as a structural prior to guide the extraction of functional interactions, offering a new perspective on task relevance between cognitive activities and their neural bases.

Supplementary Information: The online version contains supplementary material available at 10.1186/s40708-026-00300-6.

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 3 matches between paragraphs and lines of code.

OSF p2vka

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Languages: Python (2), Jupyter (1)
Size: 25 files, 3 scripts
Software Heritage: not checked
Found in: “Data availability”
Holds: 1 notebook
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: MNE-Python (3 files), NumPy (2 files), Matplotlib (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
3 files
At the source: osf.io/p2vka/

The paper's code and data availability statement is in the Data section.

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;
  • 3 scripts, each with its path and the digest of its content;
  • 3 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 generated and analyzed in this study, together with the optimal models and experimental analysis code, are available in the Open Science Framework repository (https://osf.io/p2vka/). Owing to commercial copyright restrictions imposed by Panasonic Holdings Corporation, the raw EEG recordings (in “.bdf” format) from the full experiment are not publicly accessible. However, we instead release pre-processed EEG data (in “.fif” format) from the task-switching cue trials, which supported all modeling and analytical procedures in our research, along with the corresponding data preprocessing scripts. In addition, the down-sampled signal sequences from de-identified cue epochs—employed in the modeling and analysis notebooks—are provided to enable readers to verify the implementation rapidly. A detailed description of the supplementary materials is likewise available at https://osf.io/p2vka/.

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, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 8 keywords, 142 references.

Cite

This paper

Wang, S., Miyata, A., Okuya, T., Yanagawa, H., Sakaki, A., Ichinose, N., & Kumada, T. (2026). Anatomical-connectivity-guided functional connectivity reveals task-relevant pathways during proactive task-switching via recurrent graph neural networks. Brain informatics, 13(1), 20. https://doi.org/10.1186/s40708-026-00300-6

BibTeX

@article{wang2026anatomical,
author = {Wang, Siyu and Miyata, Atsushi and Okuya, Teruhisa and Yanagawa, Hiroto and Sakaki, Ayaka and Ichinose, Natsuhiro and Kumada, Takatsune},
title = {{Anatomical-connectivity-guided functional connectivity reveals task-relevant pathways during proactive task-switching via recurrent graph neural networks}},
journal = {Brain informatics},
year = {2026},
month = apr,
volume = {13},
number = {1},
pages = {20},
publisher = {Springer},
issn = {2198-4018},
doi = {10.1186/s40708-026-00300-6},
url = {https://doi.org/10.1186/s40708-026-00300-6},
pmid = {42035367},
pmcid = {PMC13237348}
}

RIS

TY - JOUR
AU - Wang, Siyu
AU - Miyata, Atsushi
AU - Okuya, Teruhisa
AU - Yanagawa, Hiroto
AU - Sakaki, Ayaka
AU - Ichinose, Natsuhiro
AU - Kumada, Takatsune
TI - Anatomical-connectivity-guided functional connectivity reveals task-relevant pathways during proactive task-switching via recurrent graph neural networks
T2 - Brain informatics
J2 - Brain Inform
PY - 2026
DA - 2026/04/26
VL - 13
IS - 1
SP - 20
SN - 2198-4018
PB - Springer
DO - 10.1186/s40708-026-00300-6
UR - https://doi.org/10.1186/s40708-026-00300-6
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s40708-026-00300-6",
"type": "article-journal",
"title": "Anatomical-connectivity-guided functional connectivity reveals task-relevant pathways during proactive task-switching via recurrent graph neural networks",
"container-title": "Brain informatics",
"author": [
{
"family": "Wang",
"given": "Siyu"
},
{
"family": "Miyata",
"given": "Atsushi"
},
{
"family": "Okuya",
"given": "Teruhisa"
},
{
"family": "Yanagawa",
"given": "Hiroto"
},
{
"family": "Sakaki",
"given": "Ayaka"
},
{
"family": "Ichinose",
"given": "Natsuhiro"
},
{
"family": "Kumada",
"given": "Takatsune"
}
],
"container-title-short": "Brain Inform",
"volume": "13",
"issue": "1",
"page": "20",
"DOI": "10.1186/s40708-026-00300-6",
"PMID": "42035367",
"PMCID": "PMC13237348",
"ISSN": "2198-4018",
"publisher": "Springer",
"URL": "https://doi.org/10.1186/s40708-026-00300-6",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
26
]
]
}
}

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.3758/s13415-026-01436-y
Neural correlates of asymmetric switch costs during affective task switching.
Journal: Cognitive, affective & behavioral neuroscience
In common: EEG, cognitive, 8 references
[2] doi:10.3758/s13415-026-01420-6
Are neural and behavioural measures of cognitive control associated with adaptive and maladaptive risk-taking in adolescence and young adulthood?
Journal: Cognitive, affective & behavioral neuroscience
In common: EEG, cognitive, 8 references
[3] doi:10.1371/journal.pone.0351872 [code]
Decoding visual object recognition from EEG signals.
Journal: PloS one
In common: MNE-Python, Matplotlib, NumPy, EEG, 4 references
[4] doi:10.3390/s26134019 [code]
NeuroStat: An Open-Source EEG Connectivity Platform for Randomised Controlled Trials.
Journal: Sensors (Basel, Switzerland)
In common: MNE-Python, Matplotlib, NumPy, EEG, 4 references
[5] doi:10.1162/imag.a.1245 [code]
Towards precision EEG connectomics: Evaluating the benefits of dense sampling.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: MNE-Python, Matplotlib, NumPy, EEG, 4 references
[6] doi:10.1016/j.isci.2026.117068 [code]
Directed graph neural networks with partial directed coherence for seizure prediction and epileptogenic network characterization.
Journal: iScience
In common: NumPy, 4 references
[7] doi:10.7554/elife.108673 [code]
Adaptive behavior is guided by integrated representations of controlled and non-controlled information.
Journal: eLife
In common: MNE-Python, Matplotlib, NumPy, EEG, 3 references
[8] doi:10.1162/imag.a.1034 [code]
Top-down selection of visual working memory contents is supported by alpha-band phase-synchronized oscillatory networks
Journal: n/a
In common: Matplotlib, NumPy, cognitive, 4 references
[9] doi:10.1093/cercor/bhag075 [code]
Cortical dynamics of icon perception: effects of concreteness and attractiveness.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: MNE-Python, Matplotlib, NumPy, cognitive, 3 references
[10] doi: [code]
Neural Correlates of Inhibitory Control in Impulsivity Traits in Non-Ecological Human–Computer Tasks: An ALE Meta-Analysis
Journal: Brain sciences
In common: cognitive, 5 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.