-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from alanmmobbs93/qc_subworkflow_test
QC subworkflow test
- Loading branch information
Showing
7 changed files
with
214 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Extract descriptive values from BAMs | ||
// | ||
|
||
include { PICARD_COLLECTRNASEQMETRICS } from '../../../modules/nf-core/picard/collectrnaseqmetrics' | ||
include { GATK4_MARKDUPLICATES } from '../../../modules/nf-core/gatk4/markduplicates' | ||
include { PICARD_COLLECTINSERTSIZEMETRICS } from '../../../modules/nf-core/picard/collectinsertsizemetrics' | ||
|
||
workflow QC_WORKFLOW { | ||
take: | ||
ch_bam_sorted // channel [ meta, bam ] | ||
ch_chrgtf // channel [ meta, gtf ] | ||
ch_refflat // channel [ meta, refflat ] | ||
ch_fasta // channel [ meta, fasta ] | ||
ch_fai // channel [ meta, fai ] | ||
ch_rrna_interval // channel [ meta, interval ] | ||
|
||
main: | ||
ch_versions = Channel.empty() | ||
|
||
PICARD_COLLECTRNASEQMETRICS(ch_bam_sorted, ch_refflat.map{ meta, refflat -> [ refflat ] }, ch_fasta.map{ meta, fasta -> [ fasta ] }, ch_rrna_interval.map{ meta, intervals -> [ intervals ] }.ifEmpty([]) ) // Some chromosome or annotation may not have rRNA genes | ||
ch_versions = ch_versions.mix(PICARD_COLLECTRNASEQMETRICS.out.versions) | ||
ch_rnaseq_metrics = PICARD_COLLECTRNASEQMETRICS.out.metrics | ||
|
||
GATK4_MARKDUPLICATES(ch_bam_sorted, ch_fasta.map { meta, fasta -> [ fasta ]}, ch_fai.map { meta, fasta_fai -> [ fasta_fai ]}) | ||
ch_versions = ch_versions.mix(GATK4_MARKDUPLICATES.out.versions) | ||
ch_duplicate_metrics = GATK4_MARKDUPLICATES.out.metrics | ||
|
||
PICARD_COLLECTINSERTSIZEMETRICS(ch_bam_sorted) | ||
ch_versions = ch_versions.mix(PICARD_COLLECTINSERTSIZEMETRICS.out.versions) | ||
ch_insertsize_metrics = PICARD_COLLECTINSERTSIZEMETRICS.out.metrics | ||
|
||
emit: | ||
versions = ch_versions // channel [ path ] | ||
rnaseq_metrics = ch_rnaseq_metrics // channel [ meta, path ] | ||
duplicate_metrics = ch_duplicate_metrics // channel [ meta, path ] | ||
insertsize_metrics = ch_insertsize_metrics // channel [ meta, path ] | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
nextflow_workflow { | ||
|
||
name "Test Subworkflow QC_WORKFLOW" | ||
script "../main.nf" | ||
config "./nextflow.config" | ||
workflow "QC_WORKFLOW" | ||
tag "qc" | ||
tag "subworkflow" | ||
|
||
test("QC_WORKFLOW - Homo sapiens chr22") { | ||
|
||
// Generate refflat file | ||
setup { | ||
|
||
// Create refflat reference | ||
run("UCSC_GTFTOGENEPRED") { | ||
script "../../../../modules/nf-core/ucsc/gtftogenepred/main.nf" | ||
process { | ||
""" | ||
input[0] = | ||
Channel.fromPath( | ||
"https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.gtf", | ||
checkIfExists: true | ||
) | ||
.map{ [ [id:it.Name], it ] } | ||
""" | ||
} | ||
} | ||
|
||
// Filter GTF to extract rRNA genes | ||
run("RRNATRANSCRIPTS") { | ||
script "../../../../modules/nf-core/rrnatranscripts/main.nf" | ||
process { | ||
""" | ||
input[0] = Channel.fromPath("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.gtf", checkIfExists: true) | ||
""" | ||
} | ||
} | ||
|
||
// Convert rRNA GTF to BED | ||
run("BEDOPS_CONVERT2BED") { | ||
script "../../../../modules/nf-core/bedops/convert2bed/main.nf" | ||
process { | ||
""" | ||
input[0] = RRNATRANSCRIPTS.out.rrna_gtf.map{ it -> [ [id:it.Name], it ] } | ||
""" | ||
} | ||
} | ||
|
||
// Convert rRNA BED to interval list (the necessary file) | ||
run("GATK4_BEDTOINTERVALLIST") { | ||
script "../../../../modules/nf-core/gatk4/bedtointervallist/main.nf" | ||
process { | ||
""" | ||
input[0] = BEDOPS_CONVERT2BED.out.bed | ||
input[1] = Channel.of( | ||
[ | ||
[id: 'chr22_dic'], | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.dic", checkIfExist: true) | ||
] | ||
) | ||
""" | ||
} | ||
} | ||
|
||
} | ||
|
||
when { | ||
// Params to activate modules ext.when condition | ||
params { | ||
skip_qc = false | ||
fusioninspector_only = false | ||
starfusion = true | ||
all = true | ||
} | ||
|
||
workflow { | ||
""" | ||
// ch_bam_sorted | ||
input[0] = Channel.of( | ||
[ | ||
[id: "chr22_bam"], | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam", checkIfExists: true) | ||
]) | ||
// ch_chrgtf | ||
input[1] = Channel.of( | ||
[ | ||
[ id: "chr22_gtf" ], | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.gtf", checkIfExists: true) | ||
]) | ||
// ch_refflat | ||
input[2] = UCSC_GTFTOGENEPRED.out.refflat | ||
// ch_fasta | ||
input[3] = Channel.of( | ||
[ | ||
[ id: "test_ref" ], | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.fasta", checkIfExist: true) | ||
] ) | ||
// ch_fai | ||
input[4] = Channel.of( | ||
[ | ||
[ id: "test_ref" ], | ||
file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/modules/data/genomics/homo_sapiens/genome/genome.fasta.fai", checkIfExist: true) | ||
] ) | ||
// ch rRNA interval list | ||
input[5] = GATK4_BEDTOINTERVALLIST.out.interval_list | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert snapshot(file( workflow.out.versions[0] )).match('versions' ) }, | ||
{ assert snapshot(file( workflow.out.rnaseq_metrics[0][1] ).readLines()[4..-1]).md5().match('rnaseq_metrics' ) }, | ||
{ assert snapshot(file( workflow.out.duplicate_metrics[0][1] ).readLines()[4..-1]).md5().match('duplicate_metrics' ) }, | ||
{ assert snapshot(file( workflow.out.insertsize_metrics[0][1] ).readLines()[4..-1]).md5().match('insertsize_metrics') } | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"duplicate_metrics": { | ||
"content": "651d8a4702f9f9871e94afbce3e50e34", | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.10.2" | ||
}, | ||
"timestamp": "2024-12-04T19:29:09.711230835" | ||
}, | ||
"versions": { | ||
"content": [ | ||
"versions.yml:md5,3f13b395c67e317f74194b3b6c89f139" | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.10.2" | ||
}, | ||
"timestamp": "2024-12-04T19:29:09.686297468" | ||
}, | ||
"rnaseq_metrics": { | ||
"content": "84a348c3735ed2f6c47f346eeed661f4", | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.10.2" | ||
}, | ||
"timestamp": "2024-12-04T19:29:09.704632753" | ||
}, | ||
"insertsize_metrics": { | ||
"content": "160db81b19843c4d46fe74ac61f9f013", | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.10.2" | ||
}, | ||
"timestamp": "2024-12-04T19:29:09.717929716" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
process { | ||
withName: PICARD_COLLECTRNASEQMETRICS { | ||
ext.args = "--STRAND_SPECIFICITY SECOND_READ_TRANSCRIPTION_STRAND" | ||
} | ||
|
||
withName: GATK4_BEDTOINTERVALLIST { | ||
ext.args = "--KEEP_LENGTH_ZERO_INTERVALS true" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters