Skip to content

Commit

Permalink
Merge pull request #577 from atrigila/fusionreport_detect
Browse files Browse the repository at this point in the history
Add nf-test to `FUSIONREPORT_DETECT`
  • Loading branch information
atrigila authored Dec 9, 2024
2 parents 739c482 + d7a06ea commit cc5d4b9
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add nf-test to local module: `FUSIONREPORT_DOWNLOAD` [#560](https://github.com/nf-core/rnafusion/pull/560)
- Add nf-test to local subworkflow: `QC_WORKFLOW` [#568](https://github.com/nf-core/rnafusion/pull/568)
- Add nf-test to local subworkflow: `TRIM_WORKFLOW` [#572](https://github.com/nf-core/rnafusion/pull/572)
- Add nf-test to local module: `FUSIONREPORT_DETECT`. Improve `FUSIONREPORT_DOWNLOAD` module [#572](https://github.com/nf-core/rnafusion/pull/577)

### Changed

Expand Down
117 changes: 117 additions & 0 deletions modules/local/fusionreport/detect/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
nextflow_process {

name "Test Process FUSIONREPORT"
script "../main.nf"
process "FUSIONREPORT"
tag "modules"
tag "modules_local"
tag "fusionreport"


test("FUSIONREPORT - arriba - starfusion - fusioncatcher") {
config './nextflow.config'

setup {
run("FUSIONREPORT_DOWNLOAD") {
script "../../../fusionreport/download/main.nf"
process {
"""
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test_sample' ], // meta map
file("https://github.com/nf-core/test-datasets/raw/rnafusion/testdata/human/reads_1.fq.gz"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/arriba.tsv"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/starfusion.tsv"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/fusioncatcher.txt")
]
input[1] = FUSIONREPORT_DOWNLOAD.out.fusionreport_db
input[2] = 1
"""
}
params {
arriba = true
starfusion = true
fusioncatcher = true
no_cosmic = true
outdir = "$outputDir"
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.fusion_list,
process.out.fusion_list_filtered,
process.out.csv,
file(process.out.report[0][1]).name,
process.out.html[0][1].collect { file(it).name },
process.out.json,
process.out.versions.flatten().first().toString().split('/')[-1] // md5sum not stable as versions contains DB timestamp
).match() }
)
}

}

test("FUSIONREPORT - arriba - starfusion - fusioncatcher - stub") {
config './nextflow.config'

setup {
run("FUSIONREPORT_DOWNLOAD") {
script "../../../fusionreport/download/main.nf"
process {
"""
"""
}
}
}

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_sample' ], // meta map
file("https://github.com/nf-core/test-datasets/raw/rnafusion/testdata/human/reads_1.fq.gz"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/arriba.tsv"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/starfusion.tsv"),
file("https://github.com/Clinical-Genomics/fusion-report/raw/master/tests/test_data/fusioncatcher.txt")
]
input[1] = FUSIONREPORT_DOWNLOAD.out.fusionreport_db
input[2] = 1
"""
}
params {
arriba = true
starfusion = true
fusioncatcher = true
no_cosmic = true
outdir = "$outputDir"
}
}

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


}
186 changes: 186 additions & 0 deletions modules/local/fusionreport/detect/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"FUSIONREPORT - arriba - starfusion - fusioncatcher": {
"content": [
[
[
{
"id": "test_sample"
},
"test_sample.fusionreport.tsv:md5,3593b7021f26cc5427fdc96f0d1c72f0"
]
],
[
[
{
"id": "test_sample"
},
"test_sample.fusionreport_filtered.tsv:md5,3593b7021f26cc5427fdc96f0d1c72f0"
]
],
[
[
{
"id": "test_sample"
},
"test_sample.fusions.csv:md5,49f378c2112d7e0b3b17d9095c79e6bd"
]
],
"test_sample_fusionreport_index.html",
[
"AKAP9_BRAF.html",
"BRD4-1_NUTM1.html",
"BRD4_NUTM1.html",
"CD74_AL132671.2.html",
"CD74_ROS1.html",
"CIC_DUX4.html",
"DUX4_IGH@.html",
"EML4_ALK.html",
"ETV6_NTRK3.html",
"EWSR1_ATF1.html",
"EWSR1_FLI1.html",
"FGFR3_TACC3.html",
"FIP1L1_PDGFRA.html",
"GOPC_ROS1.html",
"HOOK3_RET.html",
"IGH@_CRLF2.html",
"MALT1_IGH@.html",
"NPM1_ALK.html",
"TMPRSS2_ETV1.html",
"test_sample_fusionreport_index.html"
],
[
[
{
"id": "test_sample"
},
"fusion_genes_mqc.json:md5,b196dc8d064a47d17fd3a032b8fbed4f"
]
],
"versions.yml"
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-06T14:23:44.59690452"
},
"FUSIONREPORT - arriba - starfusion - fusioncatcher - stub": {
"content": [
{
"0": [
"versions.yml:md5,6bd28f2526774f519a7627a30c6a7f2f"
],
"1": [
[
{
"id": "test_sample"
},
"test_sample.fusionreport.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test_sample"
},
"test_sample.fusionreport_filtered.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
[
{
"id": "test_sample"
},
"test_sample_fusionreport_index.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [
[
{
"id": "test_sample"
},
[
"AAA_BBB.html:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_sample_fusionreport_index.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"5": [
[
{
"id": "test_sample"
},
"test_sample.fusions.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"6": [
[
{
"id": "test_sample"
},
"test_sample.fusions.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"csv": [
[
{
"id": "test_sample"
},
"test_sample.fusions.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fusion_list": [
[
{
"id": "test_sample"
},
"test_sample.fusionreport.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fusion_list_filtered": [
[
{
"id": "test_sample"
},
"test_sample.fusionreport_filtered.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"html": [
[
{
"id": "test_sample"
},
[
"AAA_BBB.html:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_sample_fusionreport_index.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"json": [
[
{
"id": "test_sample"
},
"test_sample.fusions.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"report": [
[
{
"id": "test_sample"
},
"test_sample_fusionreport_index.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,6bd28f2526774f519a7627a30c6a7f2f"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-06T13:12:32.981394201"
}
}
10 changes: 10 additions & 0 deletions modules/local/fusionreport/detect/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
process {
withName: 'FUSIONREPORT_DOWNLOAD' {
ext.args = "--no-cosmic"
}

withName: 'FUSIONREPORT' {
ext.args = { {params.no_cosmic} ? "--no-cosmic" : "" }
ext.args2 = "--export csv"
}
}
26 changes: 13 additions & 13 deletions modules/local/fusionreport/download/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ process FUSIONREPORT_DOWNLOAD {
container "docker.io/clinicalgenomics/fusion-report:3.1.0"

output:
path "fusiongdb2.db" , emit: fusiongdb2
path "mitelman.db" , emit: mitelman
path "cosmic.db" , emit: cosmic, optional: true
path "*.txt" , emit: timestamp
path "*.log" , emit: log
path "versions.yml" , emit: versions
tuple val(meta), path("fusionreport_dbs"), emit: fusionreport_db
path "versions.yml" , emit: versions

script:
meta = [id: 'fusionreport_dbs']
def args = task.ext.args ?: ''
def args2 = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
"""
fusion_report download $args ./
mkdir fusionreport_dbs
mv *.txt *.log *.db fusionreport_dbs
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -26,17 +25,18 @@ process FUSIONREPORT_DOWNLOAD {
"""

stub:
meta = [id: 'fusionreport_dbs']
"""
touch cosmic.db
touch fusiongdb2.db
touch mitelman.db
touch DB-timestamp.txt
touch fusion_report.log
mkdir fusionreport_dbs
touch fusionreport_dbs/cosmic.db
touch fusionreport_dbs/fusiongdb2.db
touch fusionreport_dbs/mitelman.db
touch fusionreport_dbs/DB-timestamp.txt
touch fusionreport_dbs/fusion_report.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
fusion_report: \$(fusion_report --version | sed 's/fusion-report //')
END_VERSIONS
"""

}
6 changes: 4 additions & 2 deletions modules/local/fusionreport/download/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.fusiongdb2,
process.out.mitelman,
path(process.out.fusionreport_db[0][1]).resolve("fusiongdb2.db"),
path(process.out.fusionreport_db[0][1]).resolve("mitelman.db"),
path(process.out.fusionreport_db[0][1]).resolve("DB-timestamp.txt").exists(),
path(process.out.fusionreport_db[0][1]).resolve("fusion_report.log").exists(),
process.out.versions
).match() }
)
Expand Down
Loading

0 comments on commit cc5d4b9

Please sign in to comment.