Skip to content

Commit

Permalink
Refactor the nextflow code to handle the auto.publish as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Grifs committed Oct 10, 2023
1 parent 5ab3664 commit 939d5b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) {
def escapedScript = rawScript.replace('\\', '\\\\').replace('$', '\\$').replace('"""', '\\"\\"\\"')

// publishdir assert
def assertStr = (workflowArgs.auto.publish == true) || workflowArgs.auto.transcript ?
def assertStr = (workflowArgs.auto.publish == "true") || workflowArgs.auto.transcript ?
"""\nassert task.publishDir.size() > 0: "if auto.publish is true, params.publish_dir needs to be defined.\\n Example: --publish_dir './output/'" """ :
""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def processAuto(Map auto) {
assert auto.transcript instanceof Boolean, "auto.transcript must be a boolean"

// check auto.publish
assert auto.publish instanceof Boolean || auto.publish == "state", "auto.publish must be a boolean or 'state'"
assert auto.publish instanceof CharSequence
assert auto.publish in ["true", "false", "state"], "auto.publish must be 'true', 'false', or 'state'"

return auto.subMap(expectedKeys)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def processWorkflowArgs(Map args, Map defaultWfArgs, Map meta) {
workflowArgs["auto"] = processAuto(defaultWfArgs.auto + workflowArgs["auto"])

// auto define publish, if so desired
if (workflowArgs.auto.publish == true && (workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : [:]).isEmpty()) {
if (workflowArgs.auto.publish == "true" && (workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : [:]).isEmpty()) {
// can't assert at this level thanks to the no_publish profile
// assert params.containsKey("publishDir") || params.containsKey("publish_dir") :
// "Error in module '${workflowArgs['key']}': if auto.publish is true, params.publish_dir needs to be defined.\n" +
Expand Down

0 comments on commit 939d5b5

Please sign in to comment.