From d8e82f4d04c31fbcb452b78f2592d6d10a1feb55 Mon Sep 17 00:00:00 2001 From: "omar.elrifai" Date: Tue, 9 Nov 2021 14:37:46 +0100 Subject: [PATCH 1/5] Add Clinica example --- examples/clinica_pipelines/readme.md | 21 +++++++++ .../clinica_pipelines/t1linear_mat.jsonld | 44 +++++++++++++++++++ .../clinica_pipelines/t1linear_nii.jsonld | 44 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 examples/clinica_pipelines/readme.md create mode 100644 examples/clinica_pipelines/t1linear_mat.jsonld create mode 100644 examples/clinica_pipelines/t1linear_nii.jsonld diff --git a/examples/clinica_pipelines/readme.md b/examples/clinica_pipelines/readme.md new file mode 100644 index 000000000..1daf26b2a --- /dev/null +++ b/examples/clinica_pipelines/readme.md @@ -0,0 +1,21 @@ +## 2-step workflow using Clinica (https://github.com/aramis-lab/clinica) + +--- + +### Workflow + +
+ +
+ +--- + +### Generate a graph + +from the root of this project + +```bash +python bids_prov/visualize.py examples/clinica_pipelines/adni-to-bids.json examples/clinica_pipelines/t1linear-mat.json examples/clinica_pipelines/t1linear-nii.json -o clinica_pipelines.png +``` + +generates the graph illustrating the provenance of files related to two Clinica pipelines (adni-to-bids and t1-linear) diff --git a/examples/clinica_pipelines/t1linear_mat.jsonld b/examples/clinica_pipelines/t1linear_mat.jsonld new file mode 100644 index 000000000..5b1930bc2 --- /dev/null +++ b/examples/clinica_pipelines/t1linear_mat.jsonld @@ -0,0 +1,44 @@ +{ + "@context": "https://raw.githubusercontent.com/omar-rifai/Provenance/main/context.json", + "records":{ + "prov:Agent" : [{ + "@id": "RRID:Clinica", + "@type": "prov:SoftwareAgent", + "label": "Clinica" + }], + "prov:Activity": [ + { + "@id": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13", + "label": "t1-linear", + "command": [ + [ + "run", + "t1-linear", + "/path/to/bids", + "ws/CAPS_t1linear", + "-np", + "4", + "-tsv", + "subjects.tsv", + "-ui" + ] + ], + "parameters": { + "uncropped_image": true + }, + "wasAssociatedWith": "RRID:Clinica", + "used": [ + "uuid:6cada670-8bf2-44ef-80ae-71796eb5ecd7" + ] + } + ], + "prov:Entity": [ + { + "@id": "uuid:696a079c-3618-4e0d-87aa-b60965c86127", + "label": "sub-ADN..-MNI152NLin2009cSym_res-1x1x1_affine.mat", + "wasGeneratedBy": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13" + } + + ] + } +} diff --git a/examples/clinica_pipelines/t1linear_nii.jsonld b/examples/clinica_pipelines/t1linear_nii.jsonld new file mode 100644 index 000000000..6c06ed0ee --- /dev/null +++ b/examples/clinica_pipelines/t1linear_nii.jsonld @@ -0,0 +1,44 @@ +{ + "@context": "https://raw.githubusercontent.com/omar-rifai/Provenance/main/context.json", + "records":{ + "prov:Agent" : [{ + "@id": "RRID:Clinica", + "@type": "prov:SoftwareAgent", + "label": "Clinica" + }], + "prov:Activity": [ + { + "@id": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13", + "label": "t1-linear", + "command": [ + [ + "run", + "t1-linear", + "/path/to/bids", + "ws/CAPS_t1linear", + "-np", + "4", + "-tsv", + "subjects.tsv", + "-ui" + ] + ], + "parameters": { + "uncropped_image": true + }, + "wasAssociatedWith": "RRID:Clinica", + "used": [ + "uuid:6cada670-8bf2-44ef-80ae-71796eb5ecd7" + ] + } + ], + "prov:Entity": [ + { + "@id": "uuid:5ebd15a4-0051-46e1-ada0-d718f39b2e2c", + "label": "sub-ADN..-MNI152NLin2009cSym_res-1x1x1_affine.nii", + "wasGeneratedBy": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13" + } + + ] + } +} From af534c89f1b502d91395dbce91d4da4dc5d653cd Mon Sep 17 00:00:00 2001 From: "omar.elrifai" Date: Tue, 9 Nov 2021 14:38:10 +0100 Subject: [PATCH 2/5] Update with adni-to-bids --- .../clinica_pipelines/adni-to-bids.jsonld | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/clinica_pipelines/adni-to-bids.jsonld diff --git a/examples/clinica_pipelines/adni-to-bids.jsonld b/examples/clinica_pipelines/adni-to-bids.jsonld new file mode 100644 index 000000000..815aeaa0e --- /dev/null +++ b/examples/clinica_pipelines/adni-to-bids.jsonld @@ -0,0 +1,39 @@ +{ + "@context": "https://raw.githubusercontent.com/omar-rifai/Provenance/main/context.json", + "records": { + "prov:Agent": [ + { + "@id": "RRID:Clinica", + "@type": "prov:SoftwareAgent", + "label": "Clinica" + } + ], + "prov:Activity": [ + { + "@id": "uuid:38133b39-f2fe-4746-aa3c-e3eca1b8abb4", + "label": "adni-to-bids", + "command": "clinica convert adni-to-bids src clinical_data bids ", + "parameters": { + "src": "/path/adni_dir", + "clinical_data": "/path/clinical/data/", + "bids": "/path/to/bids" + }, + "wasAssociatedWith": "RRID:Clinica", + "used": "uuid:0c18a16e-11e9-42cf-b004-019bc6aaa76b" + } + ], + "prov:Entity": [ + { + "@id": "uuid:0c18a16e-11e9-42cf-b004-019bc6aaa76b", + "label": "Dicom 022_S_0004", + "prov:atLocation": "/path/to/adni/data/raw/" + }, + { + "@id": "uuid:6cada670-8bf2-44ef-80ae-71796eb5ecd7", + "label": "sub-ADNI022S0004_ses-M00_T1w.nii.gz", + "atLocation": "/path/to/bids/sub-ADNI022S0004/ses-M00/anat/sub-ADNI022S0004_ses-M00_T1w.nii.gz", + "wasGeneratedBy": "uuid:38133b39-f2fe-4746-aa3c-e3eca1b8abb4" + } + ] + } +} \ No newline at end of file From dc9de438cb99227d5e640512785d9d3dd1390d27 Mon Sep 17 00:00:00 2001 From: "omar.elrifai" Date: Tue, 9 Nov 2021 14:54:30 +0100 Subject: [PATCH 3/5] Update with generated graph From 1ceaae09259adbea8527665c0a6b3d857d4fc998 Mon Sep 17 00:00:00 2001 From: "omar.elrifai" Date: Mon, 7 Mar 2022 10:58:29 +0100 Subject: [PATCH 4/5] Update example with new usage of command --- examples/clinica_pipelines/adni-to-bids.jsonld | 7 +------ examples/clinica_pipelines/readme.md | 2 +- examples/clinica_pipelines/t1linear_mat.jsonld | 14 +------------- examples/clinica_pipelines/t1linear_nii.jsonld | 14 +------------- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/examples/clinica_pipelines/adni-to-bids.jsonld b/examples/clinica_pipelines/adni-to-bids.jsonld index 815aeaa0e..a2ce64503 100644 --- a/examples/clinica_pipelines/adni-to-bids.jsonld +++ b/examples/clinica_pipelines/adni-to-bids.jsonld @@ -12,12 +12,7 @@ { "@id": "uuid:38133b39-f2fe-4746-aa3c-e3eca1b8abb4", "label": "adni-to-bids", - "command": "clinica convert adni-to-bids src clinical_data bids ", - "parameters": { - "src": "/path/adni_dir", - "clinical_data": "/path/clinical/data/", - "bids": "/path/to/bids" - }, + "command": "clinica convert adni-to-bids path/to/adni/raw path/to/clinical_data path/to/bids", "wasAssociatedWith": "RRID:Clinica", "used": "uuid:0c18a16e-11e9-42cf-b004-019bc6aaa76b" } diff --git a/examples/clinica_pipelines/readme.md b/examples/clinica_pipelines/readme.md index 1daf26b2a..f89639866 100644 --- a/examples/clinica_pipelines/readme.md +++ b/examples/clinica_pipelines/readme.md @@ -15,7 +15,7 @@ from the root of this project ```bash -python bids_prov/visualize.py examples/clinica_pipelines/adni-to-bids.json examples/clinica_pipelines/t1linear-mat.json examples/clinica_pipelines/t1linear-nii.json -o clinica_pipelines.png +python bids_prov/visualize.py examples/clinica_pipelines/adni-to-bids.jsonld examples/clinica_pipelines/t1linear_mat.jsonld examples/clinica_pipelines/t1linear_nii.jsonld -o clinica_pipelines.png ``` generates the graph illustrating the provenance of files related to two Clinica pipelines (adni-to-bids and t1-linear) diff --git a/examples/clinica_pipelines/t1linear_mat.jsonld b/examples/clinica_pipelines/t1linear_mat.jsonld index 5b1930bc2..547ba904b 100644 --- a/examples/clinica_pipelines/t1linear_mat.jsonld +++ b/examples/clinica_pipelines/t1linear_mat.jsonld @@ -10,19 +10,7 @@ { "@id": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13", "label": "t1-linear", - "command": [ - [ - "run", - "t1-linear", - "/path/to/bids", - "ws/CAPS_t1linear", - "-np", - "4", - "-tsv", - "subjects.tsv", - "-ui" - ] - ], + "command": "run t1-linear /path/to/bids ws/CAPS_t1linear -np 4 -tsv subjects.tsv -ui", "parameters": { "uncropped_image": true }, diff --git a/examples/clinica_pipelines/t1linear_nii.jsonld b/examples/clinica_pipelines/t1linear_nii.jsonld index 6c06ed0ee..0e88fb65e 100644 --- a/examples/clinica_pipelines/t1linear_nii.jsonld +++ b/examples/clinica_pipelines/t1linear_nii.jsonld @@ -10,19 +10,7 @@ { "@id": "uuid:2c2964f2-f865-41cc-a4e9-5d4f4ecaec13", "label": "t1-linear", - "command": [ - [ - "run", - "t1-linear", - "/path/to/bids", - "ws/CAPS_t1linear", - "-np", - "4", - "-tsv", - "subjects.tsv", - "-ui" - ] - ], + "command": "clinica run t1-linear /path/to/bids ws/CAPS_t1linear -np 4 -tsv subjects.tsv -ui", "parameters": { "uncropped_image": true }, From 048d7a5e69240820e52891b09d719056e130cc3e Mon Sep 17 00:00:00 2001 From: "omar.elrifai" Date: Tue, 19 Apr 2022 16:35:37 +0200 Subject: [PATCH 5/5] Update ID of Agent --- examples/clinica_pipelines/t1linear_mat.jsonld | 8 +++++--- examples/clinica_pipelines/t1linear_nii.jsonld | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/clinica_pipelines/t1linear_mat.jsonld b/examples/clinica_pipelines/t1linear_mat.jsonld index 547ba904b..a6f8b5806 100644 --- a/examples/clinica_pipelines/t1linear_mat.jsonld +++ b/examples/clinica_pipelines/t1linear_mat.jsonld @@ -2,9 +2,11 @@ "@context": "https://raw.githubusercontent.com/omar-rifai/Provenance/main/context.json", "records":{ "prov:Agent" : [{ - "@id": "RRID:Clinica", + "@id": "uuid:5da92f66-bfec-11ec-9d64-0242ac120002", + "RRID": "Clinica", "@type": "prov:SoftwareAgent", - "label": "Clinica" + "Label": "Clinica v0.6.0", + "Version": "v0.6.0" }], "prov:Activity": [ { @@ -14,7 +16,7 @@ "parameters": { "uncropped_image": true }, - "wasAssociatedWith": "RRID:Clinica", + "wasAssociatedWith": "uuid:5da92f66-bfec-11ec-9d64-0242ac120002", "used": [ "uuid:6cada670-8bf2-44ef-80ae-71796eb5ecd7" ] diff --git a/examples/clinica_pipelines/t1linear_nii.jsonld b/examples/clinica_pipelines/t1linear_nii.jsonld index 0e88fb65e..4a4795eff 100644 --- a/examples/clinica_pipelines/t1linear_nii.jsonld +++ b/examples/clinica_pipelines/t1linear_nii.jsonld @@ -2,9 +2,12 @@ "@context": "https://raw.githubusercontent.com/omar-rifai/Provenance/main/context.json", "records":{ "prov:Agent" : [{ - "@id": "RRID:Clinica", + + "@id": "uuid:5da92f66-bfec-11ec-9d64-0242ac120002", + "RRID": "Clinica", "@type": "prov:SoftwareAgent", - "label": "Clinica" + "Label": "Clinica v0.6.0", + "Version": "v0.6.0" }], "prov:Activity": [ { @@ -14,7 +17,7 @@ "parameters": { "uncropped_image": true }, - "wasAssociatedWith": "RRID:Clinica", + "wasAssociatedWith": "uuid:5da92f66-bfec-11ec-9d64-0242ac120002", "used": [ "uuid:6cada670-8bf2-44ef-80ae-71796eb5ecd7" ]