Andrea Bagnacani
08/04/2025, 3:46 PMconfig, a when and a then block:
- The config block describes some named `process`es
- The then block defines some `assert`ions
- The when block defines
- Some `params`:
- The .bam and .bai files of some alignment
- The .fa and .fa.fai files of a reference genome
- The output directory
- And one process, which uses the above parameters
All the tests pass. However, I would like to avoid hard-coding the path to the reference genome in the above params block: it would be better to move it to some file, so that multiple tests can reuse it.
My first thought was to extend the file pointed by the above config block, by adding:
params {
fasta = "./results/reference-genome/hg38.fa"
fai = "./results/reference-genome/hg38.fa.fai"
}
..and then use params.fasta and params.fai in the process block.
However, this leads to the error:
Caused by:
Process `PARAPHASE` input file name collision -- There are multiple input files for each of the following file names: null
The path to the files is correct, but it seems that nf-test cannot resolve them.
So I added a println statement to the process to see the resolved path, and then re-run the test using --verbose.
Still, both files cannot be seen:
> DEBUG: params.fasta = null
> DEBUG: params.fai = null
...so can it be that my new params block gets over-written by the former params in the when block? After all, both files specify a params block now.
I therefore moved the new params block in the new file conf/reference.config, and imported the new file at the very top of my test: config "conf/reference.config".
Still no luck. I get the same error.
What am I missing?Maxime Garcia
08/05/2025, 10:12 AMMaxime Garcia
08/05/2025, 10:12 AMAndrea Bagnacani
08/05/2025, 12:48 PMnextflow.config file pointed by the config block of my main.nf.test file (below).
process {
withName: SAMTOOLS_INDEX {
ext.args = '-c'
}
}
process {
withName: PARAPHASE {
ext.args = { params.targetGene } // let the test run specify the target gene
}
}
params {
reference_fasta = '/data/reference-genome/hg38.fa'
reference_fai = '/data/reference-genome/hg38.fa.fai'
}
This config file is imported by the main.nf.test file in order to run the test against one gene (see my previous thread).
Here above I added a params block that specifies where to find my local copy of the human reference genome.Andrea Bagnacani
08/05/2025, 12:51 PMmain.nf.test, which calls the above file:
nextflow_process {
name "Test Process PARAPHASE"
script "modules/local/paraphase/main.nf"
process "PARAPHASE"
// Test the paraphase process against the GBA gene.
def gene="GBA"
def sample="RevioEPT2-YF26-46"
test("Should run paraphase tests against sample \"${sample}\" and gene \"${gene}\".") {
// Run samtools index to create the input .bai file.
setup {
run("SAMTOOLS_INDEX") {
script "modules/nf-core/samtools/index/main.nf"
process { ... }
}
}
// Run paraphase against the GBA gene.
config "${baseDir}/tests/nextflow.config"
when {
params {
outdir = "${baseDir}/results"
targetGene = "-g ${gene}" // specify the target gene
//fasta = "${outdir}/reference-genome/hg38.fa"
//fai = "${outdir}/reference-genome/hg38.fa.fai"
}
process {
"""
input[0] = Channel.of([
[ id: "${sample}", single_end: false ], // meta map
file(
"${params.outdir}/${sample}/${sample}-ready.bam",
checkIfExists: true, checkIfEmpty: false
),
file(
"${params.outdir}/${sample}/${sample}-ready.bam.bai",
checkIfExists: true, checkIfEmpty: false
)
])
//input[1] = file("${params.fasta}")
//input[2] = file("${params.fai}")
input[1] = file("${params.reference_fasta}")
input[2] = file("${params.reference_fai}")
input[3] = []
"""
}
}
then {
// Paraphase runs as expected.
assert process.success
...
}
}
...
In this file I commented some params in the when block, which I expect to be taken from the above config.Andrea Bagnacani
08/05/2025, 12:56 PMCaused by:
Process `PARAPHASE` input file name collision -- There are multiple input files for each of the following file names: nullAndrea Bagnacani
08/05/2025, 1:00 PMwhen block. As second attempt, I moved the params section from nextflow.config to a dedicated file reference.config, and called this file from within `main.nf.test`:
nextflow_process {
name "Test Process PARAPHASE"
script "modules/local/paraphase/main.nf"
process "PARAPHASE"
config "reference.config"
...
However, I obtained the same errorMaxime Garcia
08/06/2025, 7:12 AMMaxime Garcia
08/06/2025, 7:13 AMparams.outdirMaxime Garcia
08/06/2025, 7:14 AMoutdir = "$outputDir"
for outdirMaxime Garcia
08/06/2025, 7:14 AMMaxime Garcia
08/06/2025, 7:16 AMMaxime Garcia
08/06/2025, 7:18 AMMaxime Garcia
08/06/2025, 7:18 AM