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

Don't use test scripts when the -fisher option has been given in vardictjava #6747

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/nf-core/vardictjava/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process VARDICTJAVA {

output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
path "versions.yml" , emit: versions
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -25,9 +25,12 @@ process VARDICTJAVA {
def args3 = task.ext.args3 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

// Don't run test scripts when -fisher has been used by vardictjava
def run_test = !args.contains("-fisher")

def somatic = bams instanceof List && bams.size() == 2 ? true : false
def input = somatic ? "-b \"${bams[0]}|${bams[1]}\"" : "-b ${bams}"
def filter = somatic ? "testsomatic.R" : "teststrandbias.R"
def test = run_test ? somatic ? "| testsomatic.R" : "| teststrandbias.R" : ""
def convert_to_vcf = somatic ? "var2vcf_paired.pl" : "var2vcf_valid.pl"
"""
export JAVA_OPTS='"-Xms${task.memory.toMega()/4}m" "-Xmx${task.memory.toGiga()}g" "-Dsamjdk.reference_fasta=${fasta}"'
Expand All @@ -37,7 +40,7 @@ process VARDICTJAVA {
-th ${task.cpus} \\
-G ${fasta} \\
${bed} \\
| ${filter} \\
${test} \\
| ${convert_to_vcf} \\
${args2} \\
| bgzip ${args3} --threads ${task.cpus} > ${prefix}.vcf.gz
Expand All @@ -50,9 +53,6 @@ process VARDICTJAVA {
"""

stub:
def args = task.ext.args ?: '-c 1 -S 2 -E 3'
def args2 = task.ext.args2 ?: ''
def args3 = task.ext.args3 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
Expand Down
77 changes: 71 additions & 6 deletions modules/nf-core/vardictjava/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ nextflow_process {
test("homo_sapiens - [bam, bai, bed] - fasta - fai") {

when {
params {
outdir = $outputDir
}
process {
"""
input[0] = Channel.value([
Expand Down Expand Up @@ -47,9 +44,6 @@ nextflow_process {
test("homo_sapiens - [[bam, bam], [bai, bai], bed] - fasta - fai") {

when {
params {
outdir = $outputDir
}
process {
"""
input[0] = Channel.value([
Expand Down Expand Up @@ -87,4 +81,75 @@ nextflow_process {

}

test("homo_sapiens - [bam, bai, bed] - fasta - fai - fisher") {

config "./nextflow.config"
when {
process {
"""
input[0] = Channel.value([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true)
])
input[1] = [
[id:"ref"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [
[id:"ref"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)


}

}

test("homo_sapiens - [bam, bai, bed] - fasta - fai - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.value([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true)
])
input[1] = [
[id:"ref"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [
[id:"ref"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)


}

}

}
78 changes: 72 additions & 6 deletions modules/nf-core/vardictjava/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-07-04T19:08:38.328190023"
"timestamp": "2024-10-07T16:05:15.117453312"
},
"homo_sapiens - [[bam, bam], [bai, bai], bed] - fasta - fai": {
"content": [
Expand Down Expand Up @@ -60,9 +60,75 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-07-04T19:08:54.416661915"
"timestamp": "2024-10-07T16:05:26.932438089"
},
"homo_sapiens - [bam, bai, bed] - fasta - fai - fisher": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.vcf.gz:md5,e8411ecae49b4f6afa6ea0b681ea506e"
]
],
"1": [
"versions.yml:md5,6bf7aa0cbaac4a6e2acab2c475ec2389"
],
"vcf": [
[
{
"id": "test"
},
"test.vcf.gz:md5,e8411ecae49b4f6afa6ea0b681ea506e"
]
],
"versions": [
"versions.yml:md5,6bf7aa0cbaac4a6e2acab2c475ec2389"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-10-07T16:05:38.456816851"
},
"homo_sapiens - [bam, bai, bed] - fasta - fai - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,6bf7aa0cbaac4a6e2acab2c475ec2389"
],
"vcf": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,6bf7aa0cbaac4a6e2acab2c475ec2389"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-10-07T16:05:48.440804849"
}
}
3 changes: 3 additions & 0 deletions modules/nf-core/vardictjava/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
process {
ext.args = "-c 1 -S 2 -E 3 -fisher"
}
Loading