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

Add nf-test to TRIM_WORKFLOW #572

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add nf-test to nf-core module: `PICARD_COLLECTRNASEQMETRICS` and update module [#551](https://github.com/nf-core/rnafusion/pull/551)
- Add `--skip_vcf` boolean parameter to skip vcf file generation [#554](https://github.com/nf-core/rnafusion/pull/554)
- Add nf-test to local module: `FUSIONREPORT_DOWNLOAD` [#560](https://github.com/nf-core/rnafusion/pull/560)
- Add nf-test to local subworkflow: `QC_SUBWORKFLOW` [#568](https://github.com/nf-core/rnafusion/pull/568)
- 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)

### Changed

Expand Down
42 changes: 0 additions & 42 deletions subworkflows/local/trim_workflow.nf

This file was deleted.

46 changes: 46 additions & 0 deletions subworkflows/local/trim_workflow/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


include { FASTP } from '../../../modules/nf-core/fastp/main'
include { FASTQC as FASTQC_FOR_FASTP } from '../../../modules/nf-core/fastqc/main'

workflow TRIM_WORKFLOW {

take:
reads // channel [ meta, [ fastqs ] ]
adapter_fasta // channel [ path ]
fastp_trim // boolean

main:
ch_versions = Channel.empty()
ch_fastp_html = Channel.empty()
ch_fastp_json = Channel.empty()
ch_fastqc_trimmed = Channel.empty()

if ( fastp_trim ) {
FASTP(reads, adapter_fasta.ifEmpty( [] ), false, false, false)
ch_versions = ch_versions.mix(FASTP.out.versions)

FASTQC_FOR_FASTP(FASTP.out.reads)
ch_versions = ch_versions.mix(FASTQC_FOR_FASTP.out.versions)

ch_reads_all = FASTP.out.reads
ch_reads_fusioncatcher = ch_reads_all
ch_fastp_html = FASTP.out.html
ch_fastp_json = FASTP.out.json
ch_fastqc_trimmed = FASTQC_FOR_FASTP.out.zip

}
else {
ch_reads_all = reads
ch_reads_fusioncatcher = reads
}

emit:
ch_reads_all // Channel [ meta, [reads] ]
ch_reads_fusioncatcher // Channel [ meta, [reads] ]
ch_fastp_html // Channel [ meta, path_html ]
ch_fastp_json // Channel [ meta, path_json ]
ch_fastqc_trimmed // Channel [ meta, path_zip ]
versions = ch_versions // Channel [ versions ]
}

85 changes: 85 additions & 0 deletions subworkflows/local/trim_workflow/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
nextflow_workflow {

name "Test Subworkflow QC_WORKFLOW"
script "../main.nf"
workflow "TRIM_WORKFLOW"
tag "qc"
tag "subworkflow"

test("TRIM_WORKFLOW - Homo sapiens - FASTQs - FastP true") {

when {

workflow {
"""
// ch_reads
input[0] = Channel.of(
[
[id: "test_fastq"],
[
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz", checkIfExists: true),
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz", checkIfExists: true)
]
])
input[1] = Channel.empty()
input[2] = true
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ with(workflow.out) {
assert snapshot(
versions.collect{ file(it) },
ch_reads_all[0][1].collect { file(it) },
ch_reads_fusioncatcher[0][1].collect { file(it) },
file(ch_fastp_html[0][1]).name,
file(ch_fastp_json[0][1]),
ch_fastqc_trimmed[0][1].collect { file(it).name }
).match() }
}
)
}
}

test("TRIM_WORKFLOW - Homo sapiens - FASTQs - FastP false") {

when {

workflow {
"""
// ch_reads
input[0] = Channel.of(
[
[id: "test_fastq"],
[
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz", checkIfExists: true),
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz", checkIfExists: true)
]
])
input[1] = Channel.empty()
input[2] = false
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ with(workflow.out) {
assert snapshot(
versions.size() == 0,
ch_reads_all[0][1].size() == 2,
ch_reads_fusioncatcher[0][1].size() == 2,
ch_fastp_html.size() == 0,
ch_fastp_json.size() == 0,
ch_fastqc_trimmed.size() == 0
).match() }
}
)
}
}

}
44 changes: 44 additions & 0 deletions subworkflows/local/trim_workflow/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"TRIM_WORKFLOW - Homo sapiens - FASTQs - FastP true": {
"content": [
[
"versions.yml:md5,16187796d989b6260f572247e7dc0fc6",
"versions.yml:md5,ea42abe9875f41f8362a55ee7533f102"
],
[
"test_fastq_1.fastp.fastq.gz:md5,0c436583301dea48755a5252a2675b64",
"test_fastq_2.fastp.fastq.gz:md5,f7f38138255e63b33286b819b6177612"
],
[
"test_fastq_1.fastp.fastq.gz:md5,0c436583301dea48755a5252a2675b64",
"test_fastq_2.fastp.fastq.gz:md5,f7f38138255e63b33286b819b6177612"
],
"test_fastq.fastp.html",
"test_fastq.fastp.json:md5,62066ad48c3d5981045cdd43e354cb2b",
[
"test_fastq_trimmed_1_fastqc.zip",
"test_fastq_trimmed_2_fastqc.zip"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-05T14:11:12.374063253"
},
"TRIM_WORKFLOW - Homo sapiens - FASTQs - FastP false": {
"content": [
true,
true,
true,
true,
true,
true
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-05T14:21:42.396615145"
}
}
41 changes: 23 additions & 18 deletions workflows/rnafusion.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@ include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pi
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_rnafusion_pipeline'


ch_chrgtf = params.starfusion_build ? Channel.fromPath(params.chrgtf).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.starfusion_ref}/ref_annot.gtf").map { it -> [[id:it.Name], it] }.collect()
ch_starindex_ref = params.starfusion_build ? Channel.fromPath(params.starindex_ref).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.starfusion_ref}/ref_genome.fa.star.idx").map { it -> [[id:it.Name], it] }.collect()
ch_starindex_ensembl_ref = Channel.fromPath(params.starindex_ref).map { it -> [[id:it.Name], it] }.collect()
ch_refflat = params.starfusion_build ? Channel.fromPath(params.refflat).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.ensembl_ref}/ref_annot.gtf.refflat").map { it -> [[id:it.Name], it] }.collect()
ch_rrna_interval = params.starfusion_build ? Channel.fromPath(params.rrna_intervals).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.ensembl_ref}/ref_annot.interval_list").map { it -> [[id:it.Name], it] }.collect()
ch_fusionreport_ref = Channel.fromPath(params.fusionreport_ref).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_blacklist = Channel.fromPath(params.arriba_ref_blacklist).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_known_fusions = Channel.fromPath(params.arriba_ref_known_fusions).map { it -> [[id:it.Name], it] }.collect()
ch_chrgtf = params.starfusion_build ? Channel.fromPath(params.chrgtf).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.starfusion_ref}/ref_annot.gtf").map { it -> [[id:it.Name], it] }.collect()
ch_starindex_ref = params.starfusion_build ? Channel.fromPath(params.starindex_ref).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.starfusion_ref}/ref_genome.fa.star.idx").map { it -> [[id:it.Name], it] }.collect()
ch_starindex_ensembl_ref = Channel.fromPath(params.starindex_ref).map { it -> [[id:it.Name], it] }.collect()
ch_refflat = params.starfusion_build ? Channel.fromPath(params.refflat).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.ensembl_ref}/ref_annot.gtf.refflat").map { it -> [[id:it.Name], it] }.collect()
ch_rrna_interval = params.starfusion_build ? Channel.fromPath(params.rrna_intervals).map { it -> [[id:it.Name], it] }.collect() : Channel.fromPath("${params.ensembl_ref}/ref_annot.interval_list").map { it -> [[id:it.Name], it] }.collect()
ch_adapter_fastp = params.adapter_fasta ? Channel.fromPath(params.adapter_fasta, checkIfExists: true) : Channel.empty()
ch_fusionreport_ref = Channel.fromPath(params.fusionreport_ref).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_blacklist = Channel.fromPath(params.arriba_ref_blacklist).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_known_fusions = Channel.fromPath(params.arriba_ref_known_fusions).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_protein_domains = Channel.fromPath(params.arriba_ref_protein_domains).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_cytobands = Channel.fromPath(params.arriba_ref_cytobands).map { it -> [[id:it.Name], it] }.collect()
ch_hgnc_ref = Channel.fromPath(params.hgnc_ref).map { it -> [[id:it.Name], it] }.collect()
ch_hgnc_date = Channel.fromPath(params.hgnc_date).map { it -> [[id:it.Name], it] }.collect()
ch_fasta = Channel.fromPath(params.fasta).map { it -> [[id:it.Name], it] }.collect()
ch_gtf = Channel.fromPath(params.gtf).map { it -> [[id:it.Name], it] }.collect()
ch_arriba_ref_cytobands = Channel.fromPath(params.arriba_ref_cytobands).map { it -> [[id:it.Name], it] }.collect()
ch_hgnc_ref = Channel.fromPath(params.hgnc_ref).map { it -> [[id:it.Name], it] }.collect()
ch_hgnc_date = Channel.fromPath(params.hgnc_date).map { it -> [[id:it.Name], it] }.collect()
ch_fasta = Channel.fromPath(params.fasta).map { it -> [[id:it.Name], it] }.collect()
ch_gtf = Channel.fromPath(params.gtf).map { it -> [[id:it.Name], it] }.collect()
ch_salmon_index = Channel.fromPath(params.salmon_index).map { it -> [[id:it.Name], it] }.collect()
ch_transcript = Channel.fromPath(params.transcript).map { it -> [[id:it.Name], it] }.collect()
ch_fai = Channel.fromPath(params.fai).map { it -> [[id:it.Name], it] }.collect()
ch_transcript = Channel.fromPath(params.transcript).map { it -> [[id:it.Name], it] }.collect()
ch_fai = Channel.fromPath(params.fai).map { it -> [[id:it.Name], it] }.collect()



/*
Expand All @@ -51,6 +53,7 @@ workflow RNAFUSION {

take:
ch_samplesheet // channel: samplesheet read in from --input

main:

ch_versions = Channel.empty()
Expand All @@ -67,11 +70,13 @@ workflow RNAFUSION {


TRIM_WORKFLOW (
ch_samplesheet
ch_samplesheet,
ch_adapter_fastp,
params.fastp_trim
)
ch_reads_fusioncatcher = TRIM_WORKFLOW.out.ch_reads_fusioncatcher
ch_reads_all = TRIM_WORKFLOW.out.ch_reads_all
ch_versions = ch_versions.mix(TRIM_WORKFLOW.out.versions)
ch_reads_all = TRIM_WORKFLOW.out.ch_reads_all
ch_versions = ch_versions.mix(TRIM_WORKFLOW.out.versions)


SALMON_QUANT( ch_reads_all, ch_salmon_index.map{ meta, index -> index }, ch_gtf.map{ meta, gtf -> gtf }, [], false, 'A')
Expand Down
Loading