Skip to content

Commit

Permalink
Merge pull request #586 from atrigila/starfusion_detect
Browse files Browse the repository at this point in the history
Add nf-test to local module `STARFUSION_DETECT`
  • Loading branch information
atrigila authored Dec 20, 2024
2 parents 3f4406a + 945bf0f commit a815895
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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 [#577](https://github.com/nf-core/rnafusion/pull/577)
- Add nf-test to local subworkflow: `ARRIBA_WORKFLOW` [#578](https://github.com/nf-core/rnafusion/pull/578)
- Add nf-test to local module: `STARFUSION_BUILD`. [#585](https://github.com/nf-core/rnafusion/pull/585)
- Add nf-test to local module: `STARFUSION_DETECT`. [#586](https://github.com/nf-core/rnafusion/pull/586)
- Added a new module `CTATSPLICING_STARTOCANCERINTRONS` and a new parameter `--ctatsplicing`. This options creates reports on cancer splicing abberations and requires one or both of `--arriba` and `--starfusion` to be given. [#587](https://github.com/nf-core/rnafusion/pull/587)

### Changed
Expand Down
7 changes: 4 additions & 3 deletions modules/local/starfusion/detect/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ process STARFUSION {

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def fasta = meta.single_end ? "--left_fq ${reads[0]}" : "--left_fq ${reads[0]} --right_fq ${reads[1]}"
def fastq_arg = reads ? (meta.single_end ? "--left_fq ${reads[0]}" : "--left_fq ${reads[0]} --right_fq ${reads[1]}") : ""
def junction_arg = junction ? "-J ${junction}" : ""
def args = task.ext.args ?: ''
"""
STAR-Fusion \\
--genome_lib_dir $reference \\
$fasta \\
-J $junction \\
$fastq_arg \\
$junction_arg \\
--CPU $task.cpus \\
--examine_coding_effect \\
--output_dir . \\
Expand Down
87 changes: 87 additions & 0 deletions modules/local/starfusion/detect/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
nextflow_process {

name "Test Process STARFUSION"
script "../main.nf"
process "STARFUSION"

setup {
run("STARFUSION_BUILD") {
script "../../../starfusion/build/main.nf"
process {
"""
input[0] = [
[ id:'minigenome fasta' ],
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/master/minigenome.fa")
]
input[1] = [
[ id:'minigenome gtf' ],
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/master/minigenome.gtf")
]
input [2] = file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/master/CTAT_HumanFusionLib.mini.dat.gz")
input [3] = "human"
"""
}
}
}

test("Should run without failures") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/v0.0.1/rnaseq_1.fastq.gz"),
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/v0.0.1/rnaseq_2.fastq.gz")
], // reads
[] // empty list for junction, as we don't have a pre-computed Chimeric.out.junction file
]
input[1] = STARFUSION_BUILD.out.reference.map { it[1] }
"""
}
}

then {
assert process.success
assert snapshot(
process.out.fusions,
process.out.abridged,
process.out.coding_effect,
process.out.versions
).match()
}

}

test("Should create stub files") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_stub', single_end:false ],
[
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/v0.0.1/rnaseq_1.fastq.gz"),
file("https://github.com/STAR-Fusion/STAR-Fusion-Tutorial/raw/v0.0.1/rnaseq_2.fastq.gz")
],
[] // empty list for junction
]
input[1] = STARFUSION_BUILD.out.reference.map { it[1] }
"""
}
}

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

}

}
112 changes: 112 additions & 0 deletions modules/local/starfusion/detect/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"Should create stub files": {
"content": [
{
"0": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.fusion_predictions.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.abridged.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.abridged.coding_effect.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
"versions.yml:md5,a8fb6344fdf740dde0941048313fc243"
],
"abridged": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.abridged.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"coding_effect": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.abridged.coding_effect.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"fusions": [
[
{
"id": "test_stub",
"single_end": false
},
"test_stub.starfusion.fusion_predictions.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,a8fb6344fdf740dde0941048313fc243"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-19T18:42:06.988178092"
},
"Should run without failures": {
"content": [
[
[
{
"id": "test",
"single_end": false
},
"test.starfusion.fusion_predictions.tsv:md5,82834fffed743afe07da82bd56d50c99"
]
],
[
[
{
"id": "test",
"single_end": false
},
"test.starfusion.abridged.tsv:md5,d6d20fdd4b5cba21b9c0ebf8e0ea19ff"
]
],
[
[
{
"id": "test",
"single_end": false
},
"test.starfusion.abridged.coding_effect.tsv:md5,95dfce6fdaf3589f23881fe1e855c62b"
]
],
[
"versions.yml:md5,a8fb6344fdf740dde0941048313fc243"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-19T18:41:49.150362156"
}
}
2 changes: 1 addition & 1 deletion subworkflows/local/starfusion_workflow.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ workflow STARFUSION_WORKFLOW {
SAMTOOLS_INDEX_FOR_STARFUSION(STAR_FOR_STARFUSION.out.bam_sorted)
ch_versions = ch_versions.mix(SAMTOOLS_INDEX_FOR_STARFUSION.out.versions)
bam_sorted_indexed = STAR_FOR_STARFUSION.out.bam_sorted.join(SAMTOOLS_INDEX_FOR_STARFUSION.out.bai)
reads_junction = reads.join(STAR_FOR_STARFUSION.out.junction )
reads_junction = reads.join(STAR_FOR_STARFUSION.out.junction ) // TODO: This join is not needed as STARFUSION can simply read from the junction file: https://github.com/STAR-Fusion/STAR-Fusion/wiki#alternatively-kickstart-mode-running-star-yourself-and-then-running-star-fusion-using-the-existing-outputs

if (params.ctatsplicing || params.all) {
CTATSPLICING_WORKFLOW(
Expand Down

0 comments on commit a815895

Please sign in to comment.