From 77843cd2c421693b84a694930918e1196854903c Mon Sep 17 00:00:00 2001 From: Dries Schaumont <5946712+DriesSchaumont@users.noreply.github.com> Date: Thu, 2 May 2024 13:32:32 +0200 Subject: [PATCH] FEAT: untar input directory if needed. (#4) * FEAT: untar input directory if needed. * Fixes to untar component * Fix workflow including untar * Check for .tar and .tgz as well * Remove debugging output from tar component * Add target and testData folder to .gitignore * Update to latest release candidate * Add .nextflow and work to .gitignore * Add runners to untar component * Update workflow integration test * Remove leftover view --------- Co-authored-by: Toni Verbeiren --- .gitignore | 6 ++++++ _viash.yaml | 2 +- src/demultiplex/config.vsh.yaml | 2 ++ src/demultiplex/integration_tests.sh | 10 ++++++++++ src/demultiplex/main.nf | 14 +++++++++++++- src/demultiplex/test.nf | 9 ++++----- src/io/untar/config.vsh.yaml | 6 +++++- 7 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e379c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +target +testData + +# Nextflow related files +.nextflow +work \ No newline at end of file diff --git a/_viash.yaml b/_viash.yaml index ee18185..e5e310d 100644 --- a/_viash.yaml +++ b/_viash.yaml @@ -7,4 +7,4 @@ links: issue_tracker: https://github.com/viash-hub/demultiplex.vsh/issues repository: https://github.com/viash-hub/demultiplex.vsh -viash_version: 0.9.0-RC2 +viash_version: 0.9.0-RC3 diff --git a/src/demultiplex/config.vsh.yaml b/src/demultiplex/config.vsh.yaml index 401e150..f840a76 100644 --- a/src/demultiplex/config.vsh.yaml +++ b/src/demultiplex/config.vsh.yaml @@ -29,6 +29,8 @@ test_resources: entrypoint: test_wf dependencies: + - name: io/untar + repository: local - name: bcl_convert repository: bb diff --git a/src/demultiplex/integration_tests.sh b/src/demultiplex/integration_tests.sh index 6299962..d327e36 100755 --- a/src/demultiplex/integration_tests.sh +++ b/src/demultiplex/integration_tests.sh @@ -1,3 +1,13 @@ +#!/usr/bin/env bash + +# get the root of the directory +REPO_ROOT=$(git rev-parse --show-toplevel) + +# ensure that the command below is run from the root of the repository +cd "$REPO_ROOT" + +viash ns build -q 'untar|demultiplex' --setup cb + nextflow run . \ -main-script src/demultiplex/test.nf \ -profile docker,no_publish \ diff --git a/src/demultiplex/main.nf b/src/demultiplex/main.nf index 56d3274..2cae23b 100644 --- a/src/demultiplex/main.nf +++ b/src/demultiplex/main.nf @@ -4,7 +4,19 @@ workflow run_wf { main: output_ch = input_ch - + // untar input if needed + | untar.run( + runIf: {id, state -> + def inputStr = state.input.toString() + inputStr.endsWith(".tar.gz") || inputStr.endsWith(".tar") || inputStr.endsWith(".tgz") ? true : false + }, + fromState: [ + "input": "input", + ], + toState: { id, result, state -> + state + [ input: result.output ] + }, + ) // run bcl_convert | bcl_convert.run( fromState: { id, state -> diff --git a/src/demultiplex/test.nf b/src/demultiplex/test.nf index 65e8378..51a5e03 100644 --- a/src/demultiplex/test.nf +++ b/src/demultiplex/test.nf @@ -3,13 +3,12 @@ nextflow.enable.dsl=2 include { demultiplex } from params.rootDir + "/target/nextflow/demultiplex/main.nf" workflow test_wf { - // allow changing the resources_test dir - resources_test = file("${params.rootDir}/testData") - output_ch = Channel.fromList([ [ - sample_sheet: resources_test.resolve("bcl_convert_samplesheet.csv"), - input: resources_test.resolve("iseq-DI/"), + // sample_sheet: resources_test.resolve("bcl_convert_samplesheet.csv"), + // input: resources_test.resolve("iseq-DI/"), + sample_sheet: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/SampleSheet.csv", + input: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz", publish_dir: "output_dir/", ] ]) diff --git a/src/io/untar/config.vsh.yaml b/src/io/untar/config.vsh.yaml index 55eba97..a8ac4ac 100644 --- a/src/io/untar/config.vsh.yaml +++ b/src/io/untar/config.vsh.yaml @@ -33,4 +33,8 @@ test_resources: path: test.sh engines: - type: docker - image: debian:stable-slim \ No newline at end of file + image: debian:stable-slim + +runners: + - type: executable + - type: nextflow \ No newline at end of file