|
| 1 | +# A `fMRIPrep` example for BIDS-Prov |
| 2 | + |
| 3 | +This example aims at showing provenance traces for the [fMRIPrep](https://fmriprep.org/en/23.1.3/index.html) preprocessing software on a Linux-based (Fedora) operating system. |
| 4 | + |
| 5 | +## `fMRIPrep` installation |
| 6 | + |
| 7 | +```shell |
| 8 | +pip install fmriprep-docker==1.1.4 |
| 9 | + |
| 10 | +docker pull poldracklab/fmriprep:1.1.4 |
| 11 | + |
| 12 | +mkdir derivatives/ |
| 13 | +``` |
| 14 | + |
| 15 | +Launching `fMRIPrep` on one subject. |
| 16 | + |
| 17 | +```shell |
| 18 | +fmriprep-docker --participant-label=001 --fs-license-file=soft/freesurfer/license.txt -w=data/ds001734_fmriprep/work/ dev/BEP028_BIDSprov/examples/fmriprep/ds001734/ data/ds001734_fmriprep/ participant |
| 19 | +``` |
| 20 | + |
| 21 | +## Source dataset |
| 22 | + |
| 23 | +We use the dataset from https://openneuro.org/datasets/ds001734/versions/1.0.5, containing raw and preprocessed fMRI data of two versions of the mixed gambles task, from the Neuroimaging Analysis Replication and Prediction Study (NARPS). |
| 24 | + |
| 25 | +```shell |
| 26 | +datalad install https://github.com/OpenNeuroDatasets/ds001734.git |
| 27 | + |
| 28 | +git submodule add https://github.com/OpenNeuroDatasets/ds001734.git examples/fmriprep/ds001734 |
| 29 | + |
| 30 | +datalad get sub-001/* |
| 31 | +``` |
| 32 | + |
| 33 | +## Associated provenance |
| 34 | + |
| 35 | +In order to describe provenance records using BIDS Prov, we use: |
| 36 | + |
| 37 | +* modality agnostic files inside the `prov/` directory |
| 38 | +* subject / modality level provenance files |
1 | 39 |
|
2 | 40 | ``` |
3 | 41 | . |
4 | 42 | ├── code |
5 | | -│ └── merge_prov.py |
| 43 | +│ └── merge_prov.py |
6 | 44 | ├── prov |
7 | | -│ ├── merged |
8 | | -│ │ ├── prov-fmriprep.prov.jsonld |
9 | | -│ │ └── prov-fmriprep.prov.png |
10 | | -│ ├── prov-fmriprep_base.prov.json |
11 | | -│ ├── prov-fmriprep_ent.prov.json |
12 | | -│ ├── prov-fmriprep_env.prov.json |
13 | | -│ └── prov-fmriprep_soft.prov.json |
| 45 | +│ ├── merged |
| 46 | +│ │ ├── prov-fmriprep.prov.jsonld |
| 47 | +│ │ └── prov-fmriprep.prov.png |
| 48 | +│ ├── prov-fmriprep_base.prov.json |
| 49 | +│ ├── prov-fmriprep_ent.prov.json |
| 50 | +│ ├── prov-fmriprep_env.prov.json |
| 51 | +│ └── prov-fmriprep_soft.prov.json |
14 | 52 | └── sub-001 |
15 | 53 | ├── anat |
16 | | - │ ├── sub-001_T1w_prov-fmriprep_act.prov.json |
17 | | - │ └── sub-001_T1w_prov-fmriprep_ent.prov.json |
| 54 | + │ ├── sub-001_T1w_prov-fmriprep_act.prov.json |
| 55 | + │ └── sub-001_T1w_prov-fmriprep_ent.prov.json |
18 | 56 | └── func |
19 | 57 | ├── sub-001_task-MGT_bold_prov-fmriprep_act.prov.json |
20 | 58 | └── sub-001_task-MGT_bold_prov-fmriprep_ent.prov.json |
21 | 59 | ``` |
| 60 | + |
| 61 | +## New features for BIDS / BIDS Prov |
| 62 | + |
| 63 | +We introduce the following BIDS entity that is currently not existing: |
| 64 | + |
| 65 | +* `prov` |
| 66 | + * Full name: Provenance traces |
| 67 | + * Format: `prov-<label>` |
| 68 | + * Definition: A grouping of provenance traces. Defining multiple provenance traces groups is appropriate when several processings have been performed on data. |
| 69 | + |
| 70 | +We introduce the following BIDS suffixes that are currently not existing: |
| 71 | + |
| 72 | +* `act`: the file describes BIDS Prov Activities for the group of provenance traces |
| 73 | +* `soft`: the file describes BIDS Prov Software for the group of provenance traces |
| 74 | +* `env`: the file describes BIDS Prov Environments for the group of provenance traces |
| 75 | +* `ent`: the file describes BIDS Prov Entities for the group of provenance traces |
| 76 | +* `base`: the file describes common BIDS Prov parameters for the group of provenance traces (version and context for BIDS Prov) |
| 77 | + |
| 78 | +## Merging JSON in a JSON-LD file and plotting graph |
| 79 | + |
| 80 | +The python script `code/merge_prov.py` aims at merging all these provenance records into one JSON-LD graph. |
| 81 | + |
| 82 | +```shell |
| 83 | +mkdir prov/merged/ |
| 84 | +python code/merge_prov.py |
| 85 | +``` |
| 86 | + |
| 87 | +From that, we generate the JSON-LD graph `prov/merge/prov-fmriprep.prov.jsonld`. Then we were able to plot the graph as a png file. We used this command: |
| 88 | + |
| 89 | +```shell |
| 90 | +pip install bids-prov==0.1.0 |
| 91 | +bids_prov_visualizer --input_file prov/merged/prov-fmriprep.prov.jsonld --output_file prov/merged/prov-fmriprep.prov.png |
| 92 | +``` |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +### Notes |
| 97 | + |
| 98 | +In this example, we rely on the fact that nodes defined in the `prov/*.prov.jsonld` files have `bids::prov/` as base IRIs. |
| 99 | + |
| 100 | +### Limitations |
0 commit comments