From d4411755a3ca05f138a75e330ef3cff2023a9c66 Mon Sep 17 00:00:00 2001 From: RobJY Date: Tue, 7 May 2024 16:48:11 -0400 Subject: [PATCH] added nf-validation to check for most file existence --- assets/schema_input_cycle.json | 8 +++++++- assets/schema_input_sample.json | 4 ++++ subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/assets/schema_input_cycle.json b/assets/schema_input_cycle.json index 9eb8e1f..c479c34 100644 --- a/assets/schema_input_cycle.json +++ b/assets/schema_input_cycle.json @@ -22,17 +22,23 @@ }, "image_tiles": { "type": "string", + "format": "file-path", "pattern": "^\\S+$", - "errorMessage": "Need to provide a path to a directory containing image files" + "exists": true, + "errorMessage": "Need to provide a path to image file(s)" }, "dfp": { "type": "string", + "format": "file-path", "pattern": "^\\S+$", + "exists": true, "errorMessage": "provide path to dfp illumination correction file(s) if illumination parameter is manual" }, "ffp": { "type": "string", + "format": "file-path", "pattern": "^\\S+$", + "exists": true, "errorMessage": "provide path to ffp illumination correction file(s) if illumination parameter is manual" } }, diff --git a/assets/schema_input_sample.json b/assets/schema_input_sample.json index 113ef55..7122afa 100644 --- a/assets/schema_input_sample.json +++ b/assets/schema_input_sample.json @@ -24,12 +24,16 @@ }, "dfp": { "type": "string", + "format": "file-path", "pattern": "^\\S+$", + "exists": true, "errorMessage": "provide path to dfp illumination correction file(s) if illumination parameter is manual" }, "ffp": { "type": "string", + "format": "file-path", "pattern": "^\\S+$", + "exists": true, "errorMessage": "provide path to ffp illumination correction file(s) if illumination parameter is manual" } }, diff --git a/subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf b/subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf index 2fb5700..21cd0e1 100644 --- a/subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_mcmicro_pipeline/main.nf @@ -264,7 +264,7 @@ def validateInputSamplesheetRow ( row, mode ) { if (row.size() >= 3 && row[2] != []) { def file_list = row[2].split(" ") file_list.each { curr_file -> - def curr_path = new File(row[1].toString() + "/" + curr_file) + def curr_path = file(row[1].toString() + "/" + curr_file) if (!curr_path.exists()) { error("Error: file in samplesheet not found: $curr_path") } @@ -317,7 +317,7 @@ def make_ashlar_input_sample( samplesheet_row ) { } cycle_images = samplesheet_row[index_sample_cycle_images].split(' ').collect{ "${tmp_path}${it}" } cycle_images.each{ file_path -> - def file_test = new File(file_path) + def file_test = file(file_path) if (!file_test.exists()) { Nextflow.error("Error: ${file_path} does not exist!") }