Skip to content

Commit

Permalink
module: deepvariant (#572)
Browse files Browse the repository at this point in the history
* Add stubs for deepvariant [ci skip]

* Update the stubs for deepvariant [ci skip]

* functional with google docker image

* cleanup

* consume docker container within singularity executor

* update the meta.yml file and ask for review

* tweak the input channel shape and test data

* tweak input data [ci skip]

* update for the new syntax

* remove the functions and rename meta vars

* Update the arguments mechanism

* update chr, region and checksum

Co-authored-by: Gregor Sturm <mail@gregor-sturm.de>
Co-authored-by: Maxime U. Garcia <max.u.garcia@gmail.com>
Co-authored-by: FriederikeHanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
  • Loading branch information
4 people authored Jan 17, 2022
1 parent c9587d7 commit 6243c37
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 0 deletions.
43 changes: 43 additions & 0 deletions modules/deepvariant/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
process DEEPVARIANT {
tag "$meta.id"
label 'process_medium'


if (params.enable_conda) {
exit 1, "Conda environments cannot be used when using the DeepVariant tool. Please use docker or singularity containers."
}

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'google/deepvariant:1.2.0' :
'google/deepvariant:1.2.0' }"

input:
tuple val(meta), path(bam), path(bai)
path(fasta)
path(fai)

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

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

"""
/opt/deepvariant/bin/run_deepvariant \\
--ref=${fasta} \\
--reads=${bam} \\
--output_vcf=${prefix}.vcf.gz \\
--output_gvcf=${prefix}.g.vcf.gz \\
${args} \\
--num_shards=${task.cpus}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
deepvariant: \$(echo \$(/opt/deepvariant/bin/run_deepvariant --version) | sed 's/^.*version //; s/ .*\$//' )
END_VERSIONS
"""

}
58 changes: 58 additions & 0 deletions modules/deepvariant/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: deepvariant
description: DeepVariant is an analysis pipeline that uses a deep neural network to call genetic variants from next-generation DNA sequencing data
keywords:
- variant calling
- machine learning
tools:
- deepvariant:
description: DeepVariant is an analysis pipeline that uses a deep neural network to call genetic variants from next-generation DNA sequencing data
homepage: https://github.com/google/deepvariant
documentation: https://github.com/google/deepvariant
tool_dev_url: https://github.com/google/deepvariant
doi: "https://doi.org/10.1038/nbt.4235"
licence: ['BSD-3-clause']

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- bai:
type: file
description: Index of BAM file
pattern: "*.bai"
- fasta:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fai:
type: file
description: Index of reference fasta file
pattern: "*.fai"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: Compressed VCF file
pattern: "*.vcf.gz"
- gvcf:
type: file
description: Compressed GVCF file
pattern: "*.g.vcf.gz"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"

authors:
- "@abhi18av"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ deeptools/plotprofile:
- modules/deeptools/plotprofile/**
- tests/modules/deeptools/plotprofile/**

deepvariant:
- modules/deepvariant/**
- tests/modules/deepvariant/**

delly/call:
- modules/delly/call/**
- tests/modules/delly/call/**
Expand Down
18 changes: 18 additions & 0 deletions tests/modules/deepvariant/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { DEEPVARIANT } from '../../../modules/deepvariant/main.nf'

workflow test_deepvariant {

bam_tuple_ch = Channel.of([[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)])

fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)

fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)

DEEPVARIANT ( bam_tuple_ch, fasta, fai)
}
10 changes: 10 additions & 0 deletions tests/modules/deepvariant/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName: DEEPVARIANT {
ext.args = ' --regions=\"chr22:0-40001\" --model_type=WGS '
ext.prefix = { "${meta.id}_out" }
}

}
9 changes: 9 additions & 0 deletions tests/modules/deepvariant/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: deepvariant
command: nextflow run ./tests/modules/deepvariant -entry test_deepvariant -c tests/config/nextflow.config
tags:
- deepvariant
files:
- path: output/deepvariant/test_out.vcf.gz
md5sum: 66d86be7a9bafe1f5c6304ebee18ee20
- path: output/deepvariant/test_out.g.vcf.gz
md5sum: 4ca868f0a4fdb17a280c3ed083d228e0

0 comments on commit 6243c37

Please sign in to comment.