Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/nf-core/stainwarpy/extractchannel/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::stainwarpy=0.2.3
36 changes: 36 additions & 0 deletions modules/nf-core/stainwarpy/extractchannel/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
process STAINWARPY_EXTRACTCHANNEL {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'oras://community.wave.seqera.io/library/stainwarpy:0.2.3--5966e23f2f7d254a' :
'community.wave.seqera.io/library/stainwarpy:0.2.3--2c8b18a5e6d93e4a'}"

input:
tuple val(meta), path(multiplx_img)

output:
tuple val(meta), path("multiplexed_single_channel_img.ome.tif") , emit: single_ch_image
tuple val("${task.process}"), val('stainwarpy'), eval("stainwarpy --version | sed 's/.* //'"), emit: versions_stainwarpy_extractchannel, topic: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''

"""
stainwarpy \\
extract-channel \\
${multiplx_img} \\
. \\
${args}
"""

stub:

"""
touch multiplexed_single_channel_img.ome.tif
"""
}
70 changes: 70 additions & 0 deletions modules/nf-core/stainwarpy/extractchannel/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "stainwarpy_extractchannel"
description: Extract a single channel image from multiplexed tissue images using stainwarpy
keywords:
- image registration
- histology
- hne
- multiplexed
- channel extraction
tools:
- "stainwarpy":
description: "Register H&E stained and Multiplexed tissue images using feature-based image registration"
homepage: "https://github.com/tckumarasekara/stainwarpy"
documentation: "https://github.com/tckumarasekara/stainwarpy"
tool_dev_url: "https://github.com/tckumarasekara/stainwarpy"
licence: ["MIT License", "Apache-2.0"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- multiplx_img:
type: file
description: Multiplexed image file
pattern: "*.{ome.tif,ome.tiff,tif,tiff}"
ontologies:
- edam: "http://edamontology.org/format_3727"
- edam: "http://edamontology.org/format_3591"

output:
single_ch_image:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "multiplexed_single_channel_img.ome.tif":
type: file
description: Single channel extracted image file in OME-TIFF format
pattern: "multiplexed_single_channel_img.ome.tif"
ontologies:
- edam: "http://edamontology.org/format_3727"
versions_stainwarpy_extractchannel:
- - "${task.process}":
type: string
description: The name of the process
- "stainwarpy":
type: string
description: The name of the tool
- "stainwarpy --version | sed 's/.* //'":
type: eval
description: The expression to obtain the version of the tool

topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- stainwarpy:
type: string
description: The name of the tool
- stainwarpy --version | sed 's/.* //':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@tckumarasekara"
maintainers:
- "@tckumarasekara"
70 changes: 70 additions & 0 deletions modules/nf-core/stainwarpy/extractchannel/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
nextflow_process {

name "Test Process STAINWARPY_EXTRACTCHANNEL"
script "../main.nf"
process "STAINWARPY_EXTRACTCHANNEL"

tag "modules"
tag "modules_nfcore"
tag "stainwarpy"
tag "stainwarpy/extractchannel"

config "./nextflow.config"

test("colon_tissue_local - ome.tif") {

when {
params {
modules_args = "--channel-idx 0"
}
process {
"""
input[0] = [
[ id:'sample1'],
file(params.modules_testdata_base_path + 'imaging/hne_multiplexed/multiplexed_image_colon.ome.tif', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.single_ch_image.get(0).get(1)).exists(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the file in question indeterministic? Is there any data in the channel that is not checked here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, yes, the output file is non-deterministic between runs due to metadata (ef: UUIDs) and minor floating-point differences. This is the case for the other modules also. This module emits just one file in a tuple.

process.out.findAll { key, val -> key.startsWith("versions")}
).match()
}
)
}

}

test("colon_tissue_local - ome.tif - stub") {

options "-stub"

when {
params {
modules_args = null
}
process {
"""
input[0] = [
[ id:'sample1'],
file(params.modules_testdata_base_path + 'imaging/hne_multiplexed/multiplexed_image_colon.ome.tif', checkIfExists: true)
]
"""
}
}

then {
{ assert snapshot(
process.out.single_ch_image,
process.out.findAll { key, val -> key.startsWith("versions")}
).match() }
}

}

}
47 changes: 47 additions & 0 deletions modules/nf-core/stainwarpy/extractchannel/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"colon_tissue_local - ome.tif": {
"content": [
true,
{
"versions_stainwarpy_extractchannel": [
[
"STAINWARPY_EXTRACTCHANNEL",
"stainwarpy",
"0.2.3"
]
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2026-01-26T12:55:18.107266402"
},
"colon_tissue_local - ome.tif - stub": {
"content": [
[
[
{
"id": "sample1"
},
"multiplexed_single_channel_img.ome.tif:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
{
"versions_stainwarpy_extractchannel": [
[
"STAINWARPY_EXTRACTCHANNEL",
"stainwarpy",
"0.2.3"
]
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2026-01-26T12:55:26.070540691"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: STAINWARPY_EXTRACTCHANNEL {
ext.args = params.modules_args ?: ''
}
}
Loading