diff --git a/src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf b/src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf index 4c702e344..bcb8b409e 100644 --- a/src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf +++ b/src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf @@ -56,6 +56,12 @@ private List>> _paramsToParamSets(Map params, /* combine arguments into channel */ /**********************************/ + + // Fetch default values for arguments + def defaultArgs = config.allArguments + .findAll { it.containsKey("default") } + .collectEntries { [ it.plainName, it.default ] } + def processedParams = paramSets.indexed().collect{ index, tup -> // Process ID def id = tup[0] ?: globalID @@ -67,7 +73,7 @@ private List>> _paramsToParamSets(Map params, assert id != null: "Each parameter set should have at least an 'id'" // Process params - def parValues = globalParams + tup[1] + def parValues = defaultArgs + globalParams + tup[1] // // Remove parameters which are null, if the default is also null // parValues = parValues.collectEntries{paramName, paramValue -> // parameterSettings = config.functionality.allArguments.find({it.plainName == paramName}) diff --git a/src/test/resources/testnextflowvdsl3/workflows/pipeline3/main.nf b/src/test/resources/testnextflowvdsl3/workflows/pipeline3/main.nf index ecac7f82b..b8162ab83 100644 --- a/src/test/resources/testnextflowvdsl3/workflows/pipeline3/main.nf +++ b/src/test/resources/testnextflowvdsl3/workflows/pipeline3/main.nf @@ -1,12 +1,11 @@ nextflow.enable.dsl=2 -include { readConfig; helpMessage; preprocessInputs; channelFromParams } from "${params.rootDir}/workflows/utils/WorkflowHelper.nf" +include { readConfig; helpMessage; channelFromParams } from "${params.rootDir}/workflows/utils/WorkflowHelper.nf" config = readConfig("${params.rootDir}/workflows/pipeline3/config.vsh.yaml") workflow base { helpMessage(config) channelFromParams(params, config) - | preprocessInputs(["config": config]) | view {"DEBUG: $it"} }