Skip to content

Commit

Permalink
added tests + fix some subworkflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gagnonanthony committed Dec 6, 2024
1 parent ae2734d commit 39e8ae2
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 18 deletions.
3 changes: 2 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"installed_by": [
"preproc_dwi",
"preproc_t1"
]
],
"patch": "modules/nf-neuro/betcrop/synthbet/betcrop-synthbet.diff"
},
"denoising/mppca": {
"branch": "main",
Expand Down
21 changes: 21 additions & 0 deletions modules/nf-neuro/betcrop/synthbet/betcrop-synthbet.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Changes in module 'nf-neuro/betcrop/synthbet'
'modules/nf-neuro/betcrop/synthbet/environment.yml' is unchanged
'modules/nf-neuro/betcrop/synthbet/meta.yml' is unchanged
Changes in 'betcrop/synthbet/main.nf':
--- modules/nf-neuro/betcrop/synthbet/main.nf
+++ modules/nf-neuro/betcrop/synthbet/main.nf
@@ -40,7 +40,7 @@
def prefix = task.ext.prefix ?: "${meta.id}"

"""
- mri_synthstrip -h
+ #mri_synthstrip -h

touch ${prefix}__bet_image.nii.gz
touch ${prefix}__brain_mask.nii.gz

'modules/nf-neuro/betcrop/synthbet/tests/main.nf.test.snap' is unchanged
'modules/nf-neuro/betcrop/synthbet/tests/tags.yml' is unchanged
'modules/nf-neuro/betcrop/synthbet/tests/nextflow.config' is unchanged
'modules/nf-neuro/betcrop/synthbet/tests/main.nf.test' is unchanged
************************************************************
2 changes: 1 addition & 1 deletion modules/nf-neuro/betcrop/synthbet/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ process BETCROP_SYNTHBET {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
mri_synthstrip -h
#mri_synthstrip -h
touch ${prefix}__bet_image.nii.gz
touch ${prefix}__brain_mask.nii.gz
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-neuro/preproc/eddy/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ process PREPROC_EDDY {

"""
scil_volume_math.py -h
maskfilter -h
bet -h
#maskfilter -h
#bet -h
scil_dwi_extract_b0.py -h
scil_gradients_validate_correct_eddy.py -h
scil_dwi_concatenate.py -h
Expand Down
12 changes: 9 additions & 3 deletions subworkflows/nf-neuro/preproc_t1/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ workflow PREPROC_T1 {
ch_versions = ch_versions.mix(PREPROC_N4.out.versions.first())

// ** Resampling ** //
ch_resampling = PREPROC_N4.out.image.join(ch_ref_resample)
ch_resampling = PREPROC_N4.out.image
.join(ch_ref_resample, remainder: true)
.map{ it[0..1] + [it[2] ?: []] }
IMAGE_RESAMPLE ( ch_resampling )
ch_versions = ch_versions.mix(IMAGE_RESAMPLE.out.versions.first())

// ** Brain extraction ** //
if ( params.run_synthbet) {
if ( params.t1_run_synthstrip ) {
ch_bet = IMAGE_RESAMPLE.out.image.join(ch_weights)
BETCROP_SYNTHBET ( ch_bet )
ch_versions = ch_versions.mix(BETCROP_SYNTHBET.out.versions.first())
Expand All @@ -59,7 +61,11 @@ workflow PREPROC_T1 {
}

else {
ch_bet = IMAGE_RESAMPLE.out.image.join(ch_template).join(ch_probability_map)
ch_bet = IMAGE_RESAMPLE.out.image
.join(ch_template)
.join(ch_probability_map, remainder: true)
.map{ it[0..3] + [it[4] ?: []] }
.map{ it[0..4] + [it[5] ?: []] }
BETCROP_ANTSBET ( ch_bet )
ch_versions = ch_versions.mix(BETCROP_ANTSBET.out.versions.first())

Expand Down
37 changes: 30 additions & 7 deletions tests/chained.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nextflow_pipeline {
name "Test nf-pediatric all profiles chained"
script "../main.nf"

/* ** COMMENTED OUT FOR NOW, UNTIL WE HAVE ACCESS TO THE SCIL'S RUNNERS. ** //
//** COMMENTED OUT FOR NOW, UNTIL WE HAVE ACCESS TO THE SCIL'S RUNNERS.
test("Freesurfer + connectomics profiles - should run successfully") {

when {
Expand All @@ -27,7 +27,7 @@ nextflow_pipeline {
}

}
*/

test("Connectomics + tracking profiles - should run successfully") {

when {
Expand All @@ -44,7 +44,31 @@ nextflow_pipeline {

then {
assert workflow.success
assert workflow.trace.tasks().size() == 32
assert workflow.trace.tasks().size() == 31
}

}

test("Connectomics + tracking + freesurfer profiles - should run successfully") {

when {
params {

params.input = "$projectDir/tests/data/samplesheet_testtracking.csv"
params.outdir = "test_results/"

params.connectomics = true
params.tracking = true
params.freesurfer = true

params.use_fastsurfer = true
params.fs_license = "https://www.dropbox.com/scl/fi/0s8lp6lydyd0rxawxb4jm/license.txt?rlkey=hz54oc0d4sor69avqphtrjvgn&st=9e0yij97&dl=0"
}
}

then {
assert workflow.success
assert workflow.trace.tasks().size() == 27
}

}
Expand All @@ -65,12 +89,12 @@ nextflow_pipeline {

then {
assert workflow.success
assert workflow.trace.tasks().size() == 32
assert workflow.trace.tasks().size() == 31
}

}

/* UNTIL WE HAVE SCIL'S RUNNERS, WE CAN'T RUN THIS TEST. ** //
//* UNTIL WE HAVE SCIL'S RUNNERS, WE CAN'T RUN THIS TEST. ** //
test("Connectomics + tracking + infant profiles - should run successfully") {

when {
Expand Down Expand Up @@ -98,10 +122,9 @@ nextflow_pipeline {

then {
assert workflow.success
assert workflow.trace.tasks().size() == 35
assert workflow.trace.tasks().size() == 34
}

}
*/

}
4 changes: 2 additions & 2 deletions tests/tracking.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nextflow_pipeline {

then {
assert workflow.success
assert workflow.trace.tasks().size() == 26
assert workflow.trace.tasks().size() == 25
}

}
Expand Down Expand Up @@ -92,7 +92,7 @@ nextflow_pipeline {

then {
assert workflow.success
assert workflow.trace.tasks().size() == 29
assert workflow.trace.tasks().size() == 28
}

}
Expand Down
4 changes: 2 additions & 2 deletions workflows/pediatric.nf
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ workflow PEDIATRIC {

PREPROC_DWI(
ch_inputs.dwi_bval_bvec,
[],
[],
Channel.empty(),
Channel.empty(),
ch_inputs.rev_b0,
ch_topup_config,
ch_dwi_weights
Expand Down

0 comments on commit 39e8ae2

Please sign in to comment.