Skip to content

Commit

Permalink
fix qc on tractogram when commit is run
Browse files Browse the repository at this point in the history
  • Loading branch information
gagnonanthony committed Dec 31, 2024
1 parent 4c5e87e commit d91c36d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
1 change: 0 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ process {
saveAs: {
filename ->
if ( filename.contains("commit.h5") ) { "${meta.id}_space-orig_desc-filtered_tracking.h5" }
else if ( filename.contains("commit.trk") ) { "${meta.id}_space-orig_desc-filtered_tracking.trk" }
else if ( filename.contains("versions.yml") ) { null }
else { params.lean_output ? null : filename }
}
Expand Down
18 changes: 12 additions & 6 deletions modules/local/filtering/commit.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ process FILTERING_COMMIT {
'scilus/scilpy:1.6.0' }"

input:
tuple val(meta), path(trk), path(dwi), path(bval), path(bvec), path(peaks)
tuple val(meta), path(hdf5), path(dwi), path(bval), path(bvec), path(peaks)

output:
tuple val(meta), path("*results_bzs") , emit: results
tuple val(meta), path("*commit*") , emit: trk
tuple val(meta), path("*commit*") , emit: hdf5
tuple val(meta), path("*essential*") , emit: trk

path "versions.yml" , emit: versions

Expand All @@ -34,16 +35,20 @@ process FILTERING_COMMIT {
"""
export DIPY_HOME="./"
scil_run_commit.py $trk $dwi $bval $bvec "${prefix}__results_bzs/" \
scil_run_commit.py $hdf5 $dwi $bval $bvec "${prefix}__results_bzs/" \
--processes $task.cpus $para_diff $iso_diff $perp_diff $ball_stick \
$commit2 $commit2_lambda $nbr_dir $peaks_arg
if [ -f "${prefix}__results_bzs/commit_2/decompose_commit.h5" ]; then
mv "${prefix}__results_bzs/commit_2/decompose_commit.h5" "./${prefix}__decompose_commit.h5"
elif [ -f "${prefix}__results_bzs/commit_1/decompose_commit.h5" ]; then
else
mv "${prefix}__results_bzs/commit_1/decompose_commit.h5" "./${prefix}__decompose_commit.h5"
fi
if [ -f "${prefix}__results_bzs/commit_2/essential_tractogram.trk" ]; then
mv "${prefix}__results_bzs/commit_2/essential_tractogram.trk" "./${prefix}__essential.trk"
else
mv "${prefix}__results_bzs/commit_1/essential_tractogram.trk" "./${prefix}__commit.trk"
mv "${prefix}__results_bzs/commit_1/essential_tractogram.trk" "./${prefix}__essential.trk"
fi
cat <<-END_VERSIONS > versions.yml
Expand All @@ -56,7 +61,8 @@ process FILTERING_COMMIT {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${prefix}__commit.trk
touch ${prefix}__commit.h5
touch ${prefix}__essential.trk
mkdir ${prefix}__results_bzs
scil_run_commit.py -h
Expand Down
20 changes: 10 additions & 10 deletions tests/chained.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"sub-test/dwi/sub-test_space-orig_afd_sum.nii.gz",
"sub-test/dwi/sub-test_space-orig_afd_total.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-brain_mask.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-pft_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-preproc_b0.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-preproc_dwi.bval",
Expand Down Expand Up @@ -125,7 +125,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:34:55.150076"
"timestamp": "2024-12-31T14:57:08.127054"
},
"Connectomics + tracking + infant profiles - should run successfully": {
"content": [
Expand Down Expand Up @@ -222,7 +222,7 @@
"sub-test/dwi/sub-test_space-orig_afd_sum.nii.gz",
"sub-test/dwi/sub-test_space-orig_afd_total.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-brain_mask.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-preproc_b0.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-preproc_dwi.bval",
"sub-test/dwi/sub-test_space-orig_desc-preproc_dwi.bvec",
Expand Down Expand Up @@ -254,7 +254,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:37:53.688618"
"timestamp": "2024-12-31T14:59:22.789945"
},
"Connectomics + tracking + freesurfer profiles - should run successfully": {
"content": [
Expand Down Expand Up @@ -365,7 +365,7 @@
"sub-test/dwi/sub-test_space-orig_afd_sum.nii.gz",
"sub-test/dwi/sub-test_space-orig_afd_total.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-brain_mask.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-pft_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-preproc_b0.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-preproc_dwi.bval",
Expand Down Expand Up @@ -399,7 +399,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:31:53.502697"
"timestamp": "2024-12-31T14:55:00.755966"
},
"Freesurfer + connectomics profiles - should run successfully": {
"content": [
Expand Down Expand Up @@ -466,7 +466,7 @@
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-sc.npy.png",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy.png",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-preproc_tracking.h5",
"sub-test/figures",
"sub-test/figures/sub-test_gradients_mqc.png",
Expand All @@ -482,7 +482,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:25:40.348832"
"timestamp": "2024-12-31T14:50:38.998744"
},
"Connectomics + tracking profiles - should run successfully": {
"content": [
Expand Down Expand Up @@ -577,7 +577,7 @@
"sub-test/dwi/sub-test_space-orig_afd_sum.nii.gz",
"sub-test/dwi/sub-test_space-orig_afd_total.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-brain_mask.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-pft_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-preproc_b0.nii.gz",
"sub-test/dwi/sub-test_space-orig_desc-preproc_dwi.bval",
Expand Down Expand Up @@ -610,6 +610,6 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:29:03.36884"
"timestamp": "2024-12-31T14:52:59.152676"
}
}
12 changes: 6 additions & 6 deletions tests/connectomics.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-sc.npy.png",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy.png",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-preproc_tracking.h5",
"sub-test/figures",
"sub-test/figures/sub-test_gradients_mqc.png",
Expand All @@ -57,7 +57,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:39:03.087726"
"timestamp": "2024-12-31T15:00:17.631141"
},
"Connectomics profile without metrics - should run successfully": {
"content": [
Expand Down Expand Up @@ -102,7 +102,7 @@
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-sc.npy.png",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy.png",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-preproc_tracking.h5",
"sub-test/figures",
"sub-test/figures/sub-test_gradients_mqc.png",
Expand All @@ -117,7 +117,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:40:13.184442"
"timestamp": "2024-12-31T15:01:10.020385"
},
"Connectomics + infant profile - should run successfully": {
"content": [
Expand Down Expand Up @@ -162,7 +162,7 @@
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-sc.npy.png",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy",
"sub-test/dwi/sub-test_ses-baseline_space-diff_seg-BrainnetomeChild_stat-vol.npy.png",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.trk",
"sub-test/dwi/sub-test_space-orig_desc-filtered_tracking.h5",
"sub-test/dwi/sub-test_space-orig_desc-preproc_tracking.h5",
"sub-test/figures",
"sub-test/figures/sub-test_gradients_mqc.png",
Expand All @@ -177,6 +177,6 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:41:33.168064"
"timestamp": "2024-12-31T15:02:18.585569"
}
}
12 changes: 6 additions & 6 deletions tests/multisubjects.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"sub-test1/dwi/sub-test1_space-orig_afd_sum.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_afd_total.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-brain_mask.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-filtered_tracking.trk",
"sub-test1/dwi/sub-test1_space-orig_desc-filtered_tracking.h5",
"sub-test1/dwi/sub-test1_space-orig_desc-preproc_b0.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-preproc_dwi.bval",
"sub-test1/dwi/sub-test1_space-orig_desc-preproc_dwi.bvec",
Expand Down Expand Up @@ -144,7 +144,7 @@
"sub-test2/dwi/sub-test2_space-orig_afd_sum.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_afd_total.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-brain_mask.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-filtered_tracking.trk",
"sub-test2/dwi/sub-test2_space-orig_desc-filtered_tracking.h5",
"sub-test2/dwi/sub-test2_space-orig_desc-preproc_b0.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-preproc_dwi.bval",
"sub-test2/dwi/sub-test2_space-orig_desc-preproc_dwi.bvec",
Expand Down Expand Up @@ -176,7 +176,7 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:49:14.05649"
"timestamp": "2024-12-31T15:09:07.167014"
},
"All profiles with multiple subjects - should run successfully": {
"content": [
Expand Down Expand Up @@ -287,7 +287,7 @@
"sub-test1/dwi/sub-test1_space-orig_afd_sum.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_afd_total.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-brain_mask.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-filtered_tracking.trk",
"sub-test1/dwi/sub-test1_space-orig_desc-filtered_tracking.h5",
"sub-test1/dwi/sub-test1_space-orig_desc-pft_tracking.trk",
"sub-test1/dwi/sub-test1_space-orig_desc-preproc_b0.nii.gz",
"sub-test1/dwi/sub-test1_space-orig_desc-preproc_dwi.bval",
Expand Down Expand Up @@ -355,7 +355,7 @@
"sub-test2/dwi/sub-test2_space-orig_afd_sum.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_afd_total.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-brain_mask.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-filtered_tracking.trk",
"sub-test2/dwi/sub-test2_space-orig_desc-filtered_tracking.h5",
"sub-test2/dwi/sub-test2_space-orig_desc-pft_tracking.trk",
"sub-test2/dwi/sub-test2_space-orig_desc-preproc_b0.nii.gz",
"sub-test2/dwi/sub-test2_space-orig_desc-preproc_dwi.bval",
Expand Down Expand Up @@ -389,6 +389,6 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-30T12:46:00.157441"
"timestamp": "2024-12-31T15:06:13.046546"
}
}
2 changes: 1 addition & 1 deletion workflows/pediatric.nf
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ workflow PEDIATRIC {
//
// MODULE: Run AFDFIXEL
//
ch_afdfixel = FILTERING_COMMIT.out.trk
ch_afdfixel = FILTERING_COMMIT.out.hdf5
.join(ch_fodf)

CONNECTIVITY_AFDFIXEL ( ch_afdfixel )
Expand Down

0 comments on commit d91c36d

Please sign in to comment.