Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processDir directive does not resolve variables in the process scope #85

Closed
heuermh opened this issue Nov 5, 2015 · 5 comments
Closed

Comments

@heuermh
Copy link

heuermh commented Nov 5, 2015

transform.nf:

#!/usr/bin/env nextflow

params.dir = "${baseDir}/example"

bamFiles = "${params.dir}/**.bam"
bams = Channel.fromPath(bamFiles).map { path -> tuple(path.baseName, path.toRealPath().getParent(), path) }

process transform {
  publishDir parent, mode: 'copy'

  input:
    set sample, parent, file(bam) from bams
  output:
    set sample, parent, file("${sample}.adam") into reads

  """
  adam-submit transform -force_load_bam $bam ${sample}.adam
  """
}
$ nextflow run transform.nf -with-docker heuermh/adam
N E X T F L O W  ~  version 0.16.0
Launching transform.nf
ERROR ~ Not such variable: parent

 -- Check script 'transform.nf' at line: 10 or see '.nextflow.log' file for more details
@pditommaso
Copy link
Member

The above commit solve the problem. However note that like other directives in order to access process local variables they must be enclosed by a closure or dynamic string. For example:

 publishDir "$parent", mode: 'copy'   

@heuermh
Copy link
Author

heuermh commented Nov 6, 2015

Thanks!

Is there any difference between "$parent" and "${parent}"?
And then by closure, would just publishDir { parent }, mode: 'copy' work?

@pditommaso
Copy link
Member

pditommaso commented Nov 6, 2015

No, both "$parent" and "${parent}" are GString objects.

Yes, the syntax publishDir { parent }, mode: 'copy' should work as well.

@pditommaso
Copy link
Member

let me know if it's fixed on your side as well.

@heuermh
Copy link
Author

heuermh commented Nov 6, 2015

Will do, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants