For example in `nextflow.config` I have (simplifi...
# nostupidquestions
a
For example in
nextflow.config
I have (simplified version):
Copy code
fasta_header_extra           = '\${meta.id}'
to pass onto `modules.config`:
Copy code
withName: SEQKIT_REPLACE_ILLUMINA {
        ext.args   = { "-p 'artic-network/fieldbioinformatics_.*\$' -r '${params.fasta_header_extra}'" }
        ...
    }
a
I don't think you can use task level variables in a static manner like that. The problem I think is that by using single-quotes your value is a literal string and so is never interpolated as a Gstring would be (double quotes). However you of course can't set the param as a GString because it will be interpolated in the wrong context
Escaping the
$
also won't help because I don't think it needs to be escaped in a literal string? So a first fix attempt could be to try without the escaped dollar, although I still suspect it may not work
I think you'd probably need to be able to set the param to be a closure that isn't evaluated until task runtime but I have no idea how you can do that
n
You could just do
"-r ${meta.id}"
in the ext.args closure though and it would work, as far as I am aware you cannot really use params for sample-level things, for reasons explained by Arthur above
a
Thanks both. I think my approach is just plan wrong. Good to know what I am doing is not possible.
Where can I read up on when/how the sub config files are read?
meta
is not available in nextflow.config but it's available in
modules.config
.
a
It's not available in either
It's available in
ext.<name>
when the value is set as a closure because those closures are evaluated at task runtime
You could put that logic in whatever file and it would behave the same. The issue is about when the settings are evaluated and the context in which they are evaluated
a
That makes sense thanks Arthur.