Working memory in healthy and schizophrenic individuals: sample notebook

A worked notebook for Working memory in healthy and schizophrenic individuals, with 4 code cells and the output each one printed. On Scigantic it opens in a hosted JupyterLab with the dataset already mounted, so nothing is downloaded first.

Provider
Grega Repovš
License
CC0
Size
700 files, 8.5 GB
Stored at
Amazon S3, s3://openneuro.org/ds000115 (us-east-1)
Access
Free and public. No account with the data provider is needed.

The notebook

Working-memory fMRI — does the frontoparietal signature replicate across cohorts?

Reproducibility has been the headline topic in neuroimaging since 2020. Cross-cohort validation is the gold-standard answer but usually means downloading hundreds of GB and writing an fMRIPrep wrapper. Two BIDS-compliant OpenNeuro datasets, mounted side-by-side, collapse it.

Where the data lives

CohortPathSubjectsTask
ds000115 — Working memory in healthy & schizophrenic individuals/mnt/archive/102n-back fMRI
AOMIC-PIOP1 (ds002785)~/additional-datasets/aomic-piop1/216 healthy adultsWorking memory + others

Both follow the BIDS spec. Each has dataset_description.json, participants.tsv, and sub-* subject directories with anatomical + functional NIfTI files.

The cells below confirm the mounts and surface a few BIDS landmarks. The actual cross-cohort GLM is a chat-driven analysis — see the suggested prompt at the bottom.

import os, json
from pathlib import Path

primary_mount = Path(os.environ.get('SCIGANTIC_MOUNT_PATH', '/mnt/archive'))
additional = Path('~/additional-datasets').expanduser()

print(f'Primary archive (ds000115):  {primary_mount}')
print(f'Additional mounts dir:       {additional}')
if additional.exists():
    for p in sorted(additional.iterdir()):
        print(f'  - {p.name}/')

Output:

Primary archive (ds000115):  /mnt/archive
Additional mounts dir:       /home/jovyan/additional-datasets
  - openneuro.org-ds002785/

ds000115 dataset description

Read the canonical BIDS metadata and count subjects:

desc_path = primary_mount / 'dataset_description.json'
if desc_path.exists():
    print(json.dumps(json.loads(desc_path.read_text()), indent=2))
subs = sorted(p.name for p in primary_mount.glob('sub-*') if p.is_dir())
print(f'\n{len(subs)} subjects, first 5: {subs[:5]}')

Output:

{
  "BIDSVersion": "1.0.0",
  "Name": "Working memory in healthy and schizophrenic individuals",
  "Authors": [
    "Grega Repov\u00c5\u00a1",
    "Deanna M. Barch"
  ],
  "ReferencesAndLinks": [
    "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3358772/"
  ]
}

99 subjects, first 5: ['sub-01', 'sub-02', 'sub-03', 'sub-04', 'sub-05']

AOMIC-PIOP1 (ds002785) dataset description

Same shape, second cohort:

aomic = additional / 'aomic-piop1'
desc_path = aomic / 'dataset_description.json'
if desc_path.exists():
    print(json.dumps(json.loads(desc_path.read_text()), indent=2))
elif aomic.exists():
    print('No dataset_description.json at the AOMIC root yet — listing:')
    for p in sorted(aomic.iterdir())[:8]:
        print(f'  {p.name}')
else:
    print('AOMIC-PIOP1 not yet mounted — give the cross-mount a few seconds to attach.')

Output:

AOMIC-PIOP1 not yet mounted — give the cross-mount a few seconds to attach.

A real subject's brain

Pull the first subject's structural T1 from ds000115 and plot the canonical three-view anatomical with Nilearn (pre-installed in this image). This is the kind of QC plot every fMRIPrep run starts with.

from io import BytesIO
from IPython.display import Image, display
from nilearn import plotting
import matplotlib.pyplot as plt

t1 = next(
    iter(sorted(primary_mount.glob('sub-*/anat/*_T1w.nii*'))),
    None,
)
if t1 is None:
    print('No T1 anatomical found yet under', primary_mount)
else:
    subject = t1.parts[-3]  # sub-XX
    fig = plt.figure(figsize=(7, 3.2))
    plotting.plot_anat(
        str(t1),
        title=f'ds000115 — {subject} structural T1',
        display_mode='ortho',
        cut_coords=(0, 0, 0),
        figure=fig,
    )
    buf = BytesIO()
    fig.savefig(buf, format='jpeg', dpi=85, bbox_inches='tight',
                pil_kwargs={'quality': 80, 'optimize': True}, facecolor='black')
    plt.close(fig)
    display(Image(data=buf.getvalue()))

Try this in the AI assistant →

The chat panel on the right is already prefilled with:

> Plot a brain activation map for one subject's working-memory task in ds000115.

Press Enter and watch it run a real GLM and show the brain.

Other fun things to try:

Run it

Open this notebook to run it, see the dataset page for the full description, or browse the full catalog.