Skip to content
Open
2 changes: 2 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ process {
}

withName: "CELLPOSE" {
ext.args = {"--channel_axis 0"}
ext.when = {params.segmentation && params.segmentation.split(',').contains('cellpose')}
publishDir = [
path: { "${params.outdir}/segmentation/cellpose" },
Expand All @@ -82,6 +83,7 @@ process {
}

withName: "MCCELLPOSE" {
ext.args = { "--pixel-size=${meta.pixel_size}" }
ext.when = {params.segmentation && params.segmentation.split(',').contains('mccellpose')}
publishDir = [
path: { "${params.outdir}/segmentation/mccellpose" },
Expand Down
3 changes: 2 additions & 1 deletion modules/nf-core/cellpose/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions modules/nf-core/deepcell/mesmer/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 33 additions & 23 deletions workflows/mcmicro.nf
Original file line number Diff line number Diff line change
Expand Up @@ -126,34 +126,44 @@ workflow MCMICRO {
}

// Run Segmentation
// Each segmenter is conditionally invoked based on params.segmentation to avoid
// input validation errors on AWS Batch when the process would be skipped by ext.when

ch_masks = channel.empty()

ch_segmentation_input
.multiMap{ meta, image ->
img: [meta + [segmenter: 'mesmer'], image]
membrane_img: [[:], []]
}
| DEEPCELL_MESMER
ch_masks = ch_masks.mix(DEEPCELL_MESMER.out.mask)
ch_versions = ch_versions.mix(DEEPCELL_MESMER.out.versions)
if (params.segmentation?.split(',')?.contains('mesmer')) {
ch_segmentation_input
.multiMap{ meta, image ->
img: [meta + [segmenter: 'mesmer'], image]
membrane_img: [[:], []]
}
| DEEPCELL_MESMER
ch_masks = ch_masks.mix(DEEPCELL_MESMER.out.mask)
ch_versions = ch_versions.mix(DEEPCELL_MESMER.out.versions)
}

ch_segmentation_input
.multiMap{ meta, image ->
image: [meta + [segmenter: 'cellpose'], image]
model: params.cellpose_model
}
| CELLPOSE
ch_masks = ch_masks.mix(CELLPOSE.out.mask)
ch_versions = ch_versions.mix(CELLPOSE.out.versions)
if (params.segmentation?.split(',')?.contains('cellpose')) {
ch_cellpose_image = ch_segmentation_input
.map{ meta, image -> [meta + [segmenter: 'cellpose'], image] }

ch_segmentation_input
.multiMap{ meta, image ->
image: [meta + [segmenter: 'mccellpose'], image]
}
| MCCELLPOSE
ch_masks = ch_masks.mix(MCCELLPOSE.out.mask)
ch_versions = ch_versions.mix(MCCELLPOSE.out.versions)
ch_cellpose_model = params.cellpose_model
? Channel.fromPath(params.cellpose_model, checkIfExists: true)
: Channel.value([])

CELLPOSE(ch_cellpose_image, ch_cellpose_model)
ch_masks = ch_masks.mix(CELLPOSE.out.mask)
ch_versions = ch_versions.mix(CELLPOSE.out.versions)
}

if (params.segmentation?.split(',')?.contains('mccellpose')) {
ch_segmentation_input
.multiMap{ meta, image ->
image: [meta + [segmenter: 'mccellpose'], image]
}
| MCCELLPOSE
ch_masks = ch_masks.mix(MCCELLPOSE.out.mask)
ch_versions = ch_versions.mix(MCCELLPOSE.out.versions)
}

// Run Quantification

Expand Down
Loading