Skip to content

Commit

Permalink
Add tbi index as an output to lofreq callparallel (nf-core#6427)
Browse files Browse the repository at this point in the history
Add tbi as an output to lofreq callparallel

Co-authored-by: fmartinez <[email protected]>
  • Loading branch information
nevinwu and fmartinez authored Aug 28, 2024
1 parent 5a38b71 commit 9889e36
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
10 changes: 6 additions & 4 deletions modules/nf-core/lofreq/callparallel/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ process LOFREQ_CALLPARALLEL {
tuple val(meta3), path(fai)

output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
path "versions.yml" , emit: versions
tuple val(meta), path("*.vcf.gz") , emit: vcf
tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -33,8 +34,8 @@ process LOFREQ_CALLPARALLEL {
samtools_cram_convert += alignment_cram ? " samtools index ${alignment_out}\n" : ''

def samtools_cram_remove = ''
samtools_cram_remove += alignment_cram ? " rm ${alignment_out}\n" : ''
samtools_cram_remove += alignment_cram ? " rm ${alignment_out}.bai\n " : ''
samtools_cram_remove += alignment_cram ? " rm ${alignment_out}\n" : ''
samtools_cram_remove += alignment_cram ? " rm ${alignment_out}.bai\n " : ''
"""
$samtools_cram_convert
Expand All @@ -59,6 +60,7 @@ process LOFREQ_CALLPARALLEL {
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.vcf.gz
echo "" | gzip > ${prefix}.vcf.gz.tbi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
4 changes: 4 additions & 0 deletions modules/nf-core/lofreq/callparallel/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ output:
type: file
description: Predicted variants file
pattern: "*.{vcf}"
- tbi:
type: file
description: Index of vcf file
pattern: "*.{vcf.gz.tbi}"
authors:
- "@kaurravneet4123"
- "@bjohnnyd"
Expand Down
10 changes: 8 additions & 2 deletions modules/nf-core/lofreq/callparallel/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert snapshot(
process.out.versions,
process.out.tbi.collect { file(it[1]).getName() }
).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains('##INFO=<ID=CONSVAR,Number=0,Type=Flag,Description="Indicates that the variant is a consensus variant (as opposed to a low frequency variant).">') }
)
}
Expand Down Expand Up @@ -62,7 +65,10 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert snapshot(
process.out.versions,
process.out.tbi.collect { file(it[1]).getName() }
).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains('##INFO=<ID=CONSVAR,Number=0,Type=Flag,Description="Indicates that the variant is a consensus variant (as opposed to a low frequency variant).">') }
)
}
Expand Down
34 changes: 28 additions & 6 deletions modules/nf-core/lofreq/callparallel/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,24 @@
]
],
"1": [
[
{
"id": "test"
},
"test.vcf.gz.tbi:md5,1a60c330fb42841e8dcf3cd507a70bfc"
]
],
"2": [
"versions.yml:md5,56d45e0015add277b2689f071a4fe3e4"
],
"tbi": [
[
{
"id": "test"
},
"test.vcf.gz.tbi:md5,1a60c330fb42841e8dcf3cd507a70bfc"
]
],
"vcf": [
[
{
Expand All @@ -28,32 +44,38 @@
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
"nextflow": "23.04.0"
},
"timestamp": "2024-07-10T12:57:00.731035"
"timestamp": "2024-08-28T12:01:24.268196316"
},
"sarscov2 - bam": {
"content": [
[
"versions.yml:md5,56d45e0015add277b2689f071a4fe3e4"
],
[
"test.vcf.gz.tbi"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
"nextflow": "23.04.0"
},
"timestamp": "2024-07-10T12:59:23.105421"
"timestamp": "2024-08-28T12:28:18.229899904"
},
"sarscov2 - bam - bed": {
"content": [
[
"versions.yml:md5,56d45e0015add277b2689f071a4fe3e4"
],
[
"test.vcf.gz.tbi"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
"nextflow": "23.04.0"
},
"timestamp": "2024-07-10T12:59:28.355632"
"timestamp": "2024-08-28T12:28:35.27599355"
}
}

0 comments on commit 9889e36

Please sign in to comment.