workflow for processing ISMRM Diffusion Study - Best Practices in Image Preprocessing data

public public 1yr ago 0 bookmarks

workflow for processing ISMRM Diffusion Study - Best Practices in Image Preprocessing data

Snakemake workflow to run dwi preprocessing.

Uses snakemake & snakedwi , see docs here:

https://snakemake.readthedocs.io

https://snakedwi.readthedocs.io

This workflow converts the data to bids and runs snakedwi, then prepares data for uploading the submission

Put the raw data in ../sourcedata (can be configured with config.yml )

Notes:

  • You will need to update the --profile option in the snakedwi command (or remove it if you are not using an execution profile)

  • The data is missing SliceTiming for some scans, so I've pre-populated eddy slspec files for the 62 and 70 slice variants

  • Also forced PhaseEncodingDirection flags in the bids curation steps

Code Snippets

18
shell: 'cp {input} {output}'
26
27
28
29
30
31
32
run: 
    import json
    with open(input.json) as f:
        json_dict = json.load(f)
    json_dict['PhaseEncodingDirection'] = 'j'
    with open(output.json, 'w') as f:
        json.dump(json_dict, f,indent=4)
38
shell: 'cp {input} {output}'
46
47
48
49
50
51
52
run: 
    import json
    with open(input.json) as f:
        json_dict = json.load(f)
    json_dict['PhaseEncodingDirection'] = 'j-'
    with open(output.json, 'w') as f:
        json.dump(json_dict, f,indent=4)
61
shell: 'echo 0 > {output}'
65
shell: "echo '0\n0\n0' > {output}"
70
shell: 'cp {input} {output}'
80
81
82
83
84
85
86
87
88
shell: 
    'for subj in {params.subjects};'
    'do '
    ' nslices=`fslval bids/sub-${{subj}}/dwi/sub-${{subj}}_acq-AP_dwi.nii.gz dim3` && ' 
    ' if [ ${{nslices}} == {wildcards.nslices} ];' 
    ' then ' 
    '   echo ${{subj}} >> {output};' 
    ' fi; ' 
    'done'
103
shell: 'cp {input.dd} {output.dd}'
SnakeMake From line 103 of master/Snakefile
115
shell: 'echo snakedwi {params.bids_dir} {params.out_dir} participant --profile cc-slurm --no_bedpost --participant_label `cat {input.subjects}` --slspec_txt {input.custom} > {output.cmd}'
SnakeMake From line 115 of master/Snakefile
129
130
shell:
    'for folder in {input}; do cp -v ${{folder}}/results/sub-*/dwi/sub-?????_desc-eddy_dwi.* {output.submit_folder}; done'
SnakeMake From line 129 of master/Snakefile
137
shell: 'cp -v {input} {output}'
SnakeMake From line 137 of master/Snakefile
ShowHide 11 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://github.com/akhanf/consensus_study_snakedwi
Name: consensus_study_snakedwi
Version: 1
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...