diff --git a/.gitignore b/.gitignore index ef35658..b82a948 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ -.DS_Store \ No newline at end of file +.DS_Store + +work/ \ No newline at end of file diff --git a/workflow/main.nf b/workflow/main.nf new file mode 100644 index 0000000..a8b0911 --- /dev/null +++ b/workflow/main.nf @@ -0,0 +1,84 @@ +#!/usr/bin/env nextflow +nextflow.enable.dsl = 2 + +params.slide_table = null +params.tile_px = 256 +params.report_dir = "reports" +params.models = "resnet50" + +process PREPROCESS { + publishDir params.report_dir, mode: 'move' + + input: + tuple val(wsi), val(storage) + val tile_px + + output: + path '*_report.txt', emit: report + tuple val(wsi), val(storage), emit: slide + + script: + + def wsi_base = wsi.baseName + + """ + lazyslide preprocess ${wsi} ${tile_px} --output ${storage} + touch ${wsi_base}_report.txt + """ +} + +process FEATURE { + + input: + tuple val(wsi), val(storage) + each model + + script: + """ + lazyslide feature ${wsi} ${model} --output ${storage} + """ +} + + + +workflow { + + log.info """ + ██ █████ ███████ ██ ██ ███████ ██ ██ ██████ ███████ + ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ███████ ███ ████ ███████ ██ ██ ██ ██ █████ + ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ + ███████ ██ ██ ███████ ██ ███████ ███████ ██ ██████ ███████ + + =================================================================== + + Workflow information: + Workflow: ${workflow.projectDir} + + Input parameters: + Slide table: ${file(params.slide_table)} + + """ + + slides_ch = Channel + .fromPath( params.slide_table, checkIfExists: true ) + .splitCsv( header: true ) + .map { row -> + def slide_file = file(row.file, checkIfExists: true) + def slide_storage = row.storage + if (row.storage == null) { slide_storage = slide_file.parent / slide_file.baseName + ".zarr" } + return tuple(slide_file, slide_storage) + } + + // slides_ch.view() + + out_ch = PREPROCESS(slides_ch, params.tile_px) + + // println "Ouput of PREPROCESS: " + // out_ch.slide.view() + + models = Channel.of(params.models?.split(',')) + + FEATURE(out_ch.slide, models) + +} \ No newline at end of file diff --git a/workflow/modules/qc/main.nf b/workflow/modules/qc/main.nf new file mode 100644 index 0000000..197ce5f --- /dev/null +++ b/workflow/modules/qc/main.nf @@ -0,0 +1,18 @@ +#!/usr/bin/env nextflow +nextflow.enable.dsl = 2 + +process SlideQC { + + input: + val mpp + val + path slide + + output: + path("*.qc.csv") into qc_ch + + script: + """ + lazyslide qc $slide + """ +} \ No newline at end of file