Using nextflow.config files, when running a test? ...
# nf-test
u
Using nextflow.config files, when running a test? I made a nextflow.config file (attached), and put it in the tests directory of the module I'm writing. However, when I run nf-test test modules/nf-core/rmats/prep/tests/ --profile conda The args is still empty. Am I missing something here? If this is documented on the website, sorry, but I couldn't find it.
n
Can you double check that your
nf-test.config
file contains points to that config?
u
Okay, that's definitely what I'm missing. I'm a bit confused. I've seen modules and workflows that have nextflow.config, but none of the extra files appear in the default nf-test.config of the nf-core/modules. Looking at https://github.com/nf-core/modules/blob/master/nf-test.config it points to https://github.com/nf-core/modules/blob/master/tests/config/nf-test.config, neither or which point to specific nextflow.config files. So, how does (for example) https://github.com/nf-core/modules/blob/master/modules/nf-core/rmarkdownnotebook/tests/nextflow.config work?
n
They are referenced in the
main.nf.test
file for that specific test
You'll see something like
config 'nextflow.config'
in there
u
Okay. makes perfect sense. Thank you! Is there a way to overwrite the ext.args values from the config file for one test?
n
Yes there are multiple ways to do that. In nf-core we usually setup a parameter per test that contains the arguments of the tool and add it to the
ext.args
via the config
u
Thanks again. A follow up question My nf-test contains a section
Copy code
when {
            process {
                """
                // TODO nf-core: define inputs of the process here. Example:

                input[0] = [
                    [ id:'test', single_end:false, strandness:"unstranded" ], // meta map
                    file('<https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/testdata/ERR204916.Aligned.out.bam>', checkIfExists: true),
                ]
                input[1] = [file('<https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/reference/genes_chrX.gtf>', checkIfExists: true)]
                input[2] = 150
                """
            }
        }
The nextflow.config contains a section
Copy code
process {

    withName: RMATS_PREP {
        ext.args = [
            "--variable-read-length --allow-clipping",
            meta.single_end                 ?   '-t single' : '',
And other things (trimmed for brevity) I'm getting an error ERROR ~ Unknown config attribute
process.withName:RMATS_PREP.meta.single_end
-- check config file: /home/uridavid/Code/nf-core/modules/modules/nf-core/rmats/prep/tests/./nextflow.config Do you have any idea what's going on please?
n
You need to wrap all code assigned to
ext.args
in a closure (
{}
). This is basically a way to tell Nextflow to only resolve this when the process is being started up. If you don't add that, Nextflow will resolve it at the start of the run and the meta map has not been defined yet at that point
u
I don't understand. I also feel dumb for pestering you - is there documentation I missed? Do you mean it should look like
Copy code
withName: RMATS_PREP {
        ext.args = [
            "--variable-read-length --allow-clipping",
            {meta.single_end                 ?   '-t single' : ''},
Or
Copy code
withName: RMATS_PREP {
        ext.args = {[
            "--variable-read-length --allow-clipping",
            meta.single_end                 ?   '-t single' : '',
Or something else?
n
Yes I meant the second option, sorry I should have been a bit more clear 😁. And no worries, you're not pestering me! Happy to help!
u
Works perfectly! Thank you!
🎉 1