Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions modules/nf-core/aardvark/merge/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::aardvark=0.10.5
66 changes: 66 additions & 0 deletions modules/nf-core/aardvark/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
process AARDVARK_MERGE {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/aardvark:0.10.5--h4349ce8_0':
'quay.io/biocontainers/aardvark:0.10.5--h4349ce8_0' }"

input:
tuple val(meta), path(vcfs), path(indexes)
tuple val(meta2), path(fasta)
tuple val(meta3), path(bed)

output:
tuple val(meta), path('*.summary.tsv') , emit: summary
tuple val(meta), path('*.passing.vcf.gz') , emit: passing_vcf
tuple val(meta), path('*.passing.vcf.gz.tbi') , emit: passing_vcf_index
tuple val(meta), path('*.regions.bed.gz') , emit: passing_regions
tuple val(meta), path('*.regions.bed.gz.tbi') , emit: passing_regions_index
tuple val(meta), path('*.failed_regions.bed.gz') , emit: failed_regions
tuple val(meta), path('*.failed_regions.bed.gz.tbi') , emit: failed_regions_index
tuple val(meta), path('*.json') , emit: runinfo
tuple val("${task.process}"), val('aardvark'), eval("aardvark merge --version 2>&1 | sed 's/aardvark-bio-merge //; s/-conda//'"), topic: versions, emit: versions_aardvark

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def inputs = vcfs.collect { file -> "--input-vcf ${file}" }.join(' ')

"""
aardvark merge \\
--threads $task.cpus \\
--reference $fasta \\
$inputs \\
--regions ${bed} \\
--output-vcfs $prefix \\
--output-debug $prefix \\
--output-summary ${prefix}.summary.tsv \\
$args

for f in ${prefix}/*; do
mv "\$f" "${prefix}.\${f##*/}"
done

"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo $args

echo "" | gzip > ${prefix}.passing.vcf.gz
echo "" | gzip > ${prefix}.regions.bed.gz
echo "" | gzip > ${prefix}.failed_regions.bed.gz
touch ${prefix}.passing.vcf.gz.tbi
touch ${prefix}.regions.bed.gz.tbi
touch ${prefix}.failed_regions.bed.gz.tbi
touch ${prefix}.summary.tsv
touch ${prefix}.cli_settings.json
"""
}
160 changes: 160 additions & 0 deletions modules/nf-core/aardvark/merge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "aardvark_merge"
description: A tool to evaluate and merge multiple variant calls into a consensus VCF.
keywords:
- variant calling
- vcf
- comparison
- consensus
- merging
tools:
- aardvark:
description: |
The aardvark merge command provides a method to merge variant calls. This functionality is helpful when multiple
variant callers or technologies are used for the same sample. Merging variant sets can be complex and Aardvark
simplifies this process by modeling the variants as haplotypes. This allows for different merge strategies for
resolving conflicting variant sets.
homepage: "https://github.com/PacificBiosciences/aardvark"
documentation: "https://github.com/PacificBiosciences/aardvark/blob/main/docs/methods.md#merge-strategies"
tool_dev_url: "https://github.com/PacificBiosciences/aardvark"
doi: "10.1101/2025.10.03.680257"
licence: ["MIT"]
identifier: biotools:aardvark

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- vcfs:
type: file
description: List of VCF files to be merged
pattern: "*.{vcf.gz}"
ontologies:
- edam: "http://edamontology.org/format_3016"
- indexes:
type: file
description: List of index files for the input VCF files
pattern: "*.{vcf.gz.tbi,vcf.gz.csi,tbi,csi}"
- - meta2:
type: map
description: Groovy Map containing reference fasta information
- fasta:
type: file
description: Reference genome fasta file
pattern: "*.{fasta,fa,fasta.gz,fa.gz}"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
- - meta3:
type: map
description: Groovy Map containing bed information
- bed:
type: file
description: Optional BED file containing genomic regions to restrict the merge operation
pattern: "*.{bed}"
ontologies:
- edam: "http://edamontology.org/format_3586"

output:
summary:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.summary.tsv":
type: file
description: Global summary statistics of the variant merge
pattern: "*.summary.tsv"
ontologies:
- edam: "http://edamontology.org/format_3475" # TSV
passing_vcf:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.passing.vcf.gz":
type: file
description: Merged VCF file containing passing variants
pattern: "*.passing.vcf.gz"
ontologies:
- edam: "http://edamontology.org/format_3016"
passing_vcf_index:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.passing.vcf.gz.tbi":
type: file
description: Index file for the merged passing VCF
pattern: "*.passing.vcf.gz.tbi"
passing_regions:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.regions.bed.gz":
type: file
description: BED file of regions containing passing variants
pattern: "*.regions.bed.gz"
ontologies:
- edam: "http://edamontology.org/format_3586"
passing_regions_index:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.regions.bed.gz.tbi":
type: file
description: Index file for the passing regions BED
pattern: "*.regions.bed.gz.tbi"
failed_regions:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.failed_regions.bed.gz":
type: file
description: BED file of regions that failed merging criteria
pattern: "*.failed_regions.bed.gz"
ontologies:
- edam: "http://edamontology.org/format_3586"
failed_regions_index:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.failed_regions.bed.gz.tbi":
type: file
description: Index file for the failed regions BED
pattern: "*.failed_regions.bed.gz.tbi"
runinfo:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.json":
type: file
description: JSON file containing parameter settings used during the run
pattern: "*.json"
ontologies:
- edam: http://edamontology.org/format_3464 # JSON
versions_aardvark:
- - "${task.process}":
type: string
description: The name of the process
- "aardvark":
type: string
description: The name of the tool
- "aardvark merge --version 2>&1 | sed 's/aardvark-bio-merge //; s/-conda//'":
type: eval
description: The expression to obtain the version of the tool

topics:
versions:
- - "${task.process}":
type: string
description: The name of the process
- "aardvark":
type: string
description: The name of the tool
- "aardvark merge --version 2>&1 | sed 's/aardvark-bio-merge //; s/-conda//'":
type: eval
description: The expression to obtain the version of the tool

authors:
- "@kubranarci"
maintainers:
- "@kubranarci"
98 changes: 98 additions & 0 deletions modules/nf-core/aardvark/merge/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "aardvark"
tag "aardvark/merge"

config "./nextflow.config"

test("homo_sapiens - vcf.gz") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true)
],
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi', checkIfExists: true)
]
]
input[1] = [
[ id:'fasta' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[2] = [
[id:'bed' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true)
]
"""
}
}

then {
assert process.success
assertAll(
{ assert snapshot(
path(process.out.passing_vcf[0][1]).vcf.summary,
Comment thread
kubranarci marked this conversation as resolved.
file(process.out.passing_vcf[0][1]).name,
file(process.out.passing_vcf_index[0][1]).name,
file(process.out.failed_regions[0][1]).name,
Comment thread
georgiakes marked this conversation as resolved.
process.out.passing_regions,
process.out.passing_regions_index,
process.out.failed_regions_index,
process.out.runinfo,
process.out.summary,
process.out.findAll { key, val -> key.startsWith('versions') }
).match()
}
)
}

}

test("homo_sapiens - vcf.gz - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true)
],
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz.tbi', checkIfExists: true)
]
]
input[1] = [
[ id:'fasta' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[2] = [
[id:'bed' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true)
]
"""
}
}

then {
assert process.success
assertAll(
{ assert snapshot(process.out).match() }
Comment thread
kubranarci marked this conversation as resolved.
)
}

}

}
Loading