diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b18a92..ebac98c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix missing memory unit for fusioncatcher [#674](https://github.com/nf-core/rnafusion/pull/674) - Fix fusioncatcher download link [#693](https://github.com/nf-core/rnafusion/pull/693) - Fix fusionreport singularity container [#713](https://github.com/nf-core/rnafusion/pull/713) +- Fix behavior when no fusion is present (log a warning and avoid running depending processes)[#714](https://github.com/nf-core/rnafusion/pull/714) - Fix CTAT-SPLICING output when no cancer introns were found [#722](https://github.com/nf-core/rnafusion/pull/722) - Update VCF_COLLECT script to adapt to transcript_version not being an entry in fusioninspector gtf anymore [#726](https://github.com/nf-core/rnafusion/pull/726) - Fix rRNA detection and make it more customizable with nf-core modules [#736](https://github.com/nf-core/rnafusion/pull/736) diff --git a/modules/local/vcf_collect/main.nf b/modules/local/vcf_collect/main.nf index 2968c67b..e43a1171 100644 --- a/modules/local/vcf_collect/main.nf +++ b/modules/local/vcf_collect/main.nf @@ -21,7 +21,6 @@ process VCF_COLLECT { script: def prefix = task.ext.prefix ?: "${meta.id}" - // TODO use BGZIP to compress the VCF file instead of GZIP """ vcf_collect.py --fusioninspector $fusioninspector_tsv --fusionreport $fusionreport_report --fusioninspector_gtf $fusioninspector_gtf_tsv --fusionreport_csv $fusionreport_csv --hgnc $hgnc_ref --sample ${prefix} --out ${prefix}_fusion_data.vcf diff --git a/subworkflows/local/fusioninspector_workflow/main.nf b/subworkflows/local/fusioninspector_workflow/main.nf index 7324d832..de07933d 100644 --- a/subworkflows/local/fusioninspector_workflow/main.nf +++ b/subworkflows/local/fusioninspector_workflow/main.nf @@ -44,18 +44,30 @@ workflow FUSIONINSPECTOR_WORKFLOW { FUSIONINSPECTOR( ch_reads_fusion, ch_starfusion_ref) ch_versions = ch_versions.mix(FUSIONINSPECTOR.out.versions) - if(!skip_vcf) { - AGAT_CONVERTSPGFF2TSV(FUSIONINSPECTOR.out.out_gtf) + def tsv_nonempty = FUSIONINSPECTOR.out.tsv.filter { _meta, file -> file.exists() && file.size() > 0 } + def tsv_abridged_nonempty = FUSIONINSPECTOR.out.abridged_tsv.filter { _meta, file -> file.exists() && file.size() > 0 } + def gtf_nonempty = FUSIONINSPECTOR.out.out_gtf.filter { _meta, file -> file.exists() && file.size() > 0 } + if (!tsv_nonempty) { + log.warn("FUSIONINSPECTOR confirmed no fusions, skipping VCF and visualisation steps.") + } + if ( + !skip_vcf + ) { + AGAT_CONVERTSPGFF2TSV(gtf_nonempty) ch_versions = ch_versions.mix(AGAT_CONVERTSPGFF2TSV.out.versions) - fusion_data = FUSIONINSPECTOR.out.abridged_tsv.join(AGAT_CONVERTSPGFF2TSV.out.tsv).join(fusionreport_out).join(fusionreport_csv) + fusion_data = tsv_abridged_nonempty + .join(AGAT_CONVERTSPGFF2TSV.out.tsv) + .join(fusionreport_out) + .join(fusionreport_csv) VCF_COLLECT(fusion_data, ch_hgnc_ref, ch_hgnc_date) ch_versions = ch_versions.mix(VCF_COLLECT.out.versions) } - - if (!skip_vis) { - ch_bam_sorted_indexed_fusions = bam_sorted_indexed.join(FUSIONINSPECTOR.out.tsv) + if ( + !skip_vis + ){ + ch_bam_sorted_indexed_fusions = bam_sorted_indexed.join(tsv_nonempty) ARRIBA_VISUALISATION( ch_bam_sorted_indexed_fusions, ch_gtf, diff --git a/subworkflows/local/fusioninspector_workflow/tests/main.nf.test b/subworkflows/local/fusioninspector_workflow/tests/main.nf.test index 746763ee..37034d57 100644 --- a/subworkflows/local/fusioninspector_workflow/tests/main.nf.test +++ b/subworkflows/local/fusioninspector_workflow/tests/main.nf.test @@ -74,11 +74,11 @@ nextflow_workflow { when { params { no_cosmic = true - whitelist = [] + whitelist = "" outdir = "test" genomes_base = "test" fusionreport_download_args = '--no-cosmic' - fusionreport_detect_args = {params.no_cosmic} ? "--no-cosmic" : "" + fusionreport_detect_args = "--no-cosmic" fusionreport_detect_args2 = "--export csv" } workflow { @@ -94,23 +94,22 @@ nextflow_workflow { input[2] = Channel.of([ [id:'test_sample'], file("https://github.com/FusionInspector/FusionInspector/raw/master/test/fusion_targets.A.txt")]) input[3] = FUSIONREPORT_DETECT.out.report input[4] = FUSIONREPORT_DETECT.out.csv - input[5] = Channel.of([ - [id:'test_sample'], - [], - [] + input[5] = Channel.of([[ id:'test', single_end:false ], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam.bai", checkIfExists: true) ]) input[6] = Channel.of( [ [ id:'test_gtf' ], file('https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/minigenome.gtf')]) - input[7] = Channel.of(file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/protein_domains_hg38_GRCh38_v2.5.0.gff3")) - input[8] = Channel.of(file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/cytobands_hg38_GRCh38_v2.5.0.tsv")) + input[7] = Channel.fromPath("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/protein_domains_hg38_GRCh38_v2.5.0.gff3") + input[8] = Channel.fromPath("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/cytobands_hg38_GRCh38_v2.5.0.tsv") input[9] = Channel.of([[ id:'hgnc' ], file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/hgnc/hgnc_complete_set.txt")] ) input[10] = Channel.of([[ id:'hgnc_timestamp' ], file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/hgnc/HGNC-DB-timestamp.txt")] ) input[11] = STARFUSION_BUILD.out.reference input[12] = false input[13] = true input[14] = 1 - input[15] = [] + input[15] = null """ } } @@ -118,7 +117,6 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(file(workflow.out.ch_arriba_visualisation[0][1]).length()) }, { assert snapshot(workflow.out.versions).match() } ) } @@ -183,11 +181,11 @@ nextflow_workflow { when { params { no_cosmic = true - whitelist = [] + whitelist = "" outdir = "test" genomes_base = "test" fusionreport_download_args = '--no-cosmic' - fusionreport_detect_args = {params.no_cosmic} ? "--no-cosmic" : "" + fusionreport_detect_args = "--no-cosmic" fusionreport_detect_args2 = "--export csv" } workflow { @@ -203,23 +201,22 @@ nextflow_workflow { input[2] = Channel.of([ [id:'test_sample'], file("https://github.com/FusionInspector/FusionInspector/raw/master/test/fusion_targets.A.txt")]) input[3] = FUSIONREPORT_DETECT.out.report input[4] = FUSIONREPORT_DETECT.out.csv - input[5] = Channel.of([ - [id:'test_sample'], - [], - [] + input[5] = Channel.of([[ id:'test', single_end:false ], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam.bai", checkIfExists: true) ]) input[6] = Channel.of( [ [ id:'test_gtf' ], file('https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/minigenome.gtf')]) - input[7] = Channel.of(file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/protein_domains_hg38_GRCh38_v2.5.0.gff3")) - input[8] = Channel.of(file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/cytobands_hg38_GRCh38_v2.5.0.tsv")) + input[7] = Channel.fromPath("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/protein_domains_hg38_GRCh38_v2.5.0.gff3") + input[8] = Channel.fromPath("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/arriba/cytobands_hg38_GRCh38_v2.5.0.tsv") input[9] = Channel.of([[ id:'hgnc' ], file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/hgnc/hgnc_complete_set.txt")] ) input[10] = Channel.of([[ id:'hgnc_timestamp' ], file("https://github.com/nf-core/test-datasets/raw/refs/heads/rnafusion/testdata/reference/hgnc/HGNC-DB-timestamp.txt")] ) input[11] = STARFUSION_BUILD.out.reference input[12] = false input[13] = true input[14] = 1 - input[15] = params.whitelist + input[15] = null """ } } diff --git a/subworkflows/local/fusioninspector_workflow/tests/main.nf.test.snap b/subworkflows/local/fusioninspector_workflow/tests/main.nf.test.snap index 8c257811..f156b0d2 100644 --- a/subworkflows/local/fusioninspector_workflow/tests/main.nf.test.snap +++ b/subworkflows/local/fusioninspector_workflow/tests/main.nf.test.snap @@ -3,48 +3,35 @@ "content": [ { "0": [ - [ - { - "id": "test_sample" - }, - "test_sample_combined_fusions_arriba_visualisation.pdf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + ], "1": [ - "versions.yml:md5,01dce7699931b293311f2e5436b88a3a", "versions.yml:md5,3be8e23309ed0bacebcad3d2fb30642a" ], "ch_arriba_visualisation": [ - [ - { - "id": "test_sample" - }, - "test_sample_combined_fusions_arriba_visualisation.pdf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + ], "versions": [ - "versions.yml:md5,01dce7699931b293311f2e5436b88a3a", "versions.yml:md5,3be8e23309ed0bacebcad3d2fb30642a" ] } ], "meta": { "nf-test": "0.9.2", - "nextflow": "25.04.2" + "nextflow": "25.04.6" }, - "timestamp": "2025-08-26T20:11:13.798144726" + "timestamp": "2025-09-08T17:38:59.895142" }, "FUSIONINSPECTOR_WORKFLOW - human": { "content": [ [ - "versions.yml:md5,01dce7699931b293311f2e5436b88a3a", "versions.yml:md5,3be8e23309ed0bacebcad3d2fb30642a" ] ], "meta": { "nf-test": "0.9.2", - "nextflow": "25.04.2" + "nextflow": "25.04.6" }, - "timestamp": "2025-08-28T21:54:05.453749443" + "timestamp": "2025-09-08T17:14:05.797063" } } \ No newline at end of file diff --git a/subworkflows/local/fusioninspector_workflow/tests/nextflow.config b/subworkflows/local/fusioninspector_workflow/tests/nextflow.config index e00f3ced..5dad203b 100644 --- a/subworkflows/local/fusioninspector_workflow/tests/nextflow.config +++ b/subworkflows/local/fusioninspector_workflow/tests/nextflow.config @@ -3,14 +3,6 @@ process { ext.args = [] } - withName: 'FUSIONREPORT_DOWNLOAD' { - ext.args = params.fusionreport_download_args - } - - withName: 'FUSIONREPORT_DETECT' { - ext.args = params.fusionreport_detect_args - ext.args2 = params.fusionreport_detect_args2 - } withName: 'FUSIONINSPECTOR' { ext.args = '--annotate --examine_coding_effect' diff --git a/subworkflows/local/qc_workflow/test/main.nf.test b/subworkflows/local/qc_workflow/test/main.nf.test index ba3053e9..06a6a4c6 100644 --- a/subworkflows/local/qc_workflow/test/main.nf.test +++ b/subworkflows/local/qc_workflow/test/main.nf.test @@ -61,7 +61,7 @@ nextflow_workflow { input[1] = Channel.of( [ [id: 'chr22_dict'], - file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.dict", checkIfExists: true) + file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.dict", checkIfExist: true) ] ) """ @@ -71,11 +71,10 @@ nextflow_workflow { } when { - // Params to activate modules ext.when condition params { skip_qc = false fusioninspector_only = false - tools = "starfusion" + tools = "all" outdir = "test" } diff --git a/tests/test_build.nf.test.snap b/tests/test_build.nf.test.snap index 722144ae..55d1df2b 100644 --- a/tests/test_build.nf.test.snap +++ b/tests/test_build.nf.test.snap @@ -286,6 +286,6 @@ "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2025-09-05T12:58:07.878931" + "timestamp": "2025-09-09T11:45:13.886497" } } \ No newline at end of file diff --git a/tests/test_stub.nf.test.snap b/tests/test_stub.nf.test.snap index e54f807a..df001725 100644 --- a/tests/test_stub.nf.test.snap +++ b/tests/test_stub.nf.test.snap @@ -561,20 +561,14 @@ }, "stub test fusioninspector": { "content": [ - 34, + 31, { "AGAT_CONVERTGFF2BED": { "agat": "v1.5.1" }, - "AGAT_CONVERTSPGFF2TSV": { - "agat": "v1.4.1" - }, "ARRIBA_ARRIBA": { "arriba": "2.5.0" }, - "ARRIBA_VISUALISATION": { - "arriba": "2.5.0" - }, "BIOAWK": { "bioawk": 1.0 }, @@ -648,10 +642,6 @@ "UCSC_GTFTOGENEPRED": { "ucsc": 447 }, - "VCF_COLLECT": { - "python": "3.11.0", - "vcf_collect": 0.1 - }, "Workflow": { "nf-core/rnafusion": "v4.0.0dev" } @@ -659,12 +649,9 @@ [ "agat", "agat/Homo_sapiens.GRCh38.46.gtf.bed", - "agat/test.tsv", "arriba", "arriba/test.arriba.fusions.discarded.tsv", "arriba/test.arriba.fusions.tsv", - "arriba_visualisation", - "arriba_visualisation/test_combined_fusions_arriba_visualisation.pdf", "bioawk", "bioawk/Homo_sapiens.GRCh38.46.gtf_rrna.gtf.gz", "fastqc", @@ -840,9 +827,7 @@ "star/test.toTranscriptome.out.bam", "star/test.unmapped_1.fastq.gz", "star/test.unmapped_2.fastq.gz", - "star/testXd.out.bam", - "vcf", - "vcf/test_fusion_data.vcf" + "star/testXd.out.bam" ] ], "meta": { @@ -1708,20 +1693,14 @@ }, "stub test all": { "content": [ - 45, + 42, { "AGAT_CONVERTGFF2BED": { "agat": "v1.5.1" }, - "AGAT_CONVERTSPGFF2TSV": { - "agat": "v1.4.1" - }, "ARRIBA_ARRIBA": { "arriba": "2.5.0" }, - "ARRIBA_VISUALISATION": { - "arriba": "2.5.0" - }, "BIOAWK": { "bioawk": 1.0 }, @@ -1828,10 +1807,6 @@ "UCSC_GTFTOGENEPRED": { "ucsc": 447 }, - "VCF_COLLECT": { - "python": "3.11.0", - "vcf_collect": 0.1 - }, "Workflow": { "nf-core/rnafusion": "v4.0.0dev" } @@ -1839,12 +1814,9 @@ [ "agat", "agat/Homo_sapiens.GRCh38.46.gtf.bed", - "agat/test.tsv", "arriba", "arriba/test.arriba.fusions.discarded.tsv", "arriba/test.arriba.fusions.tsv", - "arriba_visualisation", - "arriba_visualisation/test_combined_fusions_arriba_visualisation.pdf", "bioawk", "bioawk/Homo_sapiens.GRCh38.46.gtf_rrna.gtf.gz", "ctatsplicing", @@ -2082,9 +2054,7 @@ "stringtie/test.ballgown", "stringtie/test.coverage.gtf", "stringtie/test.gene.abundance.txt", - "stringtie/test.transcripts.gtf", - "vcf", - "vcf/test_fusion_data.vcf" + "stringtie/test.transcripts.gtf" ] ], "meta": { diff --git a/tests/test_stub_bam.nf.test.snap b/tests/test_stub_bam.nf.test.snap index 5efbe384..c40bcb57 100644 --- a/tests/test_stub_bam.nf.test.snap +++ b/tests/test_stub_bam.nf.test.snap @@ -429,20 +429,14 @@ }, "stub test fusioninspector": { "content": [ - 23, + 20, { "AGAT_CONVERTGFF2BED": { "agat": "v1.5.1" }, - "AGAT_CONVERTSPGFF2TSV": { - "agat": "v1.4.1" - }, "ARRIBA_ARRIBA": { "arriba": "2.5.0" }, - "ARRIBA_VISUALISATION": { - "arriba": "2.5.0" - }, "BIOAWK": { "bioawk": 1.0 }, @@ -496,10 +490,6 @@ "UCSC_GTFTOGENEPRED": { "ucsc": 447 }, - "VCF_COLLECT": { - "python": "3.11.0", - "vcf_collect": 0.1 - }, "Workflow": { "nf-core/rnafusion": "v4.0.0dev" } @@ -507,12 +497,9 @@ [ "agat", "agat/Homo_sapiens.GRCh38.46.gtf.bed", - "agat/test.tsv", "arriba", "arriba/test.arriba.fusions.discarded.tsv", "arriba/test.arriba.fusions.tsv", - "arriba_visualisation", - "arriba_visualisation/test_combined_fusions_arriba_visualisation.pdf", "bioawk", "bioawk/Homo_sapiens.GRCh38.46.gtf_rrna.gtf.gz", "fastqc", @@ -666,9 +653,7 @@ "references/GRCh38/hgnc/hgnc_complete_set.txt", "star", "star/test.Aligned.sortedByCoord.out.bam", - "star/test.Aligned.sortedByCoord.out.bam.bai", - "vcf", - "vcf/test_fusion_data.vcf" + "star/test.Aligned.sortedByCoord.out.bam.bai" ] ], "meta": { @@ -1423,20 +1408,14 @@ }, "stub test all": { "content": [ - 34, + 31, { "AGAT_CONVERTGFF2BED": { "agat": "v1.5.1" }, - "AGAT_CONVERTSPGFF2TSV": { - "agat": "v1.4.1" - }, "ARRIBA_ARRIBA": { "arriba": "2.5.0" }, - "ARRIBA_VISUALISATION": { - "arriba": "2.5.0" - }, "BIOAWK": { "bioawk": 1.0 }, @@ -1523,10 +1502,6 @@ "UCSC_GTFTOGENEPRED": { "ucsc": 447 }, - "VCF_COLLECT": { - "python": "3.11.0", - "vcf_collect": 0.1 - }, "Workflow": { "nf-core/rnafusion": "v4.0.0dev" } @@ -1534,12 +1509,9 @@ [ "agat", "agat/Homo_sapiens.GRCh38.46.gtf.bed", - "agat/test.tsv", "arriba", "arriba/test.arriba.fusions.discarded.tsv", "arriba/test.arriba.fusions.tsv", - "arriba_visualisation", - "arriba_visualisation/test_combined_fusions_arriba_visualisation.pdf", "bioawk", "bioawk/Homo_sapiens.GRCh38.46.gtf_rrna.gtf.gz", "ctatsplicing", @@ -1755,9 +1727,7 @@ "stringtie/test.ballgown", "stringtie/test.coverage.gtf", "stringtie/test.gene.abundance.txt", - "stringtie/test.transcripts.gtf", - "vcf", - "vcf/test_fusion_data.vcf" + "stringtie/test.transcripts.gtf" ] ], "meta": {