Skip to content

Commit

Permalink
Merge pull request #127 from yarikoptic/enh-used
Browse files Browse the repository at this point in the history
Make "Used" to contain only unique values and sort them
  • Loading branch information
cmaumet authored Sep 29, 2023
2 parents 44539af + df301be commit 07a4b25
Show file tree
Hide file tree
Showing 73 changed files with 15,826 additions and 15,835 deletions.
3 changes: 3 additions & 0 deletions bids_prov/afni/afni_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ def build_records(commands_bloc: list, agent_id: str, verbose: bool = False):
else:
activity["Used"].append(existing_input["@id"])

# Order does not matter and then makes sense to include only unique values
activity["Used"] = sorted(set(activity["Used"]))

for output_path in outputs:
records["Entities"].append(
{
Expand Down
3 changes: 3 additions & 0 deletions bids_prov/fsl/fsl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def build_records(groups: Mapping[str, List[str]], agent_id: str):
else:
a["Used"].append(existing_input["@id"])

# Order does not matter and then makes sense to include only unique values
a["Used"] = sorted(set(a["Used"]))

for output_path in outputs:
# output_name = output_path.replace("/", "_") # TODO
records["Entities"].append(
Expand Down
3 changes: 3 additions & 0 deletions bids_prov/spm/spm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ def get_records(task_groups: dict, agent_id: str, verbose=False) -> dict:
param_value = right_ if not right_.startswith("[") else right_.replace(" ", ", ")
params[param_name] = param_value # example : [4 2] becomes [4, 2]

# Order does not matter and then makes sense to include only unique values
activity["Used"] = sorted(set(activity["Used"]))

if params:
activity["Parameters"] = params

Expand Down
644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_alt_onesided_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_alt_onesided_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_bi_sided_t_test_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_bi_sided_t_test_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_clustconn_18_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_clustconn_18_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_clustconn_26_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_clustconn_26_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_con_f_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_con_f_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_default_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_default_proc_bloc.jsonld

Large diffs are not rendered by default.

628 changes: 314 additions & 314 deletions examples/from_parsers/afni/afni_gam_proc.jsonld

Large diffs are not rendered by default.

462 changes: 231 additions & 231 deletions examples/from_parsers/afni/afni_gam_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_hrf_gammadiff_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_hrf_gammadiff_proc_bloc.jsonld

Large diffs are not rendered by default.

632 changes: 316 additions & 316 deletions examples/from_parsers/afni/afni_hrf_tent_proc.jsonld

Large diffs are not rendered by default.

466 changes: 233 additions & 233 deletions examples/from_parsers/afni/afni_hrf_tent_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_other_template_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_other_template_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_thr_clustfwep05_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_thr_clustfwep05_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_thr_clustunck10_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_thr_clustunck10_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_thr_voxelfdrp05_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_thr_voxelfdrp05_proc_bloc.jsonld

Large diffs are not rendered by default.

644 changes: 322 additions & 322 deletions examples/from_parsers/afni/afni_thr_voxelunct4_proc.jsonld

Large diffs are not rendered by default.

474 changes: 237 additions & 237 deletions examples/from_parsers/afni/afni_thr_voxelunct4_proc_bloc.jsonld

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions examples/from_parsers/afni/narps_do_02_pc_with_sign0.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Records": {
"Software": [
{
"@id": "urn:a365a7e3-6f69-48f8-aca7-ae5d99434345",
"@id": "urn:b624270f-a3c2-46c6-a27c-89d37f792539",
"RRID": "RRID:SCR_007037",
"@type": "prov:SoftwareAgent",
"Label": "AFNI",
Expand All @@ -13,115 +13,115 @@
],
"Activities": [
{
"@id": "urn:b30cc606-6137-447b-b28e-0fae2ef7dd42",
"@id": "urn:90645147-6abd-4c8a-a8a5-517f8a8f21fe",
"Label": "3dpc",
"AssociatedWith": "urn:a365a7e3-6f69-48f8-aca7-ae5d99434345",
"AssociatedWith": "urn:b624270f-a3c2-46c6-a27c-89d37f792539",
"Command": "3dpc -overwrite -mask ${dset_mask} -pcsave 5 -prefix ${dir_hyp}/PC_hyp${num} ${grp_dset}",
"Parameters": {},
"Used": [
"urn:7479bb7e-54b2-47ea-98d2-43c51aeaa2a4",
"urn:e693c57c-65b6-445b-b9a2-bb2d67afd32b"
"urn:a68d7d7d-2892-4c73-8931-cb493bf3664b",
"urn:dcd9b6d5-0d6c-44a8-b2a4-20746f3bf451"
]
},
{
"@id": "urn:70d7cd80-32f6-4994-a4d4-c3fed4e02383",
"@id": "urn:3bbde2e2-3198-4f5e-a405-3dc2859a814d",
"Label": "3dresample",
"AssociatedWith": "urn:a365a7e3-6f69-48f8-aca7-ae5d99434345",
"AssociatedWith": "urn:b624270f-a3c2-46c6-a27c-89d37f792539",
"Command": "3dresample -overwrite -prefix tmp_REF_DSET.nii.gz -master ${dset_mask} -input \"${ref_dset}\"",
"Parameters": {},
"Used": [
"urn:af9b4299-4373-4423-8478-02481413a92c",
"urn:7479bb7e-54b2-47ea-98d2-43c51aeaa2a4"
"urn:b0e85dbd-3264-414a-aad3-bded58a631c6",
"urn:dcd9b6d5-0d6c-44a8-b2a4-20746f3bf451"
]
},
{
"@id": "urn:f0664c49-ddd6-4d24-a5ba-c6bbf6b11662",
"@id": "urn:31c67e59-a174-4acc-a9db-a84469c666cf",
"Label": "3dMatch",
"AssociatedWith": "urn:a365a7e3-6f69-48f8-aca7-ae5d99434345",
"AssociatedWith": "urn:b624270f-a3c2-46c6-a27c-89d37f792539",
"Command": "3dMatch -echo_edu -overwrite -mask ${dset_mask} -refset ${dir_hyp}/PC_hyp${num}+tlrc -inset tmp_REF_DSET.nii.gz -prefix tmp_MATCHED",
"Parameters": {},
"Used": [
"urn:8967c63f-5fc7-44a6-a350-10e4d91420e5",
"urn:b04ba5a4-7187-414c-bf95-ec135e792a53",
"urn:7479bb7e-54b2-47ea-98d2-43c51aeaa2a4"
"urn:0aff86a2-c424-420f-8105-3869a44750ba",
"urn:dcd9b6d5-0d6c-44a8-b2a4-20746f3bf451",
"urn:eaef0dcb-5236-4a45-9f31-8a11e2ed6b04"
]
},
{
"@id": "urn:b4cb0bba-46e0-4c70-b0ed-fc17fcc0c5d5",
"@id": "urn:e6b98c73-86e5-4eed-abdd-25d3eb6842f7",
"Label": "3dcalc",
"AssociatedWith": "urn:a365a7e3-6f69-48f8-aca7-ae5d99434345",
"AssociatedWith": "urn:b624270f-a3c2-46c6-a27c-89d37f792539",
"Command": "3dcalc -echo_edu -overwrite -a ${dir_hyp}/PC_hyp${num}+tlrc -expr \"${signum}*a\" -prefix ${dir_hyp}/PC_hyp${num}_sign0.nii.gz",
"Parameters": {},
"Used": [
"urn:b04ba5a4-7187-414c-bf95-ec135e792a53"
"urn:eaef0dcb-5236-4a45-9f31-8a11e2ed6b04"
]
}
],
"Entities": [
{
"@id": "urn:7479bb7e-54b2-47ea-98d2-43c51aeaa2a4",
"@id": "urn:dcd9b6d5-0d6c-44a8-b2a4-20746f3bf451",
"Label": "${dset_mask}",
"AtLocation": "${dset_mask}",
"digest": {
"sha256": "aad93a52efcf1938cc27b6cfe707fe2b1f74b1bd4b13217516525ff60fa0a2cd"
}
},
{
"@id": "urn:e693c57c-65b6-445b-b9a2-bb2d67afd32b",
"@id": "urn:a68d7d7d-2892-4c73-8931-cb493bf3664b",
"Label": "${grp_dset}",
"AtLocation": "${grp_dset}",
"digest": {
"sha256": "b1baa298b8599a501c11bb588cf53f5f808f115ea112431351bbf5c494bb9298"
}
},
{
"@id": "urn:7f8dcb20-fc81-454b-bfd1-236e9f7c0c4f",
"@id": "urn:1d44d844-c4ca-4840-9019-b9b7a5f712e2",
"Label": "PC_hyp${num}",
"AtLocation": "${dir_hyp}/PC_hyp${num}",
"GeneratedBy": "urn:b30cc606-6137-447b-b28e-0fae2ef7dd42",
"GeneratedBy": "urn:90645147-6abd-4c8a-a8a5-517f8a8f21fe",
"digest": {
"sha256": "915832134c7f76c64fd48179b53dfb05de128b50ef451380b440cff2ec1990fb"
}
},
{
"@id": "urn:af9b4299-4373-4423-8478-02481413a92c",
"@id": "urn:b0e85dbd-3264-414a-aad3-bded58a631c6",
"Label": "\"${ref_dset}\"",
"AtLocation": "\"${ref_dset}\"",
"digest": {
"sha256": "be3e8ce0897c76f6b02c76da87ee56fc125ab1ea836bd57f388f3caf2df02028"
}
},
{
"@id": "urn:8967c63f-5fc7-44a6-a350-10e4d91420e5",
"@id": "urn:0aff86a2-c424-420f-8105-3869a44750ba",
"Label": "tmp_REF_DSET.nii.gz",
"AtLocation": "tmp_REF_DSET.nii.gz",
"GeneratedBy": "urn:70d7cd80-32f6-4994-a4d4-c3fed4e02383",
"GeneratedBy": "urn:3bbde2e2-3198-4f5e-a405-3dc2859a814d",
"digest": {
"sha256": "e943c60b478a75e89c043bc4a7a6e6c629c3f075007ff501f7b2ab3a253e8d3d"
}
},
{
"@id": "urn:b04ba5a4-7187-414c-bf95-ec135e792a53",
"@id": "urn:eaef0dcb-5236-4a45-9f31-8a11e2ed6b04",
"Label": "PC_hyp${num}",
"AtLocation": "${dir_hyp}/PC_hyp${num}+tlrc",
"digest": {
"sha256": "c04239860983b8514d0cddedd56525b497ec99d5e4c48976b7cbea1d51baf3a8"
}
},
{
"@id": "urn:39cc23bc-4f4d-4709-9250-e84f23fea27f",
"@id": "urn:a8a1a9f6-ef1a-480d-bdea-a1be759db9ea",
"Label": "tmp_MATCHED",
"AtLocation": "tmp_MATCHED",
"GeneratedBy": "urn:f0664c49-ddd6-4d24-a5ba-c6bbf6b11662",
"GeneratedBy": "urn:31c67e59-a174-4acc-a9db-a84469c666cf",
"digest": {
"sha256": "a251065c7203a21b76c1fb6acd1edb6da1c29896ad2df1f5479c71e16a29c302"
}
},
{
"@id": "urn:5d71ef67-fdc3-4c22-b0ce-a46353f96da6",
"@id": "urn:40c7b3b1-aa1b-41ef-b09f-423be7a6600a",
"Label": "PC_hyp${num}_sign0.nii.gz",
"AtLocation": "${dir_hyp}/PC_hyp${num}_sign0.nii.gz",
"GeneratedBy": "urn:b4cb0bba-46e0-4c70-b0ed-fc17fcc0c5d5",
"GeneratedBy": "urn:e6b98c73-86e5-4eed-abdd-25d3eb6842f7",
"digest": {
"sha256": "5f0818d820edebe892295ffc1dd6f69823f2fb843bc2c3b0b5304054fa227af0"
}
Expand Down
46 changes: 23 additions & 23 deletions examples/from_parsers/afni/narps_do_02_pc_with_sign0_bloc.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Records": {
"Software": [
{
"@id": "urn:71935ebf-a6ab-4500-ad8b-7f5e8da5e05e",
"@id": "urn:b42066b4-1ce6-4ef1-81c8-5b010b7b18a9",
"RRID": "RRID:SCR_007037",
"@type": "prov:SoftwareAgent",
"Label": "AFNI",
Expand All @@ -13,93 +13,93 @@
],
"Activities": [
{
"@id": "urn:f9d9798b-3574-4575-9644-32356a2670e4",
"@id": "urn:66899270-94c2-43f0-a18d-0cc0171d7a9c",
"Label": "",
"AssociatedWith": "urn:71935ebf-a6ab-4500-ad8b-7f5e8da5e05e",
"AssociatedWith": "urn:b42066b4-1ce6-4ef1-81c8-5b010b7b18a9",
"Command": "3dpc -overwrite -mask ${dset_mask} -pcsave 5 -prefix ${dir_hyp}/PC_hyp${num} ${grp_dset}; ",
"Used": [
"urn:2b4f94e0-5fc5-4ffe-bef1-0aac47d21a99",
"urn:fe638e60-c25e-4ea2-9402-d0a17266edce"
"urn:3a3f7dc1-b64c-4e37-94ad-ced61e976493",
"urn:6bd8a464-c1d1-4ad1-887e-89e4569f4fc5"
]
},
{
"@id": "urn:c5248d48-74a5-470d-8bcb-ad95174cda17",
"@id": "urn:c5b45432-97f7-4d5d-9cb7-4468389c1014",
"Label": "bloc ...",
"AssociatedWith": "urn:71935ebf-a6ab-4500-ad8b-7f5e8da5e05e",
"AssociatedWith": "urn:b42066b4-1ce6-4ef1-81c8-5b010b7b18a9",
"Command": "3dresample -overwrite -prefix tmp_REF_DSET.nii.gz -master ${dset_mask} -input \"${ref_dset}\"; 3dMatch -echo_edu -overwrite -mask ${dset_mask} -refset ${dir_hyp}/PC_hyp${num}+tlrc -inset tmp_REF_DSET.nii.gz -prefix tmp_MATCHED; 3dcalc -echo_edu -overwrite -a ${dir_hyp}/PC_hyp${num}+tlrc -expr \"${signum}*a\" -prefix ${dir_hyp}/PC_hyp${num}_sign0.nii.gz; ",
"Used": [
"urn:4a3af7a0-3036-4378-9a44-c64d83423ba4",
"urn:2b4f94e0-5fc5-4ffe-bef1-0aac47d21a99",
"urn:e2161cb4-2cf0-4eea-b9fd-88b0157f0df4",
"urn:2b4f94e0-5fc5-4ffe-bef1-0aac47d21a99",
"urn:e2161cb4-2cf0-4eea-b9fd-88b0157f0df4"
"urn:6bd8a464-c1d1-4ad1-887e-89e4569f4fc5",
"urn:dbc62c04-7401-4242-bd5f-1e0cd3200344",
"urn:6bd8a464-c1d1-4ad1-887e-89e4569f4fc5",
"urn:a38e9c6e-092c-4a2a-ad84-77d8ef3aed75",
"urn:a38e9c6e-092c-4a2a-ad84-77d8ef3aed75"
]
}
],
"Entities": [
{
"@id": "urn:2b4f94e0-5fc5-4ffe-bef1-0aac47d21a99",
"@id": "urn:6bd8a464-c1d1-4ad1-887e-89e4569f4fc5",
"Label": "${dset_mask}",
"AtLocation": "${dset_mask}",
"digest": {
"sha256": "aad93a52efcf1938cc27b6cfe707fe2b1f74b1bd4b13217516525ff60fa0a2cd"
}
},
{
"@id": "urn:fe638e60-c25e-4ea2-9402-d0a17266edce",
"@id": "urn:3a3f7dc1-b64c-4e37-94ad-ced61e976493",
"Label": "${grp_dset}",
"AtLocation": "${grp_dset}",
"digest": {
"sha256": "b1baa298b8599a501c11bb588cf53f5f808f115ea112431351bbf5c494bb9298"
}
},
{
"@id": "urn:b5a1e0ec-f429-4dad-8195-9e71c8861dae",
"@id": "urn:b1c2c519-8550-40ba-9541-f954ae39fb12",
"Label": "PC_hyp${num}",
"AtLocation": "${dir_hyp}/PC_hyp${num}",
"GeneratedBy": "urn:f9d9798b-3574-4575-9644-32356a2670e4",
"GeneratedBy": "urn:66899270-94c2-43f0-a18d-0cc0171d7a9c",
"digest": {
"sha256": "915832134c7f76c64fd48179b53dfb05de128b50ef451380b440cff2ec1990fb"
}
},
{
"@id": "urn:2b4f94e0-5fc5-4ffe-bef1-0aac47d21a99",
"@id": "urn:6bd8a464-c1d1-4ad1-887e-89e4569f4fc5",
"Label": "${dset_mask}",
"AtLocation": "${dset_mask}",
"digest": {
"sha256": "aad93a52efcf1938cc27b6cfe707fe2b1f74b1bd4b13217516525ff60fa0a2cd"
}
},
{
"@id": "urn:4a3af7a0-3036-4378-9a44-c64d83423ba4",
"@id": "urn:dbc62c04-7401-4242-bd5f-1e0cd3200344",
"Label": "\"${ref_dset}\"",
"AtLocation": "\"${ref_dset}\"",
"digest": {
"sha256": "be3e8ce0897c76f6b02c76da87ee56fc125ab1ea836bd57f388f3caf2df02028"
}
},
{
"@id": "urn:e2161cb4-2cf0-4eea-b9fd-88b0157f0df4",
"@id": "urn:a38e9c6e-092c-4a2a-ad84-77d8ef3aed75",
"Label": "PC_hyp${num}",
"AtLocation": "${dir_hyp}/PC_hyp${num}+tlrc",
"digest": {
"sha256": "c04239860983b8514d0cddedd56525b497ec99d5e4c48976b7cbea1d51baf3a8"
}
},
{
"@id": "urn:74a19541-23cc-4447-9e24-964b612c2b15",
"@id": "urn:0e402105-a625-4b0d-aabb-84565733d38a",
"Label": "tmp_MATCHED",
"AtLocation": "tmp_MATCHED",
"GeneratedBy": "urn:c5248d48-74a5-470d-8bcb-ad95174cda17",
"GeneratedBy": "urn:c5b45432-97f7-4d5d-9cb7-4468389c1014",
"digest": {
"sha256": "a251065c7203a21b76c1fb6acd1edb6da1c29896ad2df1f5479c71e16a29c302"
}
},
{
"@id": "urn:ba85afc6-5799-4f95-8ec2-1b938e646d31",
"@id": "urn:f077f5e9-1c50-4198-9c92-b9d632ff2e18",
"Label": "PC_hyp${num}_sign0.nii.gz",
"AtLocation": "${dir_hyp}/PC_hyp${num}_sign0.nii.gz",
"GeneratedBy": "urn:c5248d48-74a5-470d-8bcb-ad95174cda17",
"GeneratedBy": "urn:c5b45432-97f7-4d5d-9cb7-4468389c1014",
"digest": {
"sha256": "5f0818d820edebe892295ffc1dd6f69823f2fb843bc2c3b0b5304054fa227af0"
}
Expand Down
Loading

0 comments on commit 07a4b25

Please sign in to comment.