Open
Description
In nf-test for genomics, the test data path is referred from the projectDir:
test("Should call trio's joint genotype correctly") {
when {
params {
outdir = "tests/results"
}
process {
"""
input[0] = [
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_father.bam.g.vcf"),
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_mother.bam.g.vcf"),
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_son.bam.g.vcf")
]
input[1] = [
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_father.bam.g.vcf.idx"),
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_mother.bam.g.vcf.idx"),
file("${projectDir}/modules/gatk/jointgenotyping/tests/inputs/reads_son.bam.g.vcf.idx")
]
input[2] = file("${projectDir}/data/ref/intervals.bed")
input[3] = "family_trio"
input[4] = file("${projectDir}/data/ref/ref.fasta")
input[5] = file("${projectDir}/data/ref/ref.fasta.fai")
input[6] = file("${projectDir}/data/ref/ref.dict")
"""
}
}
However this is pretty verbose and we could replace it with the moduleTestDir from the nf-test global variables:
test("Should call trio's joint genotype correctly") {
when {
params {
outdir = "tests/results"
}
process {
"""
input[0] = [
file("${moduleTestDir}/inputs/reads_father.bam.g.vcf"),
file("${moduleTestDir}/inputs/reads_mother.bam.g.vcf"),
file("${moduleTestDir}/inputs/reads_son.bam.g.vcf")
]
input[1] = [
file("${moduleTestDir}/inputs/reads_father.bam.g.vcf.idx"),
file("${moduleTestDir}/inputs/reads_mother.bam.g.vcf.idx"),
file("${moduleTestDir}/inputs/reads_son.bam.g.vcf.idx")
]
// I haven't replaced these but these could be included:
input[2] = file("${projectDir}/data/ref/intervals.bed")
input[3] = "family_trio"
input[4] = file("${projectDir}/data/ref/ref.fasta")
input[5] = file("${projectDir}/data/ref/ref.fasta.fai")
input[6] = file("${projectDir}/data/ref/ref.dict")
"""
}
}
This could reinforce the idea of a "module dir" including tests and data.