diff --git a/_viash.yaml b/_viash.yaml index 4c5b1da..b3a09d4 100644 --- a/_viash.yaml +++ b/_viash.yaml @@ -11,7 +11,7 @@ info: - path: https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz dest: test_resources -viash_version: 0.9.0-RC6 +viash_version: 0.9.0 config_mods: | .requirements.commands := ['ps'] diff --git a/target/executable/io/interop_summary_to_csv/.config.vsh.yaml b/target/executable/io/interop_summary_to_csv/.config.vsh.yaml index 1510d4b..5fb1fd8 100644 --- a/target/executable/io/interop_summary_to_csv/.config.vsh.yaml +++ b/target/executable/io/interop_summary_to_csv/.config.vsh.yaml @@ -140,8 +140,8 @@ build_info: engine: "docker|native" output: "target/executable/io/interop_summary_to_csv" executable: "target/executable/io/interop_summary_to_csv/interop_summary_to_csv" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -151,7 +151,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/executable/io/interop_summary_to_csv/interop_summary_to_csv b/target/executable/io/interop_summary_to_csv/interop_summary_to_csv index f0d7231..eca9597 100755 --- a/target/executable/io/interop_summary_to_csv/interop_summary_to_csv +++ b/target/executable/io/interop_summary_to_csv/interop_summary_to_csv @@ -2,9 +2,9 @@ # interop_summary_to_csv main # -# This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -# derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -# Data Intuitive. +# This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +# Intuitive. # # The component may contain files which fall under a different license. The # authors of this component should specify the license in the header of such @@ -54,24 +54,24 @@ function ViashRemoveFlags { # $1 : Should always be set to ${BASH_SOURCE[0]} # returns : The absolute path of the bash file function ViashSourceDir { - SOURCE="$1" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + local source="$1" + while [ -h "$source" ]; do + local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" done - cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd + cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd } # ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks # usage : ViashFindTargetDir 'ScriptPath' # $1 : The location from where to start the upward search # returns : The absolute path of the '.build.yaml' file function ViashFindTargetDir { - SOURCE="$1" - while [[ "$SOURCE" != "" && ! -e "$SOURCE/.build.yaml" ]]; do - SOURCE=${SOURCE%/*} + local source="$1" + while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do + source=${source%/*} done - echo $SOURCE + echo $source } # see https://en.wikipedia.org/wiki/Syslog#Severity_level VIASH_LOGCODE_EMERGENCY=0 @@ -205,9 +205,9 @@ function ViashDockerInstallationCheck { fi ViashDebug "Checking whether the Docker daemon is running" - save=$-; set +e - docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) - out=$? + local save=$-; set +e + local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashCritical "Docker daemon does not seem to be running. Try one of the following:" @@ -259,9 +259,9 @@ function ViashDockerPull { if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker pull $1 && return 0 || return 1 else - save=$-; set +e + local save=$-; set +e docker pull $1 2> /dev/null > /dev/null - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible." @@ -281,7 +281,8 @@ function ViashDockerPull { # echo $? # returns '1' function ViashDockerPush { ViashNotice "Pushing image to '$1'" - save=$-; set +e + local save=$-; set +e + local out if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker push $1 out=$? @@ -305,9 +306,9 @@ function ViashDockerPush { # examples: # ViashDockerPullElseBuild mynewcomponent function ViashDockerPullElseBuild { - save=$-; set +e + local save=$-; set +e ViashDockerPull $1 - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashDockerBuild $@ @@ -469,9 +470,9 @@ tar -C /tmp/ --no-same-owner --no-same-permissions -xvf /tmp/interop.tar.gz && \ mv /tmp/interop-1.3.1-Linux-GNU/bin/index-summary /tmp/interop-1.3.1-Linux-GNU/bin/summary /usr/local/bin/ LABEL org.opencontainers.image.description="Companion container for running component io interop_summary_to_csv" -LABEL org.opencontainers.image.created="2024-06-24T12:46:52Z" +LABEL org.opencontainers.image.created="2024-09-12T12:25:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/demultiplex" -LABEL org.opencontainers.image.revision="ed860bed30c98b981270f104cffbdb9b7f1ce141" +LABEL org.opencontainers.image.revision="cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" LABEL org.opencontainers.image.version="main" VIASHDOCKER @@ -498,6 +499,9 @@ function ViashDockerBuildArgs { # ViashAbsolutePath /foo/bar/.. # returns /foo function ViashAbsolutePath { local thePath + local parr + local outp + local len if [[ ! "$1" =~ ^/ ]]; then thePath="$PWD/$1" else @@ -528,14 +532,17 @@ function ViashAbsolutePath { ) } # ViashDockerAutodetectMount: auto configuring docker mounts from parameters -# $1 : The parameter value -# returns : New parameter -# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $1 : The parameter value +# returns : New parameter +# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts # examples: # ViashDockerAutodetectMount /path/to/bar # returns '/viash_automount/path/to/bar' # ViashDockerAutodetectMountArg /path/to/bar # returns '--volume="/path/to:/viash_automount/path/to"' function ViashDockerAutodetectMount { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -543,7 +550,7 @@ function ViashDockerAutodetectMount { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" if [ -z "$base_name" ]; then echo "$mount_target" else @@ -551,7 +558,9 @@ function ViashDockerAutodetectMount { fi } function ViashDockerAutodetectMountArg { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -559,17 +568,22 @@ function ViashDockerAutodetectMountArg { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target" echo "--volume=\"$mount_source:$mount_target\"" } function ViashDockerStripAutomount { - abs_path=$(ViashAbsolutePath "$1") - echo "${abs_path#/viash_automount}" + local abs_path=$(ViashAbsolutePath "$1") + echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}" } # initialise variables VIASH_DIRECTORY_MOUNTS=() +# configure default docker automount prefix if it is unset +if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then + VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount" +fi + # initialise docker variables VIASH_DOCKER_RUN_ARGS=(-i --rm) @@ -653,6 +667,18 @@ while [[ $# -gt 0 ]]; do VIASH_MODE='dockerfile' shift 1 ;; + ---docker_run_args) + VIASH_DOCKER_RUN_ARGS+=("$2") + shift 2 + ;; + ---docker_run_args=*) + VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")") + shift 1 + ;; + ---docker_image_id) + VIASH_MODE='docker_image_id' + shift 1 + ;; ---debug) VIASH_MODE='debug' shift 1 @@ -714,6 +740,10 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then if [ "$VIASH_MODE" == "dockerfile" ]; then ViashDockerfile "$VIASH_ENGINE_ID" exit 0 + + elif [ "$VIASH_MODE" == "docker_image_id" ]; then + echo "$VIASH_DOCKER_IMAGE_ID" + exit 0 # enter docker container elif [[ "$VIASH_MODE" == "debug" ]]; then diff --git a/target/executable/io/untar/.config.vsh.yaml b/target/executable/io/untar/.config.vsh.yaml index 89406ce..ddb29d5 100644 --- a/target/executable/io/untar/.config.vsh.yaml +++ b/target/executable/io/untar/.config.vsh.yaml @@ -147,8 +147,8 @@ build_info: engine: "docker|native" output: "target/executable/io/untar" executable: "target/executable/io/untar/untar" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -158,7 +158,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/executable/io/untar/untar b/target/executable/io/untar/untar index 435fbb1..6d87b4d 100755 --- a/target/executable/io/untar/untar +++ b/target/executable/io/untar/untar @@ -2,9 +2,9 @@ # untar main # -# This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -# derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -# Data Intuitive. +# This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +# Intuitive. # # The component may contain files which fall under a different license. The # authors of this component should specify the license in the header of such @@ -54,24 +54,24 @@ function ViashRemoveFlags { # $1 : Should always be set to ${BASH_SOURCE[0]} # returns : The absolute path of the bash file function ViashSourceDir { - SOURCE="$1" - while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" + local source="$1" + while [ -h "$source" ]; do + local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" done - cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd + cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd } # ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks # usage : ViashFindTargetDir 'ScriptPath' # $1 : The location from where to start the upward search # returns : The absolute path of the '.build.yaml' file function ViashFindTargetDir { - SOURCE="$1" - while [[ "$SOURCE" != "" && ! -e "$SOURCE/.build.yaml" ]]; do - SOURCE=${SOURCE%/*} + local source="$1" + while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do + source=${source%/*} done - echo $SOURCE + echo $source } # see https://en.wikipedia.org/wiki/Syslog#Severity_level VIASH_LOGCODE_EMERGENCY=0 @@ -215,9 +215,9 @@ function ViashDockerInstallationCheck { fi ViashDebug "Checking whether the Docker daemon is running" - save=$-; set +e - docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) - out=$? + local save=$-; set +e + local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null) + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashCritical "Docker daemon does not seem to be running. Try one of the following:" @@ -269,9 +269,9 @@ function ViashDockerPull { if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker pull $1 && return 0 || return 1 else - save=$-; set +e + local save=$-; set +e docker pull $1 2> /dev/null > /dev/null - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible." @@ -291,7 +291,8 @@ function ViashDockerPull { # echo $? # returns '1' function ViashDockerPush { ViashNotice "Pushing image to '$1'" - save=$-; set +e + local save=$-; set +e + local out if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then docker push $1 out=$? @@ -315,9 +316,9 @@ function ViashDockerPush { # examples: # ViashDockerPullElseBuild mynewcomponent function ViashDockerPullElseBuild { - save=$-; set +e + local save=$-; set +e ViashDockerPull $1 - out=$? + local out=$? [[ $save =~ e ]] && set -e if [ $out -ne 0 ]; then ViashDockerBuild $@ @@ -475,9 +476,9 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* LABEL org.opencontainers.image.description="Companion container for running component io untar" -LABEL org.opencontainers.image.created="2024-06-24T12:46:53Z" +LABEL org.opencontainers.image.created="2024-09-12T12:25:58Z" LABEL org.opencontainers.image.source="https://github.com/viash-hub/demultiplex" -LABEL org.opencontainers.image.revision="ed860bed30c98b981270f104cffbdb9b7f1ce141" +LABEL org.opencontainers.image.revision="cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" LABEL org.opencontainers.image.version="main" VIASHDOCKER @@ -504,6 +505,9 @@ function ViashDockerBuildArgs { # ViashAbsolutePath /foo/bar/.. # returns /foo function ViashAbsolutePath { local thePath + local parr + local outp + local len if [[ ! "$1" =~ ^/ ]]; then thePath="$PWD/$1" else @@ -534,14 +538,17 @@ function ViashAbsolutePath { ) } # ViashDockerAutodetectMount: auto configuring docker mounts from parameters -# $1 : The parameter value -# returns : New parameter -# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $1 : The parameter value +# returns : New parameter +# $VIASH_DIRECTORY_MOUNTS : Added another parameter to be passed to docker +# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts # examples: # ViashDockerAutodetectMount /path/to/bar # returns '/viash_automount/path/to/bar' # ViashDockerAutodetectMountArg /path/to/bar # returns '--volume="/path/to:/viash_automount/path/to"' function ViashDockerAutodetectMount { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -549,7 +556,7 @@ function ViashDockerAutodetectMount { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" if [ -z "$base_name" ]; then echo "$mount_target" else @@ -557,7 +564,9 @@ function ViashDockerAutodetectMount { fi } function ViashDockerAutodetectMountArg { - abs_path=$(ViashAbsolutePath "$1") + local abs_path=$(ViashAbsolutePath "$1") + local mount_source + local base_name if [ -d "$abs_path" ]; then mount_source="$abs_path" base_name="" @@ -565,17 +574,22 @@ function ViashDockerAutodetectMountArg { mount_source=`dirname "$abs_path"` base_name=`basename "$abs_path"` fi - mount_target="/viash_automount$mount_source" + local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source" ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target" echo "--volume=\"$mount_source:$mount_target\"" } function ViashDockerStripAutomount { - abs_path=$(ViashAbsolutePath "$1") - echo "${abs_path#/viash_automount}" + local abs_path=$(ViashAbsolutePath "$1") + echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}" } # initialise variables VIASH_DIRECTORY_MOUNTS=() +# configure default docker automount prefix if it is unset +if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then + VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount" +fi + # initialise docker variables VIASH_DOCKER_RUN_ARGS=(-i --rm) @@ -665,6 +679,18 @@ while [[ $# -gt 0 ]]; do VIASH_MODE='dockerfile' shift 1 ;; + ---docker_run_args) + VIASH_DOCKER_RUN_ARGS+=("$2") + shift 2 + ;; + ---docker_run_args=*) + VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")") + shift 1 + ;; + ---docker_image_id) + VIASH_MODE='docker_image_id' + shift 1 + ;; ---debug) VIASH_MODE='debug' shift 1 @@ -726,6 +752,10 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then if [ "$VIASH_MODE" == "dockerfile" ]; then ViashDockerfile "$VIASH_ENGINE_ID" exit 0 + + elif [ "$VIASH_MODE" == "docker_image_id" ]; then + echo "$VIASH_DOCKER_IMAGE_ID" + exit 0 # enter docker container elif [[ "$VIASH_MODE" == "debug" ]]; then diff --git a/target/nextflow/dataflow/combine_samples/.config.vsh.yaml b/target/nextflow/dataflow/combine_samples/.config.vsh.yaml index 0b8ea4d..3ad0286 100644 --- a/target/nextflow/dataflow/combine_samples/.config.vsh.yaml +++ b/target/nextflow/dataflow/combine_samples/.config.vsh.yaml @@ -138,8 +138,8 @@ build_info: engine: "native|native" output: "target/nextflow/dataflow/combine_samples" executable: "target/nextflow/dataflow/combine_samples/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -149,7 +149,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/nextflow/dataflow/combine_samples/main.nf b/target/nextflow/dataflow/combine_samples/main.nf index f6e8e2a..61d5b04 100644 --- a/target/nextflow/dataflow/combine_samples/main.nf +++ b/target/nextflow/dataflow/combine_samples/main.nf @@ -1,8 +1,8 @@ // combine_samples main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -// derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -// Data Intuitive. +// This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. // // The component may contain files which fall under a different license. The // authors of this component should specify the license in the header of such @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -1709,7 +1728,9 @@ def publishStates(Map args) { def yamlFilename = yamlTemplate_ .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) // TODO: do the pathnames in state_ match up with the outputFilenames_? @@ -1780,7 +1801,9 @@ def publishStatesByConfig(Map args) { def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' def yamlFilename = yamlTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where @@ -1822,7 +1845,9 @@ def publishStatesByConfig(Map args) { // instantiate the template def filename = filenameTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) if (par.multiple) { // if the parameter is multiple: true, the filename // should contain a wildcard '*' that is replaced with @@ -2626,30 +2651,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2746,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -2945,8 +2971,8 @@ meta = [ "runner" : "nextflow", "engine" : "native|native", "output" : "target/nextflow/dataflow/combine_samples", - "viash_version" : "0.9.0-RC6", - "git_commit" : "ed860bed30c98b981270f104cffbdb9b7f1ce141", + "viash_version" : "0.9.0", + "git_commit" : "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f", "git_remote" : "https://github.com/viash-hub/demultiplex" }, "package_config" : { @@ -2961,7 +2987,7 @@ meta = [ } ] }, - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0", "source" : "src", "target" : "target", "config_mods" : [ diff --git a/target/nextflow/dataflow/combine_samples/nextflow_schema.json b/target/nextflow/dataflow/combine_samples/nextflow_schema.json index a927314..245efb4 100644 --- a/target/nextflow/dataflow/combine_samples/nextflow_schema.json +++ b/target/nextflow/dataflow/combine_samples/nextflow_schema.json @@ -57,8 +57,8 @@ "output_forward": { "type": "string", - "description": "Type: List of `file`, required, default: `$id.$key.output_forward_*.output_forward_*`, multiple_sep: `\":\"`. ", - "help_text": "Type: List of `file`, required, default: `$id.$key.output_forward_*.output_forward_*`, multiple_sep: `\":\"`. " + "description": "Type: List of `file`, required, default: `$id.$key.output_forward_*.output_forward_*`, multiple_sep: `\";\"`. ", + "help_text": "Type: List of `file`, required, default: `$id.$key.output_forward_*.output_forward_*`, multiple_sep: `\";\"`. " , "default": "$id.$key.output_forward_*.output_forward_*" } @@ -68,8 +68,8 @@ "output_reverse": { "type": "string", - "description": "Type: List of `file`, default: `$id.$key.output_reverse_*.output_reverse_*`, multiple_sep: `\":\"`. ", - "help_text": "Type: List of `file`, default: `$id.$key.output_reverse_*.output_reverse_*`, multiple_sep: `\":\"`. " + "description": "Type: List of `file`, default: `$id.$key.output_reverse_*.output_reverse_*`, multiple_sep: `\";\"`. ", + "help_text": "Type: List of `file`, default: `$id.$key.output_reverse_*.output_reverse_*`, multiple_sep: `\";\"`. " , "default": "$id.$key.output_reverse_*.output_reverse_*" } diff --git a/target/nextflow/dataflow/gather_fastqs_and_validate/.config.vsh.yaml b/target/nextflow/dataflow/gather_fastqs_and_validate/.config.vsh.yaml index 829ac4a..5a3bfb8 100644 --- a/target/nextflow/dataflow/gather_fastqs_and_validate/.config.vsh.yaml +++ b/target/nextflow/dataflow/gather_fastqs_and_validate/.config.vsh.yaml @@ -132,8 +132,8 @@ build_info: engine: "native|native" output: "target/nextflow/dataflow/gather_fastqs_and_validate" executable: "target/nextflow/dataflow/gather_fastqs_and_validate/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -143,7 +143,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/nextflow/dataflow/gather_fastqs_and_validate/main.nf b/target/nextflow/dataflow/gather_fastqs_and_validate/main.nf index d121656..77a41a6 100644 --- a/target/nextflow/dataflow/gather_fastqs_and_validate/main.nf +++ b/target/nextflow/dataflow/gather_fastqs_and_validate/main.nf @@ -1,8 +1,8 @@ // gather_fastqs_and_validate main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -// derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -// Data Intuitive. +// This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. // // The component may contain files which fall under a different license. The // authors of this component should specify the license in the header of such @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -1709,7 +1728,9 @@ def publishStates(Map args) { def yamlFilename = yamlTemplate_ .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) // TODO: do the pathnames in state_ match up with the outputFilenames_? @@ -1780,7 +1801,9 @@ def publishStatesByConfig(Map args) { def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' def yamlFilename = yamlTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where @@ -1822,7 +1845,9 @@ def publishStatesByConfig(Map args) { // instantiate the template def filename = filenameTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) if (par.multiple) { // if the parameter is multiple: true, the filename // should contain a wildcard '*' that is replaced with @@ -2626,30 +2651,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2746,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -2938,8 +2964,8 @@ meta = [ "runner" : "nextflow", "engine" : "native|native", "output" : "target/nextflow/dataflow/gather_fastqs_and_validate", - "viash_version" : "0.9.0-RC6", - "git_commit" : "ed860bed30c98b981270f104cffbdb9b7f1ce141", + "viash_version" : "0.9.0", + "git_commit" : "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f", "git_remote" : "https://github.com/viash-hub/demultiplex" }, "package_config" : { @@ -2954,7 +2980,7 @@ meta = [ } ] }, - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0", "source" : "src", "target" : "target", "config_mods" : [ diff --git a/target/nextflow/demultiplex/.config.vsh.yaml b/target/nextflow/demultiplex/.config.vsh.yaml index b4b0865..68f0e6b 100644 --- a/target/nextflow/demultiplex/.config.vsh.yaml +++ b/target/nextflow/demultiplex/.config.vsh.yaml @@ -185,8 +185,8 @@ build_info: engine: "native|native" output: "target/nextflow/demultiplex" executable: "target/nextflow/demultiplex/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" dependencies: - "target/nextflow/io/untar" @@ -204,7 +204,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/nextflow/demultiplex/main.nf b/target/nextflow/demultiplex/main.nf index daaeacb..cc040a7 100644 --- a/target/nextflow/demultiplex/main.nf +++ b/target/nextflow/demultiplex/main.nf @@ -1,8 +1,8 @@ // demultiplex main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -// derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -// Data Intuitive. +// This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. // // The component may contain files which fall under a different license. The // authors of this component should specify the license in the header of such @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -1709,7 +1728,9 @@ def publishStates(Map args) { def yamlFilename = yamlTemplate_ .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) // TODO: do the pathnames in state_ match up with the outputFilenames_? @@ -1780,7 +1801,9 @@ def publishStatesByConfig(Map args) { def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' def yamlFilename = yamlTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where @@ -1822,7 +1845,9 @@ def publishStatesByConfig(Map args) { // instantiate the template def filename = filenameTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) if (par.multiple) { // if the parameter is multiple: true, the filename // should contain a wildcard '*' that is replaced with @@ -2626,30 +2651,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2746,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -3022,8 +3048,8 @@ meta = [ "runner" : "nextflow", "engine" : "native|native", "output" : "target/nextflow/demultiplex", - "viash_version" : "0.9.0-RC6", - "git_commit" : "ed860bed30c98b981270f104cffbdb9b7f1ce141", + "viash_version" : "0.9.0", + "git_commit" : "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f", "git_remote" : "https://github.com/viash-hub/demultiplex" }, "package_config" : { @@ -3038,7 +3064,7 @@ meta = [ } ] }, - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0", "source" : "src", "target" : "target", "config_mods" : [ diff --git a/target/nextflow/io/interop_summary_to_csv/.config.vsh.yaml b/target/nextflow/io/interop_summary_to_csv/.config.vsh.yaml index 4c93bf7..cd79f02 100644 --- a/target/nextflow/io/interop_summary_to_csv/.config.vsh.yaml +++ b/target/nextflow/io/interop_summary_to_csv/.config.vsh.yaml @@ -140,8 +140,8 @@ build_info: engine: "docker|native" output: "target/nextflow/io/interop_summary_to_csv" executable: "target/nextflow/io/interop_summary_to_csv/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -151,7 +151,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/nextflow/io/interop_summary_to_csv/main.nf b/target/nextflow/io/interop_summary_to_csv/main.nf index 9fbabb9..0b19195 100644 --- a/target/nextflow/io/interop_summary_to_csv/main.nf +++ b/target/nextflow/io/interop_summary_to_csv/main.nf @@ -1,8 +1,8 @@ // interop_summary_to_csv main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -// derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -// Data Intuitive. +// This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. // // The component may contain files which fall under a different license. The // authors of this component should specify the license in the header of such @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -1709,7 +1728,9 @@ def publishStates(Map args) { def yamlFilename = yamlTemplate_ .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) // TODO: do the pathnames in state_ match up with the outputFilenames_? @@ -1780,7 +1801,9 @@ def publishStatesByConfig(Map args) { def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' def yamlFilename = yamlTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where @@ -1822,7 +1845,9 @@ def publishStatesByConfig(Map args) { // instantiate the template def filename = filenameTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) if (par.multiple) { // if the parameter is multiple: true, the filename // should contain a wildcard '*' that is replaced with @@ -2626,30 +2651,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2746,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -2950,8 +2976,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/io/interop_summary_to_csv", - "viash_version" : "0.9.0-RC6", - "git_commit" : "ed860bed30c98b981270f104cffbdb9b7f1ce141", + "viash_version" : "0.9.0", + "git_commit" : "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f", "git_remote" : "https://github.com/viash-hub/demultiplex" }, "package_config" : { @@ -2966,7 +2992,7 @@ meta = [ } ] }, - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0", "source" : "src", "target" : "target", "config_mods" : [ @@ -3115,7 +3141,11 @@ def vdsl3WorkflowFactory(Map args, Map meta, String rawScript) { val = val.join(par.multiple_sep) } if (par.direction == "output" && par.type == "file") { - val = val.replaceAll('\\$id', id).replaceAll('\\$key', key) + val = val + .replaceAll('\\$id', id) + .replaceAll('\\$\\{id\\}', id) + .replaceAll('\\$key', key) + .replaceAll('\\$\\{key\\}', key) } [parName, val] } @@ -3246,7 +3276,8 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def createParentStr = meta.config.allArguments .findAll { it.type == "file" && it.direction == "output" && it.create_parent } .collect { par -> - "\${ args.containsKey(\"${par.plainName}\") ? \"mkdir_parent \\\"\" + (args[\"${par.plainName}\"] instanceof String ? args[\"${par.plainName}\"] : args[\"${par.plainName}\"].join('\" \"')) + \"\\\"\" : \"\" }" + def contents = "args[\"${par.plainName}\"] instanceof List ? args[\"${par.plainName}\"].join('\" \"') : args[\"${par.plainName}\"]" + "\${ args.containsKey(\"${par.plainName}\") ? \"mkdir_parent '\" + escapeText(${contents}) + \"'\" : \"\" }" } .join("\n") @@ -3254,8 +3285,8 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def inputFileExports = meta.config.allArguments .findAll { it.type == "file" && it.direction.toLowerCase() == "input" } .collect { par -> - def viash_par_contents = "(viash_par_${par.plainName} instanceof List ? viash_par_${par.plainName}.join(\"${par.multiple_sep}\") : viash_par_${par.plainName})" - "\n\${viash_par_${par.plainName}.empty ? \"\" : \"export VIASH_PAR_${par.plainName.toUpperCase()}=\\\"\" + ${viash_par_contents} + \"\\\"\"}" + def contents = "viash_par_${par.plainName} instanceof List ? viash_par_${par.plainName}.join(\"${par.multiple_sep}\") : viash_par_${par.plainName}" + "\n\${viash_par_${par.plainName}.empty ? \"\" : \"export VIASH_PAR_${par.plainName.toUpperCase()}='\" + escapeText(${contents}) + \"'\"}" } // NOTE: if using docker, use /tmp instead of tmpDir! @@ -3292,6 +3323,7 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def procStr = """nextflow.enable.dsl=2 | + |def escapeText = { s -> s.toString().replaceAll("'", "'\\\"'\\\"'") } |process $procKey {$drctvStrs |input: | tuple val(id)$inputPaths, val(args), path(resourcesDir, stageAs: ".viash_meta_resources") @@ -3303,10 +3335,9 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { |$stub |\"\"\" |script:$assertStr - |def escapeText = { s -> s.toString().replaceAll('([`"])', '\\\\\\\\\$1') } |def parInject = args | .findAll{key, value -> value != null} - | .collect{key, value -> "export VIASH_PAR_\${key.toUpperCase()}=\\\"\${escapeText(value)}\\\""} + | .collect{key, value -> "export VIASH_PAR_\${key.toUpperCase()}='\${escapeText(value)}'"} | .join("\\n") |\"\"\" |# meta exports diff --git a/target/nextflow/io/untar/.config.vsh.yaml b/target/nextflow/io/untar/.config.vsh.yaml index 6f16d7c..41a2120 100644 --- a/target/nextflow/io/untar/.config.vsh.yaml +++ b/target/nextflow/io/untar/.config.vsh.yaml @@ -147,8 +147,8 @@ build_info: engine: "docker|native" output: "target/nextflow/io/untar" executable: "target/nextflow/io/untar/main.nf" - viash_version: "0.9.0-RC6" - git_commit: "ed860bed30c98b981270f104cffbdb9b7f1ce141" + viash_version: "0.9.0" + git_commit: "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f" git_remote: "https://github.com/viash-hub/demultiplex" package_config: name: "demultiplex" @@ -158,7 +158,7 @@ package_config: test_resources: - path: "https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/NovaSeq6000/200624_A00834_0183_BHMTFYDRXX.tar.gz" dest: "test_resources" - viash_version: "0.9.0-RC6" + viash_version: "0.9.0" source: "src" target: "target" config_mods: diff --git a/target/nextflow/io/untar/main.nf b/target/nextflow/io/untar/main.nf index 3e8f1f8..ec7034c 100644 --- a/target/nextflow/io/untar/main.nf +++ b/target/nextflow/io/untar/main.nf @@ -1,8 +1,8 @@ // untar main // -// This wrapper script is auto-generated by viash 0.9.0-RC6 and is thus a -// derivative work thereof. This software comes with ABSOLUTELY NO WARRANTY from -// Data Intuitive. +// This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. // // The component may contain files which fall under a different license. The // authors of this component should specify the license in the header of such @@ -760,8 +760,11 @@ def runEach(Map args) { def fromState_ = args.fromState def toState_ = args.toState def filter_ = args.filter + def runIf_ = args.runIf def id_ = args.id + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + workflow runEachWf { take: input_ch main: @@ -783,7 +786,20 @@ def runEach(Map args) { [new_id] + tup.drop(1) } : filter_ch - def data_ch = id_ch | map{tup -> + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> def new_data = tup[1] if (fromState_ instanceof Map) { new_data = fromState_.collectEntries{ key0, key1 -> @@ -821,8 +837,11 @@ def runEach(Map args) { [tup[0], new_state] + tup.drop(3) } : out_ch + + def return_ch = post_ch + | concat(chPassthrough) - post_ch + return_ch } // mix all results @@ -1598,8 +1617,8 @@ def findStates(Map params, Map config) { // construct renameMap if (args.rename_keys) { def renameMap = args.rename_keys.collectEntries{renameString -> - def split = renameString.split(";") - assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey,newKey:oldKey'" + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" split } @@ -1709,7 +1728,9 @@ def publishStates(Map args) { def yamlFilename = yamlTemplate_ .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) // TODO: do the pathnames in state_ match up with the outputFilenames_? @@ -1780,7 +1801,9 @@ def publishStatesByConfig(Map args) { def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' def yamlFilename = yamlTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where @@ -1822,7 +1845,9 @@ def publishStatesByConfig(Map args) { // instantiate the template def filename = filenameTemplate .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) if (par.multiple) { // if the parameter is multiple: true, the filename // should contain a wildcard '*' that is replaced with @@ -2626,30 +2651,31 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { tuple } - def chModifiedFiltered = workflowArgs.filter ? - chModified | filter{workflowArgs.filter(it)} : - chModified def chRun = null def chPassthrough = null if (workflowArgs.runIf) { - def runIfBranch = chModifiedFiltered.branch{ tup -> + def runIfBranch = chModified.branch{ tup -> run: workflowArgs.runIf(tup[0], tup[1]) passthrough: true } chRun = runIfBranch.run chPassthrough = runIfBranch.passthrough } else { - chRun = chModifiedFiltered + chRun = chModified chPassthrough = Channel.empty() } + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + def chArgs = workflowArgs.fromState ? - chRun | map{ + chRunFiltered | map{ def new_data = workflowArgs.fromState(it.take(2)) [it[0], new_data] } : - chRun | map {tup -> tup.take(2)} + chRunFiltered | map {tup -> tup.take(2)} // fill in defaults def chArgsWithDefaults = chArgs @@ -2720,7 +2746,7 @@ def workflowFactory(Map args, Map defaultWfArgs, Map meta) { // | view{"chInitialOutput: ${it.take(3)}"} // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] - def chNewState = safeJoin(chInitialOutput, chModifiedFiltered, key_) + def chNewState = safeJoin(chInitialOutput, chRunFiltered, key_) // input tuple format: [join_id, id, output, prev_state, ...] // output tuple format: [join_id, id, new_state, ...] | map{ tup -> @@ -2962,8 +2988,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "target/nextflow/io/untar", - "viash_version" : "0.9.0-RC6", - "git_commit" : "ed860bed30c98b981270f104cffbdb9b7f1ce141", + "viash_version" : "0.9.0", + "git_commit" : "cfefb99ef0d6eeeaf62a3f52654651bc59d06e0f", "git_remote" : "https://github.com/viash-hub/demultiplex" }, "package_config" : { @@ -2978,7 +3004,7 @@ meta = [ } ] }, - "viash_version" : "0.9.0-RC6", + "viash_version" : "0.9.0", "source" : "src", "target" : "target", "config_mods" : [ @@ -3157,7 +3183,11 @@ def vdsl3WorkflowFactory(Map args, Map meta, String rawScript) { val = val.join(par.multiple_sep) } if (par.direction == "output" && par.type == "file") { - val = val.replaceAll('\\$id', id).replaceAll('\\$key', key) + val = val + .replaceAll('\\$id', id) + .replaceAll('\\$\\{id\\}', id) + .replaceAll('\\$key', key) + .replaceAll('\\$\\{key\\}', key) } [parName, val] } @@ -3288,7 +3318,8 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def createParentStr = meta.config.allArguments .findAll { it.type == "file" && it.direction == "output" && it.create_parent } .collect { par -> - "\${ args.containsKey(\"${par.plainName}\") ? \"mkdir_parent \\\"\" + (args[\"${par.plainName}\"] instanceof String ? args[\"${par.plainName}\"] : args[\"${par.plainName}\"].join('\" \"')) + \"\\\"\" : \"\" }" + def contents = "args[\"${par.plainName}\"] instanceof List ? args[\"${par.plainName}\"].join('\" \"') : args[\"${par.plainName}\"]" + "\${ args.containsKey(\"${par.plainName}\") ? \"mkdir_parent '\" + escapeText(${contents}) + \"'\" : \"\" }" } .join("\n") @@ -3296,8 +3327,8 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def inputFileExports = meta.config.allArguments .findAll { it.type == "file" && it.direction.toLowerCase() == "input" } .collect { par -> - def viash_par_contents = "(viash_par_${par.plainName} instanceof List ? viash_par_${par.plainName}.join(\"${par.multiple_sep}\") : viash_par_${par.plainName})" - "\n\${viash_par_${par.plainName}.empty ? \"\" : \"export VIASH_PAR_${par.plainName.toUpperCase()}=\\\"\" + ${viash_par_contents} + \"\\\"\"}" + def contents = "viash_par_${par.plainName} instanceof List ? viash_par_${par.plainName}.join(\"${par.multiple_sep}\") : viash_par_${par.plainName}" + "\n\${viash_par_${par.plainName}.empty ? \"\" : \"export VIASH_PAR_${par.plainName.toUpperCase()}='\" + escapeText(${contents}) + \"'\"}" } // NOTE: if using docker, use /tmp instead of tmpDir! @@ -3334,6 +3365,7 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { def procStr = """nextflow.enable.dsl=2 | + |def escapeText = { s -> s.toString().replaceAll("'", "'\\\"'\\\"'") } |process $procKey {$drctvStrs |input: | tuple val(id)$inputPaths, val(args), path(resourcesDir, stageAs: ".viash_meta_resources") @@ -3345,10 +3377,9 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { |$stub |\"\"\" |script:$assertStr - |def escapeText = { s -> s.toString().replaceAll('([`"])', '\\\\\\\\\$1') } |def parInject = args | .findAll{key, value -> value != null} - | .collect{key, value -> "export VIASH_PAR_\${key.toUpperCase()}=\\\"\${escapeText(value)}\\\""} + | .collect{key, value -> "export VIASH_PAR_\${key.toUpperCase()}='\${escapeText(value)}'"} | .join("\\n") |\"\"\" |# meta exports diff --git a/test_resources b/test_resources new file mode 120000 index 0000000..6970768 --- /dev/null +++ b/test_resources @@ -0,0 +1 @@ +/work/viash_hub_resources/viash-hub/demultiplex/ebb861b02ab66db004c32fa46573bb1e/200624_A00834_0183_BHMTFYDRXX.tar.gz \ No newline at end of file