UCLA Consortium for Neuropsychiatric Phenomics LA5c Study: sample notebook

A worked notebook for UCLA Consortium for Neuropsychiatric Phenomics LA5c Study, with 7 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
Bilder, R
License
CC0
Size
9010 files, 79.3 GB
Stored at
Amazon S3, s3://openneuro.org/ds000030 (us-east-1)
Access
Free and public. No account with the data provider is needed.
DOI
10.18112/openneuro.ds000030.v1.0.0

The notebook

UCLA Consortium for Neuropsychiatric Phenomics — LA5c Study

The LA5c Study (OpenNeuro ds000030, Bilder et al.) is a large multimodal neuroimaging dataset that pairs structural MRI, resting-state and task fMRI, and diffusion MRI with extensive phenotyping across four groups: healthy controls, schizophrenia, bipolar disorder, and ADHD.

The archive follows the BIDS (Brain Imaging Data Structure) convention — every subject lives in a sub-XXXXX/ directory with anat/, func/, and dwi/ sub-folders, plus a root participants.tsv and dataset_description.json.

The bucket is FUSE-mounted read-only at /mnt/archive, so every S3 key is accessible as a local file path — pandas.read_csv, nibabel.load, pathlib.Path.iterdir all work without a download step.

import os
from pathlib import Path

mount_path = Path(os.environ.get('SCIGANTIC_MOUNT_PATH', '/mnt/archive'))
bucket = os.environ.get('SCIGANTIC_BUCKET_NAME', 'openneuro.org')
prefix = os.environ.get('SCIGANTIC_BUCKET_PREFIX', 'ds000030')

print(f'Archive:    UCLA Consortium for Neuropsychiatric Phenomics (LA5c)')
print(f'Source:     s3://{bucket}/{prefix}/')
print(f'FUSE mount: {mount_path}')

Output:

Archive:    UCLA Consortium for Neuropsychiatric Phenomics (LA5c)
Source:     s3://openneuro.org/ds000030/
FUSE mount: /mnt/archive

1. Participants breakdown

participants.tsv at the root holds subject-level phenotype columns — diagnosis, age, gender, handedness, and per-task QC flags. Read it with pandas and count how the cohort splits by diagnostic group.

import pandas as pd

participants = pd.read_csv(mount_path / 'participants.tsv', sep='\t')
print(f'Subjects: {len(participants)}')
print(f'Columns:  {list(participants.columns)[:10]}...')
print()
print('Diagnostic groups:')
print(participants['diagnosis'].value_counts().to_string())

Output:

Subjects: 272
Columns:  ['participant_id', 'diagnosis', 'age', 'gender', 'bart', 'bht', 'dwi', 'pamenc', 'pamret', 'rest']...

Diagnostic groups:
diagnosis
CONTROL    130
SCHZ        50
BIPOLAR     49
ADHD        43
# Age and gender split by diagnosis
summary = (
    participants
    .groupby('diagnosis')
    .agg(n=('participant_id', 'size'),
         age_mean=('age', 'mean'),
         age_std=('age', 'std'),
         pct_female=('gender', lambda s: (s == 'F').mean() * 100))
    .round(1)
)
summary

Output:

             n  age_mean  age_std  pct_female
diagnosis                                    
ADHD        43      33.1     10.8        51.2
BIPOLAR     49      35.3      9.0        42.9
CONTROL    130      31.3      8.7        47.7
SCHZ        50      36.5      8.9        24.0

2. Browse the BIDS structure

Pick one subject and walk their directory to see what modalities and runs are available. The FUSE mount exposes the hierarchy directly, so pathlib.Path.rglob works as if this were a local dataset.

# First healthy-control subject in the table.
control_id = participants.loc[participants['diagnosis'] == 'CONTROL', 'participant_id'].iloc[0]
subject_dir = mount_path / control_id

print(f'Subject: {control_id}')
print(f'Path:    {subject_dir}')
print()
for entry in sorted(subject_dir.iterdir()):
    kind = 'dir ' if entry.is_dir() else 'file'
    print(f'  {kind}  {entry.name}')

Output:

Subject: sub-10159
Path:    /mnt/archive/sub-10159

  dir   anat
  dir   beh
  dir   dwi
  dir   func
# Files inside the anat/ and func/ folders for this subject.
for mod in ['anat', 'func']:
    folder = subject_dir / mod
    if not folder.exists():
        continue
    print(f'=== {folder.name}/ ===')
    for f in sorted(folder.iterdir()):
        size_mb = f.stat().st_size / (1024 * 1024)
        print(f'  {f.name}  ({size_mb:.1f} MB)')
    print()

Output:

=== anat/ ===
  sub-10159_T1w.json  (0.0 MB)
  sub-10159_T1w.nii.gz  (11.1 MB)

=== func/ ===
  sub-10159_task-bart_bold.json  (0.0 MB)
  sub-10159_task-bart_bold.nii.gz  (40.1 MB)
  sub-10159_task-bart_events.tsv  (0.0 MB)
  sub-10159_task-rest_bold.json  (0.0 MB)
  sub-10159_task-rest_bold.nii.gz  (22.9 MB)
  sub-10159_task-scap_bold.json  (0.0 MB)
  sub-10159_task-scap_bold.nii.gz  (43.7 MB)
  sub-10159_task-scap_events.tsv  (0.0 MB)
  sub-10159_task-stopsignal_bold.json  (0.0 MB)
  sub-10159_task-stopsignal_bold.nii.gz  (27.6 MB)
...

3. Visualize the T1-weighted anatomical scan

Load the subject's T1 MRI with nibabel and show the three central cardinal slices (sagittal, coronal, axial). NIfTI files are just 3D (or 4D) arrays with an affine — .get_fdata() returns a NumPy array you can index directly.

import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt

t1_path = subject_dir / 'anat' / f'{control_id}_T1w.nii.gz'
print(f'Loading: {t1_path}')

img = nib.load(t1_path)
data = img.get_fdata()
print(f'Shape:  {data.shape}')
print(f'Voxels: {data.size:,}')
print(f'Affine:\n{np.round(img.affine, 3)}')

Output:

Loading: /mnt/archive/sub-10159/anat/sub-10159_T1w.nii.gz
Shape:  (176, 256, 256)
Voxels: 11,534,336
Affine:
[[   1.       0.       0.     -93.926]
 [   0.       1.       0.    -134.398]
 [   0.       0.       1.    -130.728]
 [   0.       0.       0.       1.   ]]
# Central slice in each cardinal plane.
sx, sy, sz = [d // 2 for d in data.shape]
fig, axes = plt.subplots(1, 3, figsize=(12, 4))

axes[0].imshow(np.rot90(data[sx, :, :]), cmap='gray')
axes[0].set_title(f'Sagittal (x={sx})')
axes[1].imshow(np.rot90(data[:, sy, :]), cmap='gray')
axes[1].set_title(f'Coronal (y={sy})')
axes[2].imshow(np.rot90(data[:, :, sz]), cmap='gray')
axes[2].set_title(f'Axial (z={sz})')

for ax in axes:
    ax.axis('off')
plt.suptitle(f'{control_id} — T1-weighted anatomical')
plt.tight_layout()
plt.show()

4. Where to go from here

Anything you write goes to your home directory (~) — the archive mount itself is read-only.

Run it

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