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 stubs gatk4 #6672

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 13 additions & 0 deletions modules/nf-core/gatk4/applybqsr/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,17 @@ process GATK4_APPLYBQSR {
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def input_extension = input.getExtension()
def output_extension = input_extension == 'bam' ? 'bam' : 'cram'
"""
touch ${prefix}.${output_extension}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}
101 changes: 55 additions & 46 deletions modules/nf-core/gatk4/applybqsr/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,56 +16,65 @@ tools:
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
doi: 10.1158/1538-7445.AM2017-3590
licence: ["Apache-2.0"]
identifier: ""
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input:
type: file
description: BAM/CRAM file from alignment
pattern: "*.{bam,cram}"
- input_index:
type: file
description: BAI/CRAI file from alignment
pattern: "*.{bai,crai}"
- bqsr_table:
type: file
description: Recalibration table from gatk4_baserecalibrator
- intervals:
type: file
description: Bed file with the genomic regions included in the library (optional)
- fasta:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fai:
type: file
description: Index of reference fasta file
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input:
type: file
description: BAM/CRAM file from alignment
pattern: "*.{bam,cram}"
- input_index:
type: file
description: BAI/CRAI file from alignment
pattern: "*.{bai,crai}"
- bqsr_table:
type: file
description: Recalibration table from gatk4_baserecalibrator
- intervals:
type: file
description: Bed file with the genomic regions included in the library (optional)
- - fasta:
type: file
description: The reference fasta file
pattern: "*.fasta"
- - fai:
type: file
description: Index of reference fasta file
pattern: "*.fasta.fai"
- - dict:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: Recalibrated BAM file
pattern: "*.{bam}"
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.bam":
type: file
description: Recalibrated BAM file
pattern: "*.{bam}"
- cram:
type: file
description: Recalibrated CRAM file
pattern: "*.{cram}"
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.cram":
type: file
description: Recalibrated CRAM file
pattern: "*.{cram}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@yocra3"
- "@FriederikeHanssen"
Expand Down
59 changes: 59 additions & 0 deletions modules/nf-core/gatk4/applybqsr/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,63 @@ nextflow_process {
}
}

test("sarscov2 - cram - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test.baserecalibrator.table', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true)
"""
}
}

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

test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/gatk/test.baserecalibrator.table', checkIfExists: true),
[]
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
input[2] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true)
input[3] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.dict', checkIfExists: true)
"""
}
}

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

}

}
78 changes: 78 additions & 0 deletions modules/nf-core/gatk4/applybqsr/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
{
"sarscov2 - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [

],
"2": [
"versions.yml:md5,bb2a060a0280c812fba3c74b1707b350"
],
"bam": [
[
{
"id": "test"
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cram": [

],
"versions": [
"versions.yml:md5,bb2a060a0280c812fba3c74b1707b350"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-20T10:25:00.314573"
},
"sarscov2 - bam - intervals": {
"content": [
{
Expand Down Expand Up @@ -60,6 +99,45 @@
},
"timestamp": "2023-12-09T03:10:46.70859771"
},
"sarscov2 - cram - stub": {
"content": [
{
"0": [

],
"1": [
[
{
"id": "test"
},
"test.cram:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,bb2a060a0280c812fba3c74b1707b350"
],
"bam": [

],
"cram": [
[
{
"id": "test"
},
"test.cram:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,bb2a060a0280c812fba3c74b1707b350"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-20T10:24:52.761169"
},
"sarscov2 - bam": {
"content": [
{
Expand Down
18 changes: 18 additions & 0 deletions modules/nf-core/gatk4/collectsvevidence/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,22 @@ process GATK4_COLLECTSVEVIDENCE {
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def sd_vcf = site_depth_vcf ? "echo '' | gzip > ${prefix}.sd.txt.gz" : ""
def sd_vcf_tbi = site_depth_vcf_tbi ? "touch ${prefix}.sd.txt.gz.tbi" : ""
"""
echo "" | gzip > ${prefix}.sr.txt.gz
touch ${prefix}.sr.txt.gz.tbi
echo "" | gzip > ${prefix}.pe.txt.gz
touch ${prefix}.pe.txt.gz.tbi
${sd_vcf}
${sd_vcf_tbi}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}
Loading
Loading