diff --git a/conf/modules.config b/conf/modules.config index cd6dd54..03ab262 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -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 } } diff --git a/modules/local/filtering/commit.nf b/modules/local/filtering/commit.nf index 8a0bede..a82904c 100644 --- a/modules/local/filtering/commit.nf +++ b/modules/local/filtering/commit.nf @@ -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 @@ -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 @@ -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 diff --git a/tests/chained.nf.test.snap b/tests/chained.nf.test.snap index 120e22c..cf1d6bb 100644 --- a/tests/chained.nf.test.snap +++ b/tests/chained.nf.test.snap @@ -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", @@ -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": [ @@ -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", @@ -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": [ @@ -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", @@ -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": [ @@ -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", @@ -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": [ @@ -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", @@ -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" } } \ No newline at end of file diff --git a/tests/connectomics.nf.test.snap b/tests/connectomics.nf.test.snap index 604f261..9fc1842 100644 --- a/tests/connectomics.nf.test.snap +++ b/tests/connectomics.nf.test.snap @@ -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", @@ -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": [ @@ -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", @@ -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": [ @@ -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", @@ -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" } } \ No newline at end of file diff --git a/tests/multisubjects.nf.test.snap b/tests/multisubjects.nf.test.snap index 5f669da..8d25ce8 100644 --- a/tests/multisubjects.nf.test.snap +++ b/tests/multisubjects.nf.test.snap @@ -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", @@ -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", @@ -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": [ @@ -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", @@ -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", @@ -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" } } \ No newline at end of file diff --git a/workflows/pediatric.nf b/workflows/pediatric.nf index aed7b65..4935ce2 100644 --- a/workflows/pediatric.nf +++ b/workflows/pediatric.nf @@ -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 )