From d330723b31fb701b60e283c05a5721fb5a1b9034 Mon Sep 17 00:00:00 2001 From: khersameesh24 Date: Mon, 13 Jan 2025 16:35:25 +0000 Subject: [PATCH 1/8] include proseg and proseg-to-baysor preprocess into local modules --- modules/local/preprocess/main.nf | 52 ++++++++++++++++ modules/local/proseg/main.nf | 82 +++++++++++++++++++++++++ modules/local/proseg/meta.yml | 80 ++++++++++++++++++++++++ modules/local/proseg/nextflow.config | 3 + modules/local/proseg/tests/main.nf.test | 77 +++++++++++++++++++++++ modules/local/proseg/tests/tags.yml | 2 + 6 files changed, 296 insertions(+) create mode 100644 modules/local/preprocess/main.nf create mode 100644 modules/local/proseg/main.nf create mode 100644 modules/local/proseg/meta.yml create mode 100644 modules/local/proseg/nextflow.config create mode 100644 modules/local/proseg/tests/main.nf.test create mode 100644 modules/local/proseg/tests/tags.yml diff --git a/modules/local/preprocess/main.nf b/modules/local/preprocess/main.nf new file mode 100644 index 00000000..2e5cdd78 --- /dev/null +++ b/modules/local/preprocess/main.nf @@ -0,0 +1,52 @@ +process PROSEG2BAYSOR { + tag "$meta.id" + label 'process_high' + + container "nf-core/proseg:1.1.8" + + input: + path(transcript_metadata) + path(cell_polygons) + + output: + path("baysor-transcript-metadata.csv"), emit: baysor_metadata + path("baysor-cell-polygons.geojson"), emit: baysor_polygons + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "PROSEG2BAYSOR (preprocess) module does not support Conda. Please use Docker / Singularity / Podman instead." + } + + """ + proseg-to-baysor \ + ${transcript_metadata} \ + ${cell_polygons} \ + --output-transcript-metadata baysor-transcript-metadata.csv \ + --output-cell-polygons baysor-cell-polygons.geojson + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + proseg: \$(proseg --version | sed 's/proseg //') + END_VERSIONS + + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch expected-counts.csv.gz + touch cell-metadata.csv.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + proseg: \$(proseg --version | sed 's/proseg //') + END_VERSIONS + """ +} diff --git a/modules/local/proseg/main.nf b/modules/local/proseg/main.nf new file mode 100644 index 00000000..d67abdd7 --- /dev/null +++ b/modules/local/proseg/main.nf @@ -0,0 +1,82 @@ +process PROSEG { + tag "$meta.id" + label 'process_high' + + container "nf-core/proseg:1.1.8" + + input: + tuple val(meta), path(transcripts) + + output: + tuple val(meta), path("cell-polygons.geojson.gz"), emit: cell_polygons_2d + path("expected-counts.csv.gz"), emit: expected_counts + path("cell-metadata.csv.gz"), emit: cell_metadata + path("transcript-metadata.csv.gz"), emit: transcript_metadata + path("gene-metadata.csv.gz"), emit: gene_metadata + path("rates.csv.gz"), emit: rates + path("cell-polygons-layers.geojson.gz"), emit: cell_polygons_layers + path("cell-hulls.geojson.gz"), emit: cell_hulls + path("versions.yml"), emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def platform = preset ? "${params.preset}" : "" + + // check for preset values + if (!(platform in ['xenium', 'cosmx', 'merscope'])) { + error "${platform} is an invalid platform (preset) type. Please specify xenium, cosmx, or merscope" + } + + """ + proseg \\ + --${preset} \\ + ${transcripts} \\ + --nthreads ${task.cpus} \\ + --output-expected-counts expected-counts.csv.gz \\ + --output-cell-metadata cell-metadata.csv.gz \\ + --output-transcript-metadata transcript-metadata.csv.gz \\ + --output-gene-metadata gene-metadata.csv.gz \\ + --output-rates rates.csv.gz \\ + --output-cell-polygons cell-polygons.geojson.gz \\ + --output-cell-polygon-layers cell-polygons-layers.geojson.gz \\ + --output-cell-hulls cell-hulls.geojson.gz \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + proseg: \$(proseg --version | sed 's/proseg //') + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch expected-counts.csv.gz + touch cell-metadata.csv.gz + touch transcript-metadata.csv.gz + touch gene-metadata.csv.gz + touch rates.csv.gz + touch cell-polygons.geojson.gz + touch cell-polygons-layers.geojson.gz + touch cell-hulls.geojson.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + proseg: \$(proseg --version | sed 's/proseg //') + END_VERSIONS + """ +} diff --git a/modules/local/proseg/meta.yml b/modules/local/proseg/meta.yml new file mode 100644 index 00000000..5797863f --- /dev/null +++ b/modules/local/proseg/meta.yml @@ -0,0 +1,80 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "proseg" +## TODO nf-core: Add a description of the module and list keywords +description: Probabilistic cell segmentation for in situ spatial transcriptomics +keywords: + - segmentation + - cell segmentation + - spatialomics + - probabilistic segmentation + - in situ spatial transcriptomics +tools: + - "proseg": + ## TODO nf-core: Add a description and other details for the software below + description: "Proseg (probabilistic segmentation) is a cell segmentation method for in situ spatial transcriptomics. Xenium, CosMx, and MERSCOPE platforms are currently supported." + homepage: "https://github.com/dcjones/proseg/tree/main" + documentation: "https://github.com/dcjones/proseg/blob/main/README.md" + tool_dev_url: "https://github.com/dcjones/proseg" + doi: "" + licence: ["GNU Public License"] + +input: + - - meta: + type: map + description: | + Groovy Map containing run information + e.g. `[ id:'run_id']` + - transcripts: + type: file + description: | + File containing the transcript position + pattern: "transcripts.csv.gz" + +output: + - - meta: + type: map + description: | + Groovy Map containing run information + e.g. `[ id:'run_id']` + - cell_polygons: + type: file + description: 2D polygons for each cell in GeoJSON format. These are flattened from 3D + pattern: "cell-polygons.geojson.gz" + - - expected_counts: + type: file + description: cell-by-gene count matrix + pattern: "expected-counts.csv.gz" + - - cell_metadata: + type: file + description: Cell centroids, volume, and other information + pattern: "cell-metadata.csv.gz" + - - transcript_metadata: + type: file + description: Transcript ids, genes, revised positions, assignment probability + pattern: "transcript-metadata.csv.gz" + - - gene_metadata: + type: file + description: Per-gene summary statistics + pattern: "gene-metadata.csv.gz" + - - rates: + type: file + description: Cell-by-gene Poisson rate parameters + pattern: "rates.csv.gz" + - - cell_polygon_layers: + type: file + description: A separate, non-overlapping cell polygon for each z-layer, preserving 3D segmentation + pattern: "cell-polygons-layers.geojson.gz" + - - cell_hulls: + type: file + description: Convex hulls around assigned transcripts + pattern: "cell-hulls.geojson.gz" + - - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@khersameesh24" +maintainers: + - "@khersameesh24" diff --git a/modules/local/proseg/nextflow.config b/modules/local/proseg/nextflow.config new file mode 100644 index 00000000..826e3341 --- /dev/null +++ b/modules/local/proseg/nextflow.config @@ -0,0 +1,3 @@ +params { + preset="xenium" +} diff --git a/modules/local/proseg/tests/main.nf.test b/modules/local/proseg/tests/main.nf.test new file mode 100644 index 00000000..9b8f8c35 --- /dev/null +++ b/modules/local/proseg/tests/main.nf.test @@ -0,0 +1,77 @@ +nextflow_process { + + name "Test Process PROSEG" + script "../main.nf" + process "PROSEG" + + tag "modules" + tag "modules_nfcore" + tag "proseg" + tag "segmentation" + tag "cell_segmentation" + + + setup { + run("UNZIP") { + script "modules/nf-core/unzip/main.nf" + process { + """ + input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] + """ + } + } + } + + test("proseg - transcripts.csv") { + + when { + process { + """ + input[0] = Channel.of([ + [id: "test_run_proseg"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] } + "/transcripts.csv") + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert file(process.out.expected_counts.get(0).get(1).find { file(it).name == 'expected-counts.csv.gz' }).exists() }, + { assert file(process.out.cell_metadata.get(0).get(1).find { file(it).name == 'cell-metadata.csv.gz' }).exists() }, + { assert file(process.out.transcript_metadata.get(0).get(1).find { file(it).name == 'transcript-metadata.csv.gz' }).exists() }, + { assert file(process.out.gene_metadata.get(0).get(1).find { file(it).name == 'gene-metadata.csv.gz' }).exists() }, + { assert file(process.out.rates.get(0).get(1).find { file(it).name == 'rates.csv.gz' }).exists() }, + { assert file(process.out.cell_polygons.get(0).get(1).find { file(it).name == 'cell-polygons.geojson.gz' }).exists() }, + { assert file(process.out.cell_polygons_layers.get(0).get(1).find { file(it).name == 'cell-polygons-layers.geojson.gz' }).exists() }, + { assert file(process.out.cell-hulls.get(0).get(1).find { file(it).name == 'cell-hulls.geojson.gz' }).exists() }, + ) + } + + } + + test("proseg stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [id: "test_run_proseg"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] } + "/transcripts.csv") + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/local/proseg/tests/tags.yml b/modules/local/proseg/tests/tags.yml new file mode 100644 index 00000000..8fec433a --- /dev/null +++ b/modules/local/proseg/tests/tags.yml @@ -0,0 +1,2 @@ +proseg: + - "modules/nf-core/proseg/**" From 4a088abce35cc594f8de3557ce85dd2896eebe5d Mon Sep 17 00:00:00 2001 From: khersameesh24 Date: Mon, 13 Jan 2025 16:58:05 +0000 Subject: [PATCH 2/8] added cellpose for the image seg approach --- modules.json | 5 ++ modules/nf-core/cellpose/main.nf | 58 +++++++++++++ modules/nf-core/cellpose/meta.yml | 63 ++++++++++++++ modules/nf-core/cellpose/tests/main.nf.test | 63 ++++++++++++++ .../nf-core/cellpose/tests/main.nf.test.snap | 87 +++++++++++++++++++ .../cellpose/tests/nextflow_wflows.config | 5 ++ modules/nf-core/cellpose/tests/tags.yml | 2 + 7 files changed, 283 insertions(+) create mode 100644 modules/nf-core/cellpose/main.nf create mode 100644 modules/nf-core/cellpose/meta.yml create mode 100644 modules/nf-core/cellpose/tests/main.nf.test create mode 100644 modules/nf-core/cellpose/tests/main.nf.test.snap create mode 100644 modules/nf-core/cellpose/tests/nextflow_wflows.config create mode 100644 modules/nf-core/cellpose/tests/tags.yml diff --git a/modules.json b/modules.json index a8ab9350..3cc453a3 100644 --- a/modules.json +++ b/modules.json @@ -5,6 +5,11 @@ "https://github.com/nf-core/modules.git": { "modules": { "nf-core": { + "cellpose": { + "branch": "master", + "git_sha": "666652151335353eef2fcd58880bcef5bc2928e1", + "installed_by": ["modules"] + }, "custom/dumpsoftwareversions": { "branch": "master", "git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c", diff --git a/modules/nf-core/cellpose/main.nf b/modules/nf-core/cellpose/main.nf new file mode 100644 index 00000000..f100904f --- /dev/null +++ b/modules/nf-core/cellpose/main.nf @@ -0,0 +1,58 @@ +process CELLPOSE { + tag "$meta.id" + label 'process_medium' + + container "docker.io/biocontainers/cellpose:3.0.1_cv1" + + input: + tuple val(meta), path(image) + path(model) + + output: + tuple val(meta), path("*masks.tif") , emit: mask + tuple val(meta), path("*flows.tif") , emit: flows, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "I did not manage to create a cellpose module in Conda that works in all OSes. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def model_command = model ? "--pretrained_model $model" : "" + def VERSION = '3.0.1' + """ + cellpose \\ + --image_path $image \\ + --save_tif \\ + $model_command \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cellpose: $VERSION + END_VERSIONS + """ + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "I did not manage to create a cellpose module in Conda that works in all OSes. Please use Docker / Singularity / Podman instead." + } + def prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = "3.0.1" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def name = image.name + def base = name.lastIndexOf('.') != -1 ? name[0..name.lastIndexOf('.') - 1] : name + """ + touch ${base}_cp_masks.tif + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cellpose: $VERSION + END_VERSIONS + """ + +} diff --git a/modules/nf-core/cellpose/meta.yml b/modules/nf-core/cellpose/meta.yml new file mode 100644 index 00000000..5397944b --- /dev/null +++ b/modules/nf-core/cellpose/meta.yml @@ -0,0 +1,63 @@ +name: "cellpose" +description: cellpose segments cells in images +keywords: + - segmentation + - image + - cellpose +tools: + - "cellpose": + description: "cellpose is an anatomical segmentation algorithm written in Python + 3 by Carsen Stringer and Marius Pachitariu" + homepage: "https://github.com/MouseLand/cellpose" + documentation: "https://cellpose.readthedocs.io/en/latest/command.html" + tool_dev_url: "https://github.com/MouseLand/cellpose" + doi: 10.1038/s41592-022-01663-4 + licence: ["BSD 3-Clause"] + identifier: biotools:cellpose +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + (sample id) + - image: + type: file + description: tif file for ready for segmentation + pattern: "*.{tif,tiff}" + - - model: + type: file + description: Optional input file. Cellpose 2 model trained by user using human-in-the-loop + approach. +output: + - mask: + - meta: + type: map + description: | + Groovy Map containing sample information + [sample id] + - "*masks.tif": + type: file + description: labelled mask output from cellpose in tif format + pattern: "*.{tif, tiff}" + - flows: + - meta: + type: map + description: | + Groovy Map containing sample information + [sample id] + - "*flows.tif": + type: file + description: cell flow output from cellpose + pattern: "*.{tif}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@josenimo" + - "@FloWuenne" +maintainers: + - "@josenimo" + - "@FloWuenne" + - "@kbestak" diff --git a/modules/nf-core/cellpose/tests/main.nf.test b/modules/nf-core/cellpose/tests/main.nf.test new file mode 100644 index 00000000..6a7688ba --- /dev/null +++ b/modules/nf-core/cellpose/tests/main.nf.test @@ -0,0 +1,63 @@ +nextflow_process { + + name "Test Process CELLPOSE" + script "../main.nf" + process "CELLPOSE" + + tag "modules" + tag "modules_nfcore" + tag "cellpose" + + test("cellpose - with flows, no model") { + + when { + config "./nextflow_wflows.config" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'imaging/segmentation/cycif_tonsil_registered.ome.tif', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out.mask).match("mask") }, + { assert snapshot(process.out.flows).match("flows") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + + test("cellpose - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'imaging/segmentation/cycif_tonsil_registered.ome.tif', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/cellpose/tests/main.nf.test.snap b/modules/nf-core/cellpose/tests/main.nf.test.snap new file mode 100644 index 00000000..03b4dbfc --- /dev/null +++ b/modules/nf-core/cellpose/tests/main.nf.test.snap @@ -0,0 +1,87 @@ +{ + "flows": { + "content": [ + [ + [ + { + "id": "test" + }, + "cycif_tonsil_registered.ome_flows.tif:md5,de79a792d4bebd2f9753ceb47a0de5f7" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.855256249" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.875087557" + }, + "cellpose - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "cycif_tonsil_registered.ome_cp_masks.tif:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" + ], + "flows": [ + + ], + "mask": [ + [ + { + "id": "test" + }, + "cycif_tonsil_registered.ome_cp_masks.tif:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:39.339792992" + }, + "mask": { + "content": [ + [ + [ + { + "id": "test" + }, + "cycif_tonsil_registered.ome_cp_masks.tif:md5,001ad312413f18bc2615741bd3ad12cf" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.8369758" + } +} \ No newline at end of file diff --git a/modules/nf-core/cellpose/tests/nextflow_wflows.config b/modules/nf-core/cellpose/tests/nextflow_wflows.config new file mode 100644 index 00000000..773c97bd --- /dev/null +++ b/modules/nf-core/cellpose/tests/nextflow_wflows.config @@ -0,0 +1,5 @@ +process { + withName: "CELLPOSE" { + ext.args = '--pretrained_model nuclei --diameter 9 --channel_axis 0 --no_npy --save_flows' + } +} diff --git a/modules/nf-core/cellpose/tests/tags.yml b/modules/nf-core/cellpose/tests/tags.yml new file mode 100644 index 00000000..1280d1f9 --- /dev/null +++ b/modules/nf-core/cellpose/tests/tags.yml @@ -0,0 +1,2 @@ +cellpose: + - "modules/nf-core/cellpose/**" From 60ec4023ff473a931032612ee9594b7e8c53a65e Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:34:38 +0100 Subject: [PATCH 3/8] Delete modules/local/preprocess/main.nf --- modules/local/preprocess/main.nf | 52 -------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 modules/local/preprocess/main.nf diff --git a/modules/local/preprocess/main.nf b/modules/local/preprocess/main.nf deleted file mode 100644 index 2e5cdd78..00000000 --- a/modules/local/preprocess/main.nf +++ /dev/null @@ -1,52 +0,0 @@ -process PROSEG2BAYSOR { - tag "$meta.id" - label 'process_high' - - container "nf-core/proseg:1.1.8" - - input: - path(transcript_metadata) - path(cell_polygons) - - output: - path("baysor-transcript-metadata.csv"), emit: baysor_metadata - path("baysor-cell-polygons.geojson"), emit: baysor_polygons - - script: - // Exit if running this module with -profile conda / -profile mamba - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - error "PROSEG2BAYSOR (preprocess) module does not support Conda. Please use Docker / Singularity / Podman instead." - } - - """ - proseg-to-baysor \ - ${transcript_metadata} \ - ${cell_polygons} \ - --output-transcript-metadata baysor-transcript-metadata.csv \ - --output-cell-polygons baysor-cell-polygons.geojson - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - proseg: \$(proseg --version | sed 's/proseg //') - END_VERSIONS - - """ - - stub: - // Exit if running this module with -profile conda / -profile mamba - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." - } - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - - """ - touch expected-counts.csv.gz - touch cell-metadata.csv.gz - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - proseg: \$(proseg --version | sed 's/proseg //') - END_VERSIONS - """ -} From 19a90dd8bf82c01db35f9210638c926cb54558c5 Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:35:22 +0100 Subject: [PATCH 4/8] Delete modules/local/proseg/tests/tags.yml --- modules/local/proseg/tests/tags.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 modules/local/proseg/tests/tags.yml diff --git a/modules/local/proseg/tests/tags.yml b/modules/local/proseg/tests/tags.yml deleted file mode 100644 index 8fec433a..00000000 --- a/modules/local/proseg/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -proseg: - - "modules/nf-core/proseg/**" From 697870e2e35b837f861d985bd7572e5a5da8d0af Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:35:36 +0100 Subject: [PATCH 5/8] Delete modules/local/proseg/tests/main.nf.test --- modules/local/proseg/tests/main.nf.test | 77 ------------------------- 1 file changed, 77 deletions(-) delete mode 100644 modules/local/proseg/tests/main.nf.test diff --git a/modules/local/proseg/tests/main.nf.test b/modules/local/proseg/tests/main.nf.test deleted file mode 100644 index 9b8f8c35..00000000 --- a/modules/local/proseg/tests/main.nf.test +++ /dev/null @@ -1,77 +0,0 @@ -nextflow_process { - - name "Test Process PROSEG" - script "../main.nf" - process "PROSEG" - - tag "modules" - tag "modules_nfcore" - tag "proseg" - tag "segmentation" - tag "cell_segmentation" - - - setup { - run("UNZIP") { - script "modules/nf-core/unzip/main.nf" - process { - """ - input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] - """ - } - } - } - - test("proseg - transcripts.csv") { - - when { - process { - """ - input[0] = Channel.of([ - [id: "test_run_proseg"], - ]).combine(UNZIP.out.unzipped_archive.map { it[1] } + "/transcripts.csv") - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot(process.out).match() }, - { assert file(process.out.expected_counts.get(0).get(1).find { file(it).name == 'expected-counts.csv.gz' }).exists() }, - { assert file(process.out.cell_metadata.get(0).get(1).find { file(it).name == 'cell-metadata.csv.gz' }).exists() }, - { assert file(process.out.transcript_metadata.get(0).get(1).find { file(it).name == 'transcript-metadata.csv.gz' }).exists() }, - { assert file(process.out.gene_metadata.get(0).get(1).find { file(it).name == 'gene-metadata.csv.gz' }).exists() }, - { assert file(process.out.rates.get(0).get(1).find { file(it).name == 'rates.csv.gz' }).exists() }, - { assert file(process.out.cell_polygons.get(0).get(1).find { file(it).name == 'cell-polygons.geojson.gz' }).exists() }, - { assert file(process.out.cell_polygons_layers.get(0).get(1).find { file(it).name == 'cell-polygons-layers.geojson.gz' }).exists() }, - { assert file(process.out.cell-hulls.get(0).get(1).find { file(it).name == 'cell-hulls.geojson.gz' }).exists() }, - ) - } - - } - - test("proseg stub") { - - options "-stub" - - when { - process { - """ - input[0] = Channel.of([ - [id: "test_run_proseg"], - ]).combine(UNZIP.out.unzipped_archive.map { it[1] } + "/transcripts.csv") - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } - ) - } - - } - -} From a3de022a66c81ebee8cbdf76b6e42813f418a00c Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:35:55 +0100 Subject: [PATCH 6/8] Delete modules/local/proseg/nextflow.config --- modules/local/proseg/nextflow.config | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 modules/local/proseg/nextflow.config diff --git a/modules/local/proseg/nextflow.config b/modules/local/proseg/nextflow.config deleted file mode 100644 index 826e3341..00000000 --- a/modules/local/proseg/nextflow.config +++ /dev/null @@ -1,3 +0,0 @@ -params { - preset="xenium" -} From 1d45969858b708f93905ec522e24f33df285c16b Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:36:13 +0100 Subject: [PATCH 7/8] Delete modules/local/proseg/main.nf --- modules/local/proseg/main.nf | 82 ------------------------------------ 1 file changed, 82 deletions(-) delete mode 100644 modules/local/proseg/main.nf diff --git a/modules/local/proseg/main.nf b/modules/local/proseg/main.nf deleted file mode 100644 index d67abdd7..00000000 --- a/modules/local/proseg/main.nf +++ /dev/null @@ -1,82 +0,0 @@ -process PROSEG { - tag "$meta.id" - label 'process_high' - - container "nf-core/proseg:1.1.8" - - input: - tuple val(meta), path(transcripts) - - output: - tuple val(meta), path("cell-polygons.geojson.gz"), emit: cell_polygons_2d - path("expected-counts.csv.gz"), emit: expected_counts - path("cell-metadata.csv.gz"), emit: cell_metadata - path("transcript-metadata.csv.gz"), emit: transcript_metadata - path("gene-metadata.csv.gz"), emit: gene_metadata - path("rates.csv.gz"), emit: rates - path("cell-polygons-layers.geojson.gz"), emit: cell_polygons_layers - path("cell-hulls.geojson.gz"), emit: cell_hulls - path("versions.yml"), emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - // Exit if running this module with -profile conda / -profile mamba - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." - } - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def platform = preset ? "${params.preset}" : "" - - // check for preset values - if (!(platform in ['xenium', 'cosmx', 'merscope'])) { - error "${platform} is an invalid platform (preset) type. Please specify xenium, cosmx, or merscope" - } - - """ - proseg \\ - --${preset} \\ - ${transcripts} \\ - --nthreads ${task.cpus} \\ - --output-expected-counts expected-counts.csv.gz \\ - --output-cell-metadata cell-metadata.csv.gz \\ - --output-transcript-metadata transcript-metadata.csv.gz \\ - --output-gene-metadata gene-metadata.csv.gz \\ - --output-rates rates.csv.gz \\ - --output-cell-polygons cell-polygons.geojson.gz \\ - --output-cell-polygon-layers cell-polygons-layers.geojson.gz \\ - --output-cell-hulls cell-hulls.geojson.gz \\ - ${args} - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - proseg: \$(proseg --version | sed 's/proseg //') - END_VERSIONS - """ - - stub: - // Exit if running this module with -profile conda / -profile mamba - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - error "PROSEG module does not support Conda. Please use Docker / Singularity / Podman instead." - } - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - - """ - touch expected-counts.csv.gz - touch cell-metadata.csv.gz - touch transcript-metadata.csv.gz - touch gene-metadata.csv.gz - touch rates.csv.gz - touch cell-polygons.geojson.gz - touch cell-polygons-layers.geojson.gz - touch cell-hulls.geojson.gz - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - proseg: \$(proseg --version | sed 's/proseg //') - END_VERSIONS - """ -} From 80940c9e07d6f9c2e065e5c1e415144de5cf965d Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Fri, 24 Jan 2025 13:36:36 +0100 Subject: [PATCH 8/8] Delete modules/local/proseg/meta.yml --- modules/local/proseg/meta.yml | 80 ----------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 modules/local/proseg/meta.yml diff --git a/modules/local/proseg/meta.yml b/modules/local/proseg/meta.yml deleted file mode 100644 index 5797863f..00000000 --- a/modules/local/proseg/meta.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json -name: "proseg" -## TODO nf-core: Add a description of the module and list keywords -description: Probabilistic cell segmentation for in situ spatial transcriptomics -keywords: - - segmentation - - cell segmentation - - spatialomics - - probabilistic segmentation - - in situ spatial transcriptomics -tools: - - "proseg": - ## TODO nf-core: Add a description and other details for the software below - description: "Proseg (probabilistic segmentation) is a cell segmentation method for in situ spatial transcriptomics. Xenium, CosMx, and MERSCOPE platforms are currently supported." - homepage: "https://github.com/dcjones/proseg/tree/main" - documentation: "https://github.com/dcjones/proseg/blob/main/README.md" - tool_dev_url: "https://github.com/dcjones/proseg" - doi: "" - licence: ["GNU Public License"] - -input: - - - meta: - type: map - description: | - Groovy Map containing run information - e.g. `[ id:'run_id']` - - transcripts: - type: file - description: | - File containing the transcript position - pattern: "transcripts.csv.gz" - -output: - - - meta: - type: map - description: | - Groovy Map containing run information - e.g. `[ id:'run_id']` - - cell_polygons: - type: file - description: 2D polygons for each cell in GeoJSON format. These are flattened from 3D - pattern: "cell-polygons.geojson.gz" - - - expected_counts: - type: file - description: cell-by-gene count matrix - pattern: "expected-counts.csv.gz" - - - cell_metadata: - type: file - description: Cell centroids, volume, and other information - pattern: "cell-metadata.csv.gz" - - - transcript_metadata: - type: file - description: Transcript ids, genes, revised positions, assignment probability - pattern: "transcript-metadata.csv.gz" - - - gene_metadata: - type: file - description: Per-gene summary statistics - pattern: "gene-metadata.csv.gz" - - - rates: - type: file - description: Cell-by-gene Poisson rate parameters - pattern: "rates.csv.gz" - - - cell_polygon_layers: - type: file - description: A separate, non-overlapping cell polygon for each z-layer, preserving 3D segmentation - pattern: "cell-polygons-layers.geojson.gz" - - - cell_hulls: - type: file - description: Convex hulls around assigned transcripts - pattern: "cell-hulls.geojson.gz" - - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" - -authors: - - "@khersameesh24" -maintainers: - - "@khersameesh24"