OSCR

Human brain-wide activation of sleep rhythms.

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] § Methods › fMRI GLM analysis ↔ First_level_SO_base.py, lines 77–104 · score 0.68 · drift model, fMRI GLM, FWHM, cosine, smoothed
  2. [2] § Methods › MRI data preprocessing › Functional data preprocessing ↔ First_level_SO_base.py, lines 120–154 · score 0.63 · preprocessed BOLD, brain mask, FreeSurfer, space, mri

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 · 165 lines · 6.6 KB · MIT · 2 matches

  1. import glob
  2. import os
  3. import time
  4. import numpy as np
  5. import argparse
  6. from datetime import date
  7. from os.path import join
  8. import pandas as pd
  9. from joblib import Parallel, delayed
  10. import nibabel as nib
  11. from nilearn import image, masking
  12. from nilearn.glm.first_level import FirstLevelModel
  13. def prepare_data(subj, configs):
  14. func_dir, event_dir = configs['func_dir'], configs['event_dir']
  15. # func_name = configs['func_name']
  16. func_path = configs['func_path']
  17. mask_path = configs['mask_path']
  18. # sub_func_path = func_dir + '/sub-{}/func/'.format(subj)
  19. run_list = glob.glob(event_dir + '/sub-{}/run*'.format(subj))
  20. functional_imgs = []
  21. design_matrices = []
  22. mask_imgs = []
  23. for f in run_list:
  24. run_num = f.split('-')[-1]
  25. # func_file = sub_func_path + func_name.format(subj, run_num)
  26. func_file = func_path.format(subj, subj, run_num)
  27. func_img = nib.load(func_file)
  28. mask_file = mask_path
  29. mask_img = nib.load(mask_file)
  30. DM_path = event_dir + '/sub-{}/run-{}/DM.pkl'.format(subj, run_num)
  31. need_tr_path = event_dir + '/sub-{}/run-{}/need_tr_list.npy'.format(subj, run_num)
  32. design_matrix = pd.read_pickle(DM_path)
  33. need_tr_list = np.load(need_tr_path, allow_pickle=True)
  34. func_data = np.asarray(func_img.dataobj)[..., need_tr_list]
  35. img_header = func_img.header.copy()
  36. img_header.set_data_shape(func_data.shape)
  37. func_img_new = nib.Nifti1Image(func_data, func_img.affine, header=img_header)
  38. mask_imgs.append(mask_img)
  39. functional_imgs.append(func_img_new)
  40. design_matrices.append(design_matrix)
  41. DM_max_len = max(design_matrices, key=lambda x: x.shape[1]).shape[1]
  42. for dm in design_matrices:
  43. dummy_count = 0
  44. while dm.shape[1] < DM_max_len:
  45. dm.insert(dm.shape[1], 'dummy{}'.format(dummy_count), np.zeros(dm.shape[0]))
  46. dummy_count += 1
  47. return functional_imgs, design_matrices, mask_imgs
  48. def set_contrasts_SOSP_inter(design_matrices):
  49. contrast_matrix = np.eye(design_matrices.shape[1])
  50. basic_contrasts = dict([(column, contrast_matrix[i]) for i, column in enumerate(design_matrices.columns)])
  51. contrasts = {
  52. 'SO_spindle': basic_contrasts['SO_spindle'],
  53. 'SP_main': basic_contrasts['SP_main'],
  54. 'SO_main': basic_contrasts['SO_main'],
  55. }
  56. return contrasts
  57. def set_contrasts_SOSP_inter_PPI(design_matrices):
  58. contrast_matrix = np.eye(design_matrices.shape[1])
  59. basic_contrasts = dict([(column, contrast_matrix[i]) for i, column in enumerate(design_matrices.columns)])
  60. contrasts = {
  61. 'SO_spindle': basic_contrasts['SO_spindle'],
  62. 'SP_main': basic_contrasts['SP_main'],
  63. 'SO_main': basic_contrasts['SO_main'],
  64. 'Hippo_FC': basic_contrasts['hippo_ts'],
  65. 'Hippo_PPI': basic_contrasts['SOSP*seed'],
  66. }
  67. return contrasts
  68. def first_level_glm(datasink, run_imgs, design_matrices, mask_img, PPI):
  69. T1 = time.perf_counter()
  70. fmri_glm = FirstLevelModel(t_r=2.0, slice_time_ref=0.5, hrf_model='spm',
  71. drift_model='cosine', high_pass=0.01,
  72. mask_img=mask_img[0], smoothing_fwhm=8,
  73. verbose=1, n_jobs=-1)
  74. fmri_glm = fmri_glm.fit(run_imgs, design_matrices=design_matrices)
  75. T2 = time.perf_counter()
  76. print('run_glm:%s\n' % (T2 - T1))
  77. # TODO
  78. if PPI == 1:
  79. contrasts = set_contrasts_SOSP_inter_PPI(design_matrices[0])
  80. else:
  81. contrasts = set_contrasts_SOSP_inter(design_matrices[0])
  82. run_path = datasink
  83. os.makedirs(run_path, exist_ok=True)
  84. print('Computing contrasts...')
  85. for index, (contrast_id, contrast_val) in enumerate(contrasts.items()):
  86. print('Contrast % 2i out of %i: %s' % (index + 1, len(contrasts), contrast_id))
  87. stats_map = fmri_glm.compute_contrast(contrast_val, output_type='all')
  88. c_map = stats_map['effect_size']
  89. z_map = stats_map['z_score']
  90. c_image_path = join(run_path, '%s_cmap.nii.gz' % contrast_id)
  91. c_map.to_filename(c_image_path)
  92. z_image_path = join(run_path, '%s_zmap.nii.gz' % contrast_id)
  93. z_map.to_filename(z_image_path)
  94. def run(subj, out, PPI):
  95. print("-------{} start!--------".format(subj))
  96. data_sink_path = out
  97. data_sink = data_sink_path + '{}/sub-{}'.format(configs['task'], subj)
  98. if os.path.exists(data_sink): return
  99. functional_imgs, design_matrices, mask_imgs = prepare_data(subj, configs)
  100. if functional_imgs is None or len(functional_imgs) == 0: return
  101. # try:
  102. first_level_glm(data_sink, functional_imgs, design_matrices, mask_imgs, PPI)
  103. # except:
  104. # raise 'sub{} error!'.format(subj)
  105. parser = argparse.ArgumentParser()
  106. parser.add_argument("--para", type=str, help="para_path")
  107. parser.add_argument("--PPI", type=int, help="is PPI?")
  108. args = parser.parse_args()
  109. para = args.para
  110. PPI = args.PPI
  111. mri_code_path = '/home/wht/data/PKU_all/code/2.3_mri_result/'
  112. contrasts_list_SOSP_inter = 'SO_spindle,SP_main,SO_main'
  113. contrasts_list_SOSP_inter_PPI = 'SO_spindle,SP_main,SO_main,Hippo_FC,Hippo_PPI' #,SO_PPI,SP_PPI'
  114. if PPI == 1:
  115. event_dir = '{}2.2.2_behavior_SO_base_PPI'.format(para)
  116. else:
  117. event_dir = '{}2.2.1_behavior_SO_base'.format(para)
  118. assert os.path.exists(event_dir)
  119. configs = {'task': 'rest',
  120. 'func_dir': '/home/wht/data/PKU_all/2/1.2_Sleep_PKU_part_all_bids_mri/1.2.3_mri_preproc_out',
  121. 'event_dir': event_dir,
  122. 'func_name': 'sub-{}_task-rest_run-{}_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz',
  123. 'func_path': '/home/wht/data/PKU_all/2/1.2_Sleep_PKU_part_all_bids_mri/1.2.3_mri_preproc_out/sub-{}/func/sub-{}_task-rest_run-{}_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz',
  124. 'mask_path': '/home/wht/data/PKU_all/4/bids_redo/1.2.2.2_bids_ICA_out/tpl-MNI152NLin2009cAsym_res-02_desc-brain_mask.nii.gz',
  125. 'events_name': 'result.npz'}
  126. sub_list = glob.glob(configs['event_dir'] + '/sub*')
  127. subjects = [s.split('-')[-1] for s in sub_list]
  128. if PPI == 1:
  129. out_path = '{}3.1_mri_result_SO_base_PPI/'.format(para)
  130. else:
  131. out_path = '{}3.1_mri_result_SO_base/'.format(para)
  132. os.makedirs(out_path, exist_ok=True)
  133. Parallel(n_jobs=4)(delayed(run)(sub, out_path, PPI) for sub in subjects)
  134. # TODO
  135. if PPI == 1:
  136. cmd = "python '{}Second_level.py' --data_path {} --contrasts {}".format(mri_code_path, out_path, contrasts_list_SOSP_inter_PPI)
  137. else:
  138. cmd = "python '{}Second_level.py' --data_path {} --contrasts {}".format(mri_code_path, out_path, contrasts_list_SOSP_inter)
  139. os.system(cmd)
  140. cmd = "python '{}Correction_resample.py' --data_path {}".format(mri_code_path, out_path)
  141. os.system(cmd)

First_level_SO_base.py at commit 1b16df6, under MIT · at the source

Overview

  1. State Key Laboratory of Cognitive Neuroscience and Learning, IDG/McGovern Institute for Brain Research, Beijing Normal University, Beijing, China
  2. Chinese Institute for Brain Research, Beijing, China
  3. Center for MRI Research, Academy for Advanced Interdisciplinary Studies, Peking University, Beijing, China
  4. Beijing City Key Lab for Medical Physics and Engineering, Institute of Heavy Ion Physics, School of Physics, Peking University, Beijing, China
  5. McGovern Institute for Brain Research, Peking University, Beijing, China
Journal: eLife, volume 14, article RP103956
Dates: published online 12 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.103956 · PMID 42583934 · PMCID PMC13466540 · OpenAlex W4407641803
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), healthy (population), systems (subfield)
Methods: Spectral & time-frequency, Connectivity, Smoothing, state filtering, decompositions, Preprocessing, Evoked potentials, fMRI & imaging, Physiology & signal measures, Machine learning
Keywords: Human
MeSH: Brain*, Electroencephalography*, Magnetic Resonance Imaging*, Sleep Stages*, Brain Waves, Female, Healthy Volunteers, Hippocampus, Humans, Male, Nerve Net, Thalamus, Young Adult (* major topic)
Topic: Sleep and Wakefulness Research (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Beijing Municipal Science and Technology Commission, Adminitrative Commission of Zhongguancun Science Park (Z230010, L222033); National Science and Technology Innovation 2030 Major Program (2022ZD0205500); National Natural Science Foundation of China (32271093); Beijing United Imaging Research Institute of Intelligent Imaging Foundation (CRIBJZD202101)
Citations: not cited yet (Europe PMC); 85 references in the paper
Research resources: RRID:SCR_002823, 2009 RRID:SCR_008796

Abstract

During sleep, our brain undergoes highly synchronized activity, orchestrated by distinct neural rhythms. Little is known about the associated brain activation during these sleep rhythms, and even less about their functional implications. In this study, we investigated the brain-wide activation underlying human sleep rhythms by employing simultaneous electroencephalography and functional magnetic resonance imaging in 107 participants during nocturnal naps (first half of the night). We identified robust coupling between slow oscillations (SOs) and fast spindles during deep non-rapid eye movement sleep (N2/3 stages), with spindle peaks consistently occurring just before the SO UP-state. This SO-spindle coupling was linked to elevated activation in both the thalamus and hippocampus, alongside increased functional connectivity from the hippocampus to the thalamus and from the thalamus to the medial prefrontal cortex. An open-ended cognitive state decoding analysis suggested that these activations may relate to episodic memory processes, yet were distinct from task-related networks. Together, these findings highlight the thalamus as a key coordinator of hippocampal–cortical communication during sleep and provide new insights into the mechanisms by which synchronized sleep rhythms may support memory consolidation.

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.

liu_lab/eeg-fmri-sleep

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 1b16df6943d77837bb07093f0b812d3f6f92c40e, 28 July 2026
Languages: Python (3)
Size: 10 files, 3 scripts
Software Heritage: archived
Found in: “Data availability”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Nilearn (3 files), NiBabel (2 files), NumPy (2 files), pandas (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
5 files

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;
  • 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

Datasets cited

Data availability

The processed data are publicly available at https://doi.org/10.5061/dryad.2fqz612x0. Raw data can be requested from the corresponding author Y.L, and J.G, pending scientific review and a completed material transfer agreement due to privacy considerations. The study-specific analysis code is publicly available at https://gitlab.com/liu_lab/eeg-fmri-sleep (copy archived at Wang, 2026).

The following dataset was generated:

Haiteng W, Qihong Z, Jinbo Z, Jia-Hong G, Yunzhe L. 2026. Data from: Human brain-wide activation of sleep rhythms. Dryad Digital Repository.

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

Recorded: type, language, journal, volume, pages, dates, 5 authors, 1 keyword, 13 MeSH terms, 4 funders, 84 references, 2 RRIDs.

Cite

This paper

Wang, H., Zou, Q., Zhang, J., Gao, J.-H., & Liu, Y. (2026). Human brain-wide activation of sleep rhythms. eLife, 14, RP103956. https://doi.org/10.7554/elife.103956

BibTeX

@article{wang2026human,
author = {Wang, Haiteng and Zou, Qihong and Zhang, Jinbo and Gao, Jia-Hong and Liu, Yunzhe},
title = {{Human brain-wide activation of sleep rhythms}},
journal = {eLife},
year = {2026},
month = aug,
volume = {14},
pages = {RP103956},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.103956},
url = {https://doi.org/10.7554/elife.103956},
pmid = {42583934},
pmcid = {PMC13466540}
}

RIS

TY - JOUR
AU - Wang, Haiteng
AU - Zou, Qihong
AU - Zhang, Jinbo
AU - Gao, Jia-Hong
AU - Liu, Yunzhe
TI - Human brain-wide activation of sleep rhythms
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/08/12
VL - 14
SP - RP103956
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.103956
UR - https://doi.org/10.7554/elife.103956
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.103956",
"type": "article-journal",
"title": "Human brain-wide activation of sleep rhythms",
"container-title": "eLife",
"author": [
{
"family": "Wang",
"given": "Haiteng"
},
{
"family": "Zou",
"given": "Qihong"
},
{
"family": "Zhang",
"given": "Jinbo"
},
{
"family": "Gao",
"given": "Jia-Hong"
},
{
"family": "Liu",
"given": "Yunzhe"
}
],
"container-title-short": "Elife",
"volume": "14",
"page": "RP103956",
"DOI": "10.7554/elife.103956",
"PMID": "42583934",
"PMCID": "PMC13466540",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.103956",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
12
]
]
}
}

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.1371/journal.pbio.3003755 [code]
Action information is integrated into entorhinal representations of conceptual space and is reflected in eye movements.
Journal: PLoS biology
In common: Nilearn, NiBabel, pandas, 1 other tool, 16 references
[2] doi:10.1523/eneuro.0370-25.2026 [code]
Pretraining for Large-Scale Functional Connectome Fingerprinting Supports Generalization and Transfer Learning in Functional Neuroimaging.
Journal: eNeuro
In common: Nilearn, pandas, NumPy, 13 references
[3] doi:10.1038/s41467-025-63281-w [code]
Trait anxiety is associated with reduced reward-related replay at rest
Journal: n/a
In common: EEG, 3 references, 2 authors
[4] doi:10.1371/journal.pbio.3003684 [code]
The retrieval of previously learned motor memories is facilitated by the reinstatement of default mode network manifold structures.
Journal: PLoS biology
In common: Nilearn, NiBabel, pandas, 1 other tool, 11 references
[5] doi:10.7554/elife.108023 [code]
Challenges in replay detection by TDLM in post-encoding resting state.
Journal: eLife
In common: pandas, NumPy, 10 references
[6] doi:10.1038/s41467-026-71428-6 [code]
Binding items to contexts through conjunctive neural representations with the method of loci.
Journal: Nature communications
In common: Nilearn, NiBabel, pandas, 1 other tool, systems, 10 references
[7] doi:10.7554/elife.107955
Multiple event segmentation mechanisms in the human brain.
Journal: eLife
In common: 14 references
[8] doi:10.1162/imag.a.1272 [code]
Building bridges between brain and behavior: An open-source toolbox for joint modeling with fMRI.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: 13 references
[9] doi:10.1038/s42003-026-09988-y
Thalamic involvement defines distinct slow-wave subtypes in NREM sleep.
Journal: Communications biology
In common: EEG, 9 references
[10] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: Nilearn, NiBabel, pandas, 1 other tool, 8 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.