Nextflow: Allow access to manifest scope during workflow execution

Created on 16 Aug 2018  路  4Comments  路  Source: nextflow-io/nextflow

Over at @nf-core we're trying to establish nice config best practices. With the inclusion of the new manifest.nextflowVersion variable, it's making increasing sense to bundle all variables describing the workflow into the manifest scope as follows:

manifest {
  name = 'nf-core/rnaseq'
  description = 'Nextflow RNA-Seq analysis pipeline, part of the nf-core community.'
  homePage = 'https://github.com/nf-core/rnaseq'
  author = 'Phil Ewels, Rickard Hammar茅n'
  pipelineVersion = '1.0dev'
  mainScript = 'main.nf'
  nextflowVersion = '>=0.31.1'
}

This is readable and tidy, and works as expected when checking the pipeline config with nextflow config. However, it's not possible to access these manifest variables from _within_ the workflow script (main.nf). Attempting to do so triggers the following error:

ERROR ~ No such variable: manifest

Is it possible to make these accessible from within the pipeline script in the same way as other variables? We have discussed this once before (see #597) and I know that we could just use params.everything instead, but it doesn't feel as tidy 馃

help wanted kinenhancement prlow

Most helpful comment

Yay! Thanks to both of you, this may be a small thing but it makes me very happy 馃槑

All 4 comments

My guess is, to pass the manifest map to the script binding object instance, which is not yet there. @pditommaso please correct me, I guess I have to make changes in https://github.com/nextflow-io/nextflow/blob/master/src/main/groovy/nextflow/script/ScriptRunner.groovy and https://github.com/nextflow-io/nextflow/blob/master/src/main/groovy/nextflow/script/ScriptBinding.groovy, passing the manifest entry from the parsed config file, right?

I agree that this can be useful, however I'm not so keen to add it as a global variable. What about adding manifest attribute in the workflow object?

https://github.com/nextflow-io/nextflow/blob/6bbe790ecec01f2d6593cc989ee5a3b222322b52/src/main/groovy/nextflow/script/WorkflowMetadata.groovy#L225

The manifest object is modelled by the following class:

https://github.com/nextflow-io/nextflow/blob/7e1ace22f1092b446479d5b188f548cb95325386/src/main/groovy/nextflow/config/Manifest.groovy#L34-L76

841

Yay! Thanks to both of you, this may be a small thing but it makes me very happy 馃槑

Was this page helpful?
0 / 5 - 0 ratings