Skip to content

Commit

Permalink
bug fix for issue nf-core#27; split basicpy output by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
RobJY committed May 8, 2024
1 parent c0689fa commit f26879f
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 31 deletions.
8 changes: 7 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ process {
publishDir = [
path: { "${params.outdir}/illumination_correction/basicpy" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
saveAs: { filename ->
if (filename.equals('versions.yml')) {
filename
} else {
meta.id + "_" + filename
}
}
]
}

Expand Down
4 changes: 2 additions & 2 deletions subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def validateInputSamplesheetRow ( row, mode ) {
if (mode == "sample") {
// check for the existence of all files under cycle_image column in the given image_directory
if (row.size() >= 3 && row[2] != []) {
def file_list = row[2].split(" ")
def file_list = row[2].split(";")
file_list.each { curr_file ->
def curr_path = file(row[1].toString() + "/" + curr_file)
if (!curr_path.exists()) {
Expand Down Expand Up @@ -315,7 +315,7 @@ def make_ashlar_input_sample( samplesheet_row ) {
if (tmp_path[-1] != "/") {
tmp_path = "${tmp_path}/"
}
cycle_images = samplesheet_row[index_sample_cycle_images].split(' ').collect{ "${tmp_path}${it}" }
cycle_images = samplesheet_row[index_sample_cycle_images].split(';').collect{ "${tmp_path}${it}" }
cycle_images.each{ file_path ->
def file_test = file(file_path)
if (!file_test.exists()) {
Expand Down
52 changes: 28 additions & 24 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ nextflow_workflow {
ImageUtils.getImageMetadata("$outputDir/registration/ashlar/TEST1.ome.tif"),
ImageUtils.getImageMetadata("$outputDir/segmentation/deepcell_mesmer/mask_TEST1.tif"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/TEST1_mask_TEST1.csv"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-ffp.tiff")
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-ffp.tiff")
).match()
},
{ assert workflow.success }
Expand Down Expand Up @@ -308,12 +308,12 @@ nextflow_workflow {
ImageUtils.getImageMetadata("$outputDir/registration/ashlar/cycif-tonsil.ome.tif"),
ImageUtils.getImageMetadata("$outputDir/segmentation/deepcell_mesmer/mask_cycif-tonsil.tif"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/cycif-tonsil_mask_cycif-tonsil.csv"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-ffp.tiff")
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle3.ome-ffp.tiff")
).match()
},
{ assert workflow.success }
Expand Down Expand Up @@ -362,12 +362,14 @@ nextflow_workflow {
path("$outputDir/segmentation/deepcell_mesmer/mask_cycif-tonsil2.tif"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/cycif-tonsil_mask_cycif-tonsil.csv"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/cycif-tonsil2_mask_cycif-tonsil2.csv"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-ffp.tiff")
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil_cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil2_cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil2_cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil2_cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil2_cycif-tonsil-cycle3.ome-ffp.tiff")
).match()
},
{ assert workflow.success }
Expand Down Expand Up @@ -441,10 +443,10 @@ nextflow_workflow {
ImageUtils.getImageMetadata("$outputDir/registration/ashlar/TEST1.ome.tif"),
ImageUtils.getImageMetadata("$outputDir/segmentation/deepcell_mesmer/mask_TEST1.tif"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/TEST1_mask_TEST1.csv"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-ffp.tiff")
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle2.ome-ffp.tiff")
).match()
},
{ assert workflow.success }
Expand Down Expand Up @@ -495,12 +497,14 @@ nextflow_workflow {
ImageUtils.getImageMetadata("$outputDir/segmentation/deepcell_mesmer/mask_TEST2.tif"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/TEST1_mask_TEST1.csv"),
CsvUtils.summarizeCsv("$outputDir/quantification/mcquant/TEST2_mask_TEST2.csv"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/cycif-tonsil-cycle3.ome-ffp.tiff")
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle1.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle2.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST1_cycif-tonsil-cycle2.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST2_cycif-tonsil-cycle3.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST2_cycif-tonsil-cycle3.ome-ffp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST2_cycif-tonsil-cycle1.ome-dfp.tiff"),
ImageUtils.getImageMetadata("$outputDir/illumination_correction/basicpy/TEST2_cycif-tonsil-cycle1.ome-ffp.tiff")
).match()
},
{ assert workflow.success }
Expand Down
48 changes: 48 additions & 0 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,30 @@
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
"sizeX": 220,
"sizeY": 180,
"sizeZ": 1,
"sizeC": 4,
"sizeT": 1,
"physicalSizeX": 1.0,
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
"sizeX": 220,
"sizeY": 180,
"sizeZ": 1,
"sizeC": 4,
"sizeT": 1,
"physicalSizeX": 1.0,
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
Expand Down Expand Up @@ -718,6 +742,30 @@
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
"sizeX": 220,
"sizeY": 180,
"sizeZ": 1,
"sizeC": 4,
"sizeT": 1,
"physicalSizeX": 1.0,
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
"sizeX": 220,
"sizeY": 180,
"sizeZ": 1,
"sizeC": 4,
"sizeT": 1,
"physicalSizeX": 1.0,
"physicalSizeY": 1.0,
"physicalSizeZ": null
},
{
"format": "Tagged Image File Format",
"type": "float",
Expand Down
8 changes: 4 additions & 4 deletions workflows/mcmicro.nf
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ workflow MCMICRO {

ch_samplesheet
.transpose()
.map { [[it[1].split('/')[-1][0..-5],it[0]], it[1]] }
.map { [[it[1].toString().split('/')[-1][0..-5],it[0]], it[1]] }
.set { ashlar_input_keyed }

ch_samplesheet
.transpose()
.set { ch_basicpy_input }
ch_samplesheet
.transpose()
.set { ch_basicpy_input }

BASICPY(ch_basicpy_input)
ch_versions = ch_versions.mix(BASICPY.out.versions)
Expand Down

0 comments on commit f26879f

Please sign in to comment.