From 3b447f730856ebc9004510790a755714981ca220 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Tue, 29 Sep 2026 12:22:11 +0200 Subject: [PATCH 01/10] add params to use cellpose v4 with GPU --- conf/modules.config | 8 ++++++++ modules/local/download_cellpose_model/main.nf | 11 ++++++++--- modules/local/patch_segmentation_cellpose/main.nf | 11 ++++++++--- modules/local/resolve_cellpose/main.nf | 11 ++++++++--- nextflow_schema.json | 3 ++- subworkflows/local/utils_nfcore_sopa_pipeline/main.nf | 6 ++++++ 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 6cb190b..1d4931e 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -19,4 +19,12 @@ process { saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, ] } + + // Cellpose: CPU image (cellpose v3) by default, GPU image (cellpose v4 + pytorch/CUDA) with --cellpose_use_gpu + withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { + ext.use_gpu = params.cellpose_use_gpu + } + withName: PATCH_SEGMENTATION_CELLPOSE { + accelerator = { params.cellpose_use_gpu ? 1 : null } + } } diff --git a/modules/local/download_cellpose_model/main.nf b/modules/local/download_cellpose_model/main.nf index 6245e86..c8d98ab 100644 --- a/modules/local/download_cellpose_model/main.nf +++ b/modules/local/download_cellpose_model/main.nf @@ -2,9 +2,14 @@ process DOWNLOAD_CELLPOSE_MODEL { label "process_single" conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" + // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml + container "${ task.ext.use_gpu +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'TODO_SINGULARITY_GPU_IMAGE_URL' +: 'TODO_DOCKER_GPU_IMAGE') +: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" input: val cli_arguments diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index cc4a668..6398b15 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -3,9 +3,14 @@ process PATCH_SEGMENTATION_CELLPOSE { tag "${meta.sample}" conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" + // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml + container "${ task.ext.use_gpu +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'TODO_SINGULARITY_GPU_IMAGE_URL' +: 'TODO_DOCKER_GPU_IMAGE') +: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" input: tuple val(meta), path(sdata_path), val(cli_arguments), val(index), val(n_patches), path(model_dir) diff --git a/modules/local/resolve_cellpose/main.nf b/modules/local/resolve_cellpose/main.nf index 69e1b32..aed32e4 100644 --- a/modules/local/resolve_cellpose/main.nf +++ b/modules/local/resolve_cellpose/main.nf @@ -3,9 +3,14 @@ process RESOLVE_CELLPOSE { tag "${meta.sample}" conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" + // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml + container "${ task.ext.use_gpu +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'TODO_SINGULARITY_GPU_IMAGE_URL' +: 'TODO_DOCKER_GPU_IMAGE') +: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" input: tuple val(meta), path(sdata_path), path(parquets) diff --git a/nextflow_schema.json b/nextflow_schema.json index ee719ff..ce6d537 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -553,7 +553,8 @@ }, "cellpose_use_gpu": { "type": "boolean", - "description": "Whether to use GPU for Cellpose segmentation" + "description": "Whether to use GPU for Cellpose segmentation", + "help_text": "If `false` (default), Cellpose v3 runs on CPU. If `true`, a GPU container with Cellpose v4 (PyTorch + CUDA) is used and one GPU is requested per patch. Combine with `-profile gpu` so the container engine exposes the GPU. Note that Cellpose v4 only ships the `cpsam` model, so `cellpose_model_type` is ignored." }, "cellpose_kwargs": { "type": "string", diff --git a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf index 87f98e4..14072b7 100644 --- a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf @@ -338,6 +338,12 @@ def validateParams(params) { if (params.use_proseg && !is_visium_hd && params.patch_width_microns != null && params.patch_width_microns != -1) { log.warn("Proseg needs to run on one single patch, but received patch_width_microns=${params.patch_width_microns}: setting it to -1 instead.") } + if (params.use_cellpose && params.cellpose_use_gpu && !workflow.profile.tokenize(',').contains('gpu')) { + log.warn("'cellpose_use_gpu' is set but the 'gpu' profile is not enabled: the container may not have access to the GPU. Add 'gpu' to your -profile (e.g. -profile docker,gpu).") + } + if (params.use_cellpose && params.cellpose_use_gpu && params.cellpose_model_type != null) { + log.warn("'cellpose_use_gpu' uses Cellpose v4, which only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") + } return params } From ce6fe6724148d7588a799550dc1b125a33c9c8d9 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Tue, 29 Sep 2026 15:21:05 +0200 Subject: [PATCH 02/10] add cellpose v4 image with pytorch+CUDA used with GPU --- modules/local/download_cellpose_model/main.nf | 4 +--- .../patch_segmentation_cellpose/environment_gpu.yml | 10 ++++++++++ modules/local/patch_segmentation_cellpose/main.nf | 4 +--- modules/local/resolve_cellpose/main.nf | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 modules/local/patch_segmentation_cellpose/environment_gpu.yml diff --git a/modules/local/download_cellpose_model/main.nf b/modules/local/download_cellpose_model/main.nf index c8d98ab..4328668 100644 --- a/modules/local/download_cellpose_model/main.nf +++ b/modules/local/download_cellpose_model/main.nf @@ -4,9 +4,7 @@ process DOWNLOAD_CELLPOSE_MODEL { conda "${moduleDir}/environment.yml" // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml container "${ task.ext.use_gpu -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'TODO_SINGULARITY_GPU_IMAGE_URL' -: 'TODO_DOCKER_GPU_IMAGE') +? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" diff --git a/modules/local/patch_segmentation_cellpose/environment_gpu.yml b/modules/local/patch_segmentation_cellpose/environment_gpu.yml new file mode 100644 index 0000000..cfd5126 --- /dev/null +++ b/modules/local/patch_segmentation_cellpose/environment_gpu.yml @@ -0,0 +1,10 @@ +# Built with ave --conda-file environment_gpu.yml --freeze --await --platform linux/amd64 +channels: + - conda-forge + - bioconda +dependencies: + - python=3.12 + - sopa=2.2.11 + - cellpose=4.1.1 + - pytorch-gpu=2.13.0 + - cuda-version=12.9 diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index 6398b15..344cc00 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -5,9 +5,7 @@ process PATCH_SEGMENTATION_CELLPOSE { conda "${moduleDir}/environment.yml" // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml container "${ task.ext.use_gpu -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'TODO_SINGULARITY_GPU_IMAGE_URL' -: 'TODO_DOCKER_GPU_IMAGE') +? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" diff --git a/modules/local/resolve_cellpose/main.nf b/modules/local/resolve_cellpose/main.nf index aed32e4..89bd56b 100644 --- a/modules/local/resolve_cellpose/main.nf +++ b/modules/local/resolve_cellpose/main.nf @@ -5,9 +5,7 @@ process RESOLVE_CELLPOSE { conda "${moduleDir}/environment.yml" // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml container "${ task.ext.use_gpu -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'TODO_SINGULARITY_GPU_IMAGE_URL' -: 'TODO_DOCKER_GPU_IMAGE') +? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" From 2490b5a62b3080b5fffc626651266b8f33533c5b Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Wed, 30 Sep 2026 14:25:37 +0200 Subject: [PATCH 03/10] del --cellpose_use_gpu and reuse the already existed --gpu to select the image --- conf/modules.config | 10 ++++------ modules/local/patch_segmentation_cellpose/main.nf | 1 + modules/local/utils.nf | 2 +- nextflow.config | 1 - nextflow_schema.json | 5 ----- subworkflows/local/utils_nfcore_sopa_pipeline/main.nf | 7 ++----- 6 files changed, 8 insertions(+), 18 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 1d4931e..3a00e35 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -20,11 +20,9 @@ process { ] } - // Cellpose: CPU image (cellpose v3) by default, GPU image (cellpose v4 + pytorch/CUDA) with --cellpose_use_gpu - withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { - ext.use_gpu = params.cellpose_use_gpu - } - withName: PATCH_SEGMENTATION_CELLPOSE { - accelerator = { params.cellpose_use_gpu ? 1 : null } + // Cellpose: CPU image (cellpose v3) by default, GPU image (cellpose v4 + pytorch/CUDA) with -profile gpu + + withName: 'DOWNLOAD_CELLPOSE_MODEL|RESOLVE_CELLPOSE' { + ext.use_gpu = { workflow.profile.contains('gpu') } } } diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index 344cc00..92e2de9 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -1,5 +1,6 @@ process PATCH_SEGMENTATION_CELLPOSE { label "process_single" + label "process_gpu" tag "${meta.sample}" conda "${moduleDir}/environment.yml" diff --git a/modules/local/utils.nf b/modules/local/utils.nf index 1b72fc7..4f7fd58 100644 --- a/modules/local/utils.nf +++ b/modules/local/utils.nf @@ -48,7 +48,7 @@ def extractSubArgs(Map args, String group) { flow_threshold: args.flow_threshold, model_type: args.cellpose_model_type, pretrained_model: args.pretrained_model, - gpu: args.cellpose_use_gpu, + gpu: workflow.profile.contains("gpu"), min_area: args.min_area_pixels2, clip_limit: args.clip_limit, clahe_kernel_size: args.clahe_kernel_size, diff --git a/nextflow.config b/nextflow.config index 5cde7a1..e0a482e 100644 --- a/nextflow.config +++ b/nextflow.config @@ -70,7 +70,6 @@ params { cellprob_threshold = null cellpose_model_type = null pretrained_model = null - cellpose_use_gpu = false cellpose_kwargs = null // Stardist segmentation options diff --git a/nextflow_schema.json b/nextflow_schema.json index ce6d537..9050fe0 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -551,11 +551,6 @@ "type": "string", "description": "Cellpose `pretrained_model` parameter" }, - "cellpose_use_gpu": { - "type": "boolean", - "description": "Whether to use GPU for Cellpose segmentation", - "help_text": "If `false` (default), Cellpose v3 runs on CPU. If `true`, a GPU container with Cellpose v4 (PyTorch + CUDA) is used and one GPU is requested per patch. Combine with `-profile gpu` so the container engine exposes the GPU. Note that Cellpose v4 only ships the `cpsam` model, so `cellpose_model_type` is ignored." - }, "cellpose_kwargs": { "type": "string", "description": "Additional cellpose parameters as a python dict string" diff --git a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf index 14072b7..cd5870d 100644 --- a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf @@ -338,11 +338,8 @@ def validateParams(params) { if (params.use_proseg && !is_visium_hd && params.patch_width_microns != null && params.patch_width_microns != -1) { log.warn("Proseg needs to run on one single patch, but received patch_width_microns=${params.patch_width_microns}: setting it to -1 instead.") } - if (params.use_cellpose && params.cellpose_use_gpu && !workflow.profile.tokenize(',').contains('gpu')) { - log.warn("'cellpose_use_gpu' is set but the 'gpu' profile is not enabled: the container may not have access to the GPU. Add 'gpu' to your -profile (e.g. -profile docker,gpu).") - } - if (params.use_cellpose && params.cellpose_use_gpu && params.cellpose_model_type != null) { - log.warn("'cellpose_use_gpu' uses Cellpose v4, which only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") + if (params.use_cellpose && workflow.profile.contains('gpu') && params.cellpose_model_type != null) { + log.warn("The 'gpu' profile uses Cellpose v4, which only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") } return params From 6499d24ea8c1e4769a5461ab76fb9972a00d72a9 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Wed, 30 Sep 2026 14:55:10 +0200 Subject: [PATCH 04/10] correct typos in code comment --- modules/local/patch_segmentation_cellpose/environment_gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/local/patch_segmentation_cellpose/environment_gpu.yml b/modules/local/patch_segmentation_cellpose/environment_gpu.yml index cfd5126..3872f23 100644 --- a/modules/local/patch_segmentation_cellpose/environment_gpu.yml +++ b/modules/local/patch_segmentation_cellpose/environment_gpu.yml @@ -1,4 +1,4 @@ -# Built with ave --conda-file environment_gpu.yml --freeze --await --platform linux/amd64 +# Built with wave --conda-file environment_gpu.yml --freeze --await --platform linux/amd64 channels: - conda-forge - bioconda From 6ee8057321aedca8c3969d020a03dc25c2df7b46 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Thu, 1 Oct 2026 15:34:09 +0200 Subject: [PATCH 05/10] add cellpose v4-pytorch-cuda singularity image --- modules/local/patch_segmentation_cellpose/environment_gpu.yml | 2 +- modules/local/patch_segmentation_cellpose/main.nf | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/local/patch_segmentation_cellpose/environment_gpu.yml b/modules/local/patch_segmentation_cellpose/environment_gpu.yml index 3872f23..59e3b55 100644 --- a/modules/local/patch_segmentation_cellpose/environment_gpu.yml +++ b/modules/local/patch_segmentation_cellpose/environment_gpu.yml @@ -1,4 +1,4 @@ -# Built with wave --conda-file environment_gpu.yml --freeze --await --platform linux/amd64 +# Built with wave --conda-file environment_gpu.yml --freeze --await 30m --platform linux/amd64 channels: - conda-forge - bioconda diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index 92e2de9..1fee5cc 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -6,7 +6,9 @@ process PATCH_SEGMENTATION_CELLPOSE { conda "${moduleDir}/environment.yml" // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml container "${ task.ext.use_gpu -? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" From 51a0f5911da5489c0e5aaaafd3f63cf31c0a7c74 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Tue, 6 Oct 2026 16:11:19 +0200 Subject: [PATCH 06/10] add option to force Cellpose version --- conf/modules.config | 6 +++--- modules/local/download_cellpose_model/main.nf | 8 +++++--- modules/local/patch_segmentation_cellpose/main.nf | 4 ++-- modules/local/resolve_cellpose/main.nf | 8 +++++--- nextflow.config | 1 + nextflow_schema.json | 5 +++++ subworkflows/local/utils_nfcore_sopa_pipeline/main.nf | 8 ++++++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 3a00e35..c59f568 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -20,9 +20,9 @@ process { ] } - // Cellpose: CPU image (cellpose v3) by default, GPU image (cellpose v4 + pytorch/CUDA) with -profile gpu + // Cellpose: v3 image by default, v4 + pytorch/CUDA image with -profile gpu. --cellpose_version forces either one - withName: 'DOWNLOAD_CELLPOSE_MODEL|RESOLVE_CELLPOSE' { - ext.use_gpu = { workflow.profile.contains('gpu') } + withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { + ext.cellpose_v4 = { params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') } } } diff --git a/modules/local/download_cellpose_model/main.nf b/modules/local/download_cellpose_model/main.nf index 4328668..48fd444 100644 --- a/modules/local/download_cellpose_model/main.nf +++ b/modules/local/download_cellpose_model/main.nf @@ -2,9 +2,11 @@ process DOWNLOAD_CELLPOSE_MODEL { label "process_single" conda "${moduleDir}/environment.yml" - // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml - container "${ task.ext.use_gpu -? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' + + container "${ task.ext.cellpose_v4 +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index 1fee5cc..d8767b1 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -4,8 +4,8 @@ process PATCH_SEGMENTATION_CELLPOSE { tag "${meta.sample}" conda "${moduleDir}/environment.yml" - // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml - container "${ task.ext.use_gpu + + container "${ task.ext.cellpose_v4 ? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' : 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') diff --git a/modules/local/resolve_cellpose/main.nf b/modules/local/resolve_cellpose/main.nf index 89bd56b..2533a4c 100644 --- a/modules/local/resolve_cellpose/main.nf +++ b/modules/local/resolve_cellpose/main.nf @@ -3,9 +3,11 @@ process RESOLVE_CELLPOSE { tag "${meta.sample}" conda "${moduleDir}/environment.yml" - // CPU image: cellpose v3 | GPU image (task.ext.use_gpu): cellpose v4 + pytorch/CUDA, built from patch_segmentation_cellpose/environment_gpu.yml - container "${ task.ext.use_gpu -? 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b' + + container "${ task.ext.cellpose_v4 +? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') : (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" diff --git a/nextflow.config b/nextflow.config index e0a482e..7ac57d3 100644 --- a/nextflow.config +++ b/nextflow.config @@ -70,6 +70,7 @@ params { cellprob_threshold = null cellpose_model_type = null pretrained_model = null + cellpose_version = null cellpose_kwargs = null // Stardist segmentation options diff --git a/nextflow_schema.json b/nextflow_schema.json index 9050fe0..dc61984 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -551,6 +551,11 @@ "type": "string", "description": "Cellpose `pretrained_model` parameter" }, + "cellpose_version": { + "type": "integer", + "enum": [3, 4], + "description": "Force the Cellpose major version (3 or 4). By default, Cellpose v4 is used with the 'gpu' profile and Cellpose v3 otherwise." + }, "cellpose_kwargs": { "type": "string", "description": "Additional cellpose parameters as a python dict string" diff --git a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf index cd5870d..c75ee82 100644 --- a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf @@ -338,8 +338,12 @@ def validateParams(params) { if (params.use_proseg && !is_visium_hd && params.patch_width_microns != null && params.patch_width_microns != -1) { log.warn("Proseg needs to run on one single patch, but received patch_width_microns=${params.patch_width_microns}: setting it to -1 instead.") } - if (params.use_cellpose && workflow.profile.contains('gpu') && params.cellpose_model_type != null) { - log.warn("The 'gpu' profile uses Cellpose v4, which only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") + def cellpose_v4 = params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') + if (params.use_cellpose && cellpose_v4 && params.cellpose_model_type != null) { + log.warn("Cellpose v4 only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") + } + if (params.use_cellpose && !cellpose_v4 && workflow.profile.contains('gpu')) { + log.warn("'cellpose_version=3' is used with the 'gpu' profile, but the Cellpose v3 image is not built with CUDA: Cellpose may fall back to CPU. Use 'cellpose_version=4' for GPU support.") } return params From fe6d4184e83c34239a12a5be7b40c232a0ecfcae Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Tue, 6 Oct 2026 17:22:11 +0200 Subject: [PATCH 07/10] move container logic to modules.config --- conf/modules.config | 11 +++++++++++ modules/local/download_cellpose_model/main.nf | 10 +++------- modules/local/patch_segmentation_cellpose/main.nf | 10 +++------- modules/local/resolve_cellpose/main.nf | 10 +++------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index c59f568..7902a60 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -24,5 +24,16 @@ process { withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { ext.cellpose_v4 = { params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') } + + container = { + def singularity = workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container + task.ext.cellpose_v4 + ? (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' + : 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') + : (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' + : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') + } } } diff --git a/modules/local/download_cellpose_model/main.nf b/modules/local/download_cellpose_model/main.nf index 48fd444..c3cd4cd 100644 --- a/modules/local/download_cellpose_model/main.nf +++ b/modules/local/download_cellpose_model/main.nf @@ -3,13 +3,9 @@ process DOWNLOAD_CELLPOSE_MODEL { conda "${moduleDir}/environment.yml" - container "${ task.ext.cellpose_v4 -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') -: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" input: val cli_arguments diff --git a/modules/local/patch_segmentation_cellpose/main.nf b/modules/local/patch_segmentation_cellpose/main.nf index d8767b1..6b2b2b3 100644 --- a/modules/local/patch_segmentation_cellpose/main.nf +++ b/modules/local/patch_segmentation_cellpose/main.nf @@ -5,13 +5,9 @@ process PATCH_SEGMENTATION_CELLPOSE { conda "${moduleDir}/environment.yml" - container "${ task.ext.cellpose_v4 -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') -: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" input: tuple val(meta), path(sdata_path), val(cli_arguments), val(index), val(n_patches), path(model_dir) diff --git a/modules/local/resolve_cellpose/main.nf b/modules/local/resolve_cellpose/main.nf index 2533a4c..09c6083 100644 --- a/modules/local/resolve_cellpose/main.nf +++ b/modules/local/resolve_cellpose/main.nf @@ -4,13 +4,9 @@ process RESOLVE_CELLPOSE { conda "${moduleDir}/environment.yml" - container "${ task.ext.cellpose_v4 -? (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') -: (workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container -? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' -: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') }" + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container +? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' +: 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24' }" input: tuple val(meta), path(sdata_path), path(parquets) From cf84f892292f2b5d105579e920d07fe7be9e3520 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Thu, 8 Oct 2026 16:11:59 +0200 Subject: [PATCH 08/10] update cellpose v4 version and containers --- conf/modules.config | 25 ++++++++++++------- ...ronment_gpu.yml => environment_gpu_v3.yml} | 2 +- .../environment_gpu_v4.yml | 15 +++++++++++ .../environment_v4.yml | 12 +++++++++ nextflow_schema.json | 6 ++--- .../local/utils_nfcore_sopa_pipeline/main.nf | 4 +-- 6 files changed, 49 insertions(+), 15 deletions(-) rename modules/local/patch_segmentation_cellpose/{environment_gpu.yml => environment_gpu_v3.yml} (91%) create mode 100644 modules/local/patch_segmentation_cellpose/environment_gpu_v4.yml create mode 100644 modules/local/patch_segmentation_cellpose/environment_v4.yml diff --git a/conf/modules.config b/conf/modules.config index 7902a60..a68c74f 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -20,20 +20,27 @@ process { ] } - // Cellpose: v3 image by default, v4 + pytorch/CUDA image with -profile gpu. --cellpose_version forces either one - withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { - ext.cellpose_v4 = { params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') } + ext.cellpose_v4 = { params.cellpose_version?.toString() == '4' } container = { def singularity = workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container + def gpu = workflow.profile.tokenize(',').contains('gpu') task.ext.cellpose_v4 - ? (singularity - ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/88/88ad84624cfa03490ebdbfe171551edd036602a9585c10ec47d2b7557732b627/data' - : 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:7ca3fb7cbc5a048b') - : (singularity - ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' - : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24') + ? (gpu + ? (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/67/671fb3f9bda5ec16374e0e3e205a9c6ffc70ae1c026a545b5a279e7ceb0eb30b/data' + : 'community.wave.seqera.io/library/python_sopa_pytorch-gpu_cuda-version_pruned:f8ad553fec147735') + : (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/77/772148940c7b9c9d6534e7171b62e91054f64074b8aa993a00808a63b08c5921/data' + : 'community.wave.seqera.io/library/python_sopa_git_pip_pruned:6cb26eea74b966e9')) + : (gpu + ? (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/ce/ce822fd366041478434e9969270adc4d7d7e6ce3600c8a20e668d1cd9892792f/data' + : 'community.wave.seqera.io/library/python_sopa_cellpose_pytorch-gpu_cuda-version:27dd8cb2cf96f33b') + : (singularity + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22d62d6425b70620138ad8764139528c1acaabf6cd06403134c8439caa1c9a31/data' + : 'community.wave.seqera.io/library/python_sopa_cellpose:d098579826bbcf24')) } } } diff --git a/modules/local/patch_segmentation_cellpose/environment_gpu.yml b/modules/local/patch_segmentation_cellpose/environment_gpu_v3.yml similarity index 91% rename from modules/local/patch_segmentation_cellpose/environment_gpu.yml rename to modules/local/patch_segmentation_cellpose/environment_gpu_v3.yml index 59e3b55..87cdf65 100644 --- a/modules/local/patch_segmentation_cellpose/environment_gpu.yml +++ b/modules/local/patch_segmentation_cellpose/environment_gpu_v3.yml @@ -5,6 +5,6 @@ channels: dependencies: - python=3.12 - sopa=2.2.11 - - cellpose=4.1.1 + - cellpose=3.1.1.3 - pytorch-gpu=2.13.0 - cuda-version=12.9 diff --git a/modules/local/patch_segmentation_cellpose/environment_gpu_v4.yml b/modules/local/patch_segmentation_cellpose/environment_gpu_v4.yml new file mode 100644 index 0000000..dbee8c7 --- /dev/null +++ b/modules/local/patch_segmentation_cellpose/environment_gpu_v4.yml @@ -0,0 +1,15 @@ +# Built with wave --conda-file environment_gpu_v4.yml --freeze --await 30m --platform linux/amd64 +channels: + - conda-forge + - bioconda +dependencies: + - python=3.12 + - sopa=2.2.11 + - pytorch-gpu=2.13.0 + - cuda-version=12.9 + - torchvision=0.28.0 + - git + - pip + - pip: + - cellpose==4.2.1.1 + - git+https://github.com/facebookresearch/dinov3 diff --git a/modules/local/patch_segmentation_cellpose/environment_v4.yml b/modules/local/patch_segmentation_cellpose/environment_v4.yml new file mode 100644 index 0000000..006f4e4 --- /dev/null +++ b/modules/local/patch_segmentation_cellpose/environment_v4.yml @@ -0,0 +1,12 @@ +# Built with wave --conda-file environment_v4.yml --freeze --await 30m --platform linux/amd64 +channels: + - conda-forge + - bioconda +dependencies: + - python=3.12 + - sopa=2.2.11 + - git + - pip + - pip: + - cellpose==4.2.1.1 + - git+https://github.com/facebookresearch/dinov3 diff --git a/nextflow_schema.json b/nextflow_schema.json index dc61984..98676a5 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -552,9 +552,9 @@ "description": "Cellpose `pretrained_model` parameter" }, "cellpose_version": { - "type": "integer", - "enum": [3, 4], - "description": "Force the Cellpose major version (3 or 4). By default, Cellpose v4 is used with the 'gpu' profile and Cellpose v3 otherwise." + "type": ["integer", "string"], + "enum": [3, 4, "3", "4"], + "description": "Cellpose major version (3 or 4). Defaults to Cellpose v3. The 'gpu' profile selects the pytorch/CUDA image of the chosen version." }, "cellpose_kwargs": { "type": "string", diff --git a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf index c75ee82..eaf0c6d 100644 --- a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf @@ -339,8 +339,8 @@ def validateParams(params) { log.warn("Proseg needs to run on one single patch, but received patch_width_microns=${params.patch_width_microns}: setting it to -1 instead.") } def cellpose_v4 = params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') - if (params.use_cellpose && cellpose_v4 && params.cellpose_model_type != null) { - log.warn("Cellpose v4 only provides the 'cpsam' model: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") + if (params.use_cellpose && cellpose_v4 && params.cellpose_model_type != null) { + log.warn("Cellpose v4 only supports the pretrained_model argument: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") } if (params.use_cellpose && !cellpose_v4 && workflow.profile.contains('gpu')) { log.warn("'cellpose_version=3' is used with the 'gpu' profile, but the Cellpose v3 image is not built with CUDA: Cellpose may fall back to CPU. Use 'cellpose_version=4' for GPU support.") From 5535584945035f769288f78d42fc0797ec7a6b49 Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Thu, 8 Oct 2026 16:56:46 +0200 Subject: [PATCH 09/10] add logic to hundel cellpose conda env --- conf/modules.config | 8 ++++++++ .../local/patch_segmentation_cellpose/environment_v4.yml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/conf/modules.config b/conf/modules.config index a68c74f..e2e99d0 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -23,6 +23,14 @@ process { withName: 'DOWNLOAD_CELLPOSE_MODEL|PATCH_SEGMENTATION_CELLPOSE|RESOLVE_CELLPOSE' { ext.cellpose_v4 = { params.cellpose_version?.toString() == '4' } + conda = { + def gpu = workflow.profile.tokenize(',').contains('gpu') + def env_name = task.ext.cellpose_v4 + ? (gpu ? 'environment_gpu_v4.yml' : 'environment_v4.yml') + : (gpu ? 'environment_gpu_v3.yml' : 'environment.yml') + "${projectDir}/modules/local/patch_segmentation_cellpose/${env_name}" + } + container = { def singularity = workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container def gpu = workflow.profile.tokenize(',').contains('gpu') diff --git a/modules/local/patch_segmentation_cellpose/environment_v4.yml b/modules/local/patch_segmentation_cellpose/environment_v4.yml index 006f4e4..62f343c 100644 --- a/modules/local/patch_segmentation_cellpose/environment_v4.yml +++ b/modules/local/patch_segmentation_cellpose/environment_v4.yml @@ -5,6 +5,8 @@ channels: dependencies: - python=3.12 - sopa=2.2.11 + - pytorch=2.13.0 + - torchvision=0.28.0 - git - pip - pip: From 44fda847a62fe0b68834c0d15640a0258301255f Mon Sep 17 00:00:00 2001 From: alihamraoui Date: Thu, 8 Oct 2026 17:11:10 +0200 Subject: [PATCH 10/10] remove the Cellpose v3 + gpu warning --- subworkflows/local/utils_nfcore_sopa_pipeline/main.nf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf index eaf0c6d..4fe6f7b 100644 --- a/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sopa_pipeline/main.nf @@ -339,12 +339,9 @@ def validateParams(params) { log.warn("Proseg needs to run on one single patch, but received patch_width_microns=${params.patch_width_microns}: setting it to -1 instead.") } def cellpose_v4 = params.cellpose_version != null ? params.cellpose_version.toString() == '4' : workflow.profile.contains('gpu') - if (params.use_cellpose && cellpose_v4 && params.cellpose_model_type != null) { + if (params.use_cellpose && cellpose_v4 && params.cellpose_model_type != null) { log.warn("Cellpose v4 only supports the pretrained_model argument: 'cellpose_model_type=${params.cellpose_model_type}' will be ignored.") } - if (params.use_cellpose && !cellpose_v4 && workflow.profile.contains('gpu')) { - log.warn("'cellpose_version=3' is used with the 'gpu' profile, but the Cellpose v3 image is not built with CUDA: Cellpose may fall back to CPU. Use 'cellpose_version=4' for GPU support.") - } return params }