Skip to content

Commit

Permalink
FEAT: untar input directory if needed. (#4)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
DriesSchaumont and tverbeiren authored May 2, 2024
1 parent 6f5b76b commit 77843cd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target
testData

# Nextflow related files
.nextflow
work
2 changes: 1 addition & 1 deletion _viash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/demultiplex/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ test_resources:
entrypoint: test_wf

dependencies:
- name: io/untar
repository: local
- name: bcl_convert
repository: bb

Expand Down
10 changes: 10 additions & 0 deletions src/demultiplex/integration_tests.sh
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
14 changes: 13 additions & 1 deletion src/demultiplex/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
9 changes: 4 additions & 5 deletions src/demultiplex/test.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
]
])
Expand Down
6 changes: 5 additions & 1 deletion src/io/untar/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ test_resources:
path: test.sh
engines:
- type: docker
image: debian:stable-slim
image: debian:stable-slim

runners:
- type: executable
- type: nextflow

0 comments on commit 77843cd

Please sign in to comment.