-
Notifications
You must be signed in to change notification settings - Fork 950
Add module picard/collectvariantcallingmetrics #9502
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
Merged
georgiakes
merged 10 commits into
nf-core:master
from
georgiakes:add-picard-collectvariantcallingmetrics
Dec 10, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
986369b
Add module picard/collectvariantcallingmetrics
georgiakes eafcab0
Run prettier
georgiakes e7bd93b
Fix format
georgiakes ee4524f
Make one input tuple
georgiakes d6cd8f4
Change test input structure
georgiakes 3f81b65
Add md5 checksum
georgiakes dbe95ac
Update snapshot
georgiakes 8a9291b
Update meta.yml
georgiakes 922e101
Support multithreading
georgiakes aa5ef76
Remove TODO
georgiakes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
modules/nf-core/picard/collectvariantcallingmetrics/environment.yml
This file contains hidden or 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,7 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - "bioconda::picard=3.4.0" |
64 changes: 64 additions & 0 deletions
64
modules/nf-core/picard/collectvariantcallingmetrics/main.nf
This file contains hidden or 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,64 @@ | ||
| process PICARD_COLLECTVARIANTCALLINGMETRICS { | ||
| tag "${meta.id}" | ||
| label 'process_low' | ||
|
|
||
| conda "${moduleDir}/environment.yml" | ||
| container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container | ||
| ? 'https://depot.galaxyproject.org/singularity/picard:3.4.0--hdfd78af_0' | ||
| : 'biocontainers/picard:3.4.0--hdfd78af_0'}" | ||
|
|
||
| input: | ||
| tuple val(meta), path(vcf), path(index), path(intervals_file), path(fasta), path(dict), path(dbsnp), path(dbsnp_index) | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.variant_calling_detail_metrics"), emit: detail_metrics | ||
| tuple val(meta), path("*.variant_calling_summary_metrics"), emit: summary_metrics | ||
| path "versions.yml", emit: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| def reference = fasta ? "--REFERENCE_SEQUENCE ${fasta}" : "" | ||
| def intervals = intervals_file ? "--TARGET_INTERVALS ${intervals_file}" : "" | ||
|
|
||
| def avail_mem = 3072 | ||
| if (!task.memory) { | ||
| log.info('[Picard CollectVariantCallingMetrics] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.') | ||
| } | ||
| else { | ||
| avail_mem = (task.memory.mega * 0.8).intValue() | ||
| } | ||
| """ | ||
| picard \\ | ||
| -Xmx${avail_mem}M \\ | ||
| CollectVariantCallingMetrics \\ | ||
| ${args} \\ | ||
| --THREAD_COUNT ${task.cpus} \\ | ||
| --INPUT ${vcf} \\ | ||
| --OUTPUT ${prefix} \\ | ||
| --DBSNP ${dbsnp} \\ | ||
| ${reference} \\ | ||
| --TMP_DIR . \\ | ||
| ${intervals} \\ | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| picard: \$(echo \$(picard CollectVariantCallingMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) | ||
| END_VERSIONS | ||
| """ | ||
|
|
||
| stub: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| touch ${prefix}.variant_calling_detail_metrics | ||
| touch ${prefix}.variant_calling_summary_metrics | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| picard: \$(echo \$(picard CollectVariantCallingMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) | ||
| END_VERSIONS | ||
| """ | ||
| } |
88 changes: 88 additions & 0 deletions
88
modules/nf-core/picard/collectvariantcallingmetrics/meta.yml
This file contains hidden or 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,88 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json | ||
| name: "picard_collectvariantcallingmetrics" | ||
| description: Collects per-sample and aggregate (spanning all samples) metrics from the provided VCF file | ||
| keywords: | ||
| - vcf | ||
| - metrics | ||
| - variant calling | ||
| - statistics | ||
| tools: | ||
| - "picard": | ||
| description: "A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS) data and formats such as SAM/BAM/CRAM and VCF." | ||
| homepage: "https://broadinstitute.github.io/picard/" | ||
| documentation: "https://broadinstitute.github.io/picard/" | ||
| tool_dev_url: "https://github.com/broadinstitute/picard" | ||
| licence: ["MIT"] | ||
| identifier: biotools:picard_tools | ||
|
|
||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - vcf: | ||
| type: file | ||
| description: Input VCF file for analysis | ||
| pattern: "*.{vcf,vcf.gz}" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_3016" # VCF | ||
| - index: | ||
| type: file | ||
| description: Index file for the input VCF file | ||
| pattern: "*.{idx,tbi}" | ||
| - intervals_file: | ||
| type: file | ||
| description: Optional BED file specifying target intervals | ||
| pattern: "*.{bed,bed.gz,intervals_list}" | ||
| - fasta: | ||
| type: file | ||
| description: Reference sequence file | ||
| pattern: "*.{fasta,fa,fasta.gz,fa.gz}" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_1929" # FASTA | ||
| - dict: | ||
| type: file | ||
| description: Reference sequence dictionary file | ||
| pattern: "*.{dict}" | ||
| - dbsnp: | ||
| type: file | ||
| description: Reference dbSNP file in dbSNP or VCF format | ||
| pattern: "*.{vcf,vcf.gz}" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_3016" # VCF | ||
| - dbsnp_index: | ||
| type: file | ||
| description: Reference dbSNP file in dbSNP or VCF format | ||
| pattern: "*.{idx,tbi}" | ||
| output: | ||
| detail_metrics: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.variant_calling_detail_metrics": | ||
| type: file | ||
| description: Detailed variant calling metrics file | ||
| pattern: "*.variant_calling_detail_metrics" | ||
| summary_metrics: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "*.variant_calling_summary_metrics": | ||
| type: file | ||
| description: Summary variant calling metrics file | ||
| pattern: "*.variant_calling_summary_metrics" | ||
| versions: | ||
| - versions.yml: | ||
| type: file | ||
| description: File containing software versions | ||
| pattern: "versions.yml" | ||
|
|
||
| authors: | ||
| - "@georgiakes" | ||
| maintainers: | ||
| - "@georgiakes" |
130 changes: 130 additions & 0 deletions
130
modules/nf-core/picard/collectvariantcallingmetrics/tests/main.nf.test
This file contains hidden or 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,130 @@ | ||
| nextflow_process { | ||
|
|
||
| name "Test Process PICARD_COLLECTVARIANTCALLINGMETRICS" | ||
| script "../main.nf" | ||
| process "PICARD_COLLECTVARIANTCALLINGMETRICS" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "picard" | ||
| tag "picard/collectvariantcallingmetrics" | ||
|
|
||
| test("homo_sapiens - vcf_gz") { | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), | ||
| [], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot( | ||
| path(process.out.detail_metrics[0][1]).readLines()[5..7].join('\n').md5(), | ||
| path(process.out.summary_metrics[0][1]).readLines()[5..7].join('\n').md5(), | ||
| process.out.versions | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("homo_sapiens - vcf_gz - stub") { | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), | ||
| [], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
| } | ||
| test("homo_sapiens - vcf_gz - intervals"){ | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.interval_list',checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot( | ||
| path(process.out.detail_metrics[0][1]).readLines()[5..7].join('\n').md5(), | ||
| path(process.out.summary_metrics[0][1]).readLines()[5..7].join('\n').md5(), | ||
| process.out.versions | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("homo_sapiens - vcf_gz - intervals - stub"){ | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test' ], | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.interval_list', checkIfExists: true ), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true) | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.