adam2392 / sickkids

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Neural Fragility of the Intracranial EEG Network Decreases after Surgical Resection of the Epileptogenic Zone

This repository houses code relevant for the publication at:

Data Organization

Data should be organized in the BIDS-iEEG format:

https://github.com/bids-standard/bids-specification/blob/master/src/04-modality-specific-files/04-intracranial-electroencephalography.md

This repo will be used as a light-weight script to be used to convert files from the SickKids dataset into the BIDS-compliant layout with BrainVision data format (.vhdr, .vmrk, .eeg). The script is in sickkids/bids/scripts/.

In order to run the script, minimally, the file needs certain BIDS entities defined:

  • subject (user defined)
  • session (user defined)
  • task (ictal or interictal)
  • acquisition (eeg, ecog, seeg)
  • run (01 starts)
  • datatype (eeg, or ieeg)

The Hospital For Sick Children Dataset

Additional data components (from sourcedata):

1. data_collection_irb_eztrack_v4.xlsx
    A layout of electrodes by contact number denoting white matter (WM), outside brain (OUT), csf (CSF), ventricle (ventricle), or other bad contacts.

2. <subject_ID>.mat
    A mat file for each subject recordings and some metadata. Please see README of dataset to fully understand how to use this.

Installation Guide

You can set this up via pipenv. First install pipenv using your favorite package manager (either with pip install, or conda install).

Then run:

# install all libs + development libraries
pipenv install --dev

# if dev versions of mne tools are needed
pipenv install https://api.github.com/repos/mne-tools/mne-bids/zipball/master --dev
pipenv install https://api.github.com/repos/mne-tools/mne-python/zipball/master --dev

If you are updating packages, make sure that you discuss updating the Pipfile. Then generate a new lock file by running:

# generates a new lock file
pipenv lock

# if there is a pre-stable release dependency
pipenv lock --pre

Study Organization

To perform the study, we first took datasets and converted to a standard BIDS-compliant dataset. Our focus was the i) sickkids dataset, ii) the TVB simulation dataset and iii) the openneuro dataset.

First, one can use dataset/pull_openneuro.py to pull openneuro data, or just go to the website and download dataset ds003400.

Second, one can run the bids/scripts/run_bids_conversion.py scripts to convert to BIDS. Note, that you might need to modify some parameters to specify which dataset you are converting. In bids/, there are files that specify the BIDS metadata to help formulate the dataset.

Third, one can run analyses on the datasets. One can run fragility/, or tfr/ for neural fragility, or time-frequency representation analyses, respectively.

Fourth, one can run TVB simulation using the tvb/ scripts.

Finally, posthoc/ contains scripts to help generate statistical and quantitative analyses.

Figures and Jupyter Notebooks

To reproduce the main figures of the analyses, we recommend taking a look at the jupyter notebooks. Namely, inside notebooks/publication.

Setup Jupyter Kernel To Test

You need to install ipykernel to expose your conda environment to jupyter notebooks.

pipenv run python -m ipykernel install --name sickkids --user
# now you can run jupyter lab and select a kernel
jupyter lab

Jupyter extension for auto-formatting:

About


Languages

Language:Jupyter Notebook 99.7%Language:Python 0.3%Language:Makefile 0.0%