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 deepsomatic module scaffolding #6622

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
74 changes: 74 additions & 0 deletions modules/nf-core/deepsomatic/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
process DEEPSOMATIC {
tag "$meta.id"
label 'process_high'

container "docker.io/google/deepsomatic:1.7.0"

input:
tuple val(meta), path(input_normal), path(index_normal)
tuple val(meta2), path(input_tumor), path(index_tumor)
tuple val(meta3), path(intervals)
tuple val(meta4), path(fasta)
tuple val(meta5), path(fai)
tuple val(meta6), path(gzi)

output:
tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf
tuple val(meta), path("${prefix}.vcf.gz.tbi") , emit: vcf_tbi
tuple val(meta), path("${prefix}.g.vcf.gz") , emit: gvcf
tuple val(meta), path("${prefix}.g.vcf.gz.tbi"), emit: gvcf_tbi
path "versions.yml" , emit: versions

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

script:
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead."
}
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def regions = intervals ? "--regions=${intervals}" : ""
def VERSION = '1.7.0'

"""
run_deepsomatic \\
--ref=${fasta} \\
--reads_normal=${input_normal} \\
--reads_tumor=${input_tumor} \\
--output_vcf=${prefix}.vcf.gz \\
--output_gvcf=${prefix}.g.vcf.gz \\
--sample_name_tumor="tumor" \\
--sample_name_normal="normal" \\
${args} \\
${regions} \\
--intermediate_results_dir=tmp \\
--num_shards=${task.cpus}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
deepsomatic: $VERSION
END_VERSIONS
"""

stub:
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead."
}
prefix = task.ext.prefix ?: "${meta.id}"

def VERSION = '1.7.0'
"""
touch ${prefix}.vcf.gz
touch ${prefix}.vcf.gz.tbi
touch ${prefix}.g.vcf.gz
touch ${prefix}.g.vcf.gz.tbi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
deepsomatic: $VERSION
END_VERSIONS
"""
}
75 changes: 75 additions & 0 deletions modules/nf-core/deepsomatic/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "deepsomatic"
## TODO nf-core: Add a description of the module and list keywords
description: write your description here
keywords:
- variant calling
- machine learning
- neural network
tools:
- "deepsomatic":
## TODO nf-core: Add a description and other details for the software below
description: ""
homepage: "https://github.com/google/deepsomatic"
documentation: "https://github.com/google/deepsomatic"
tool_dev_url: "https://github.com/google/deepsomatic"
doi: "10.1101/2024.08.16.608331"
licence: ["BSD-3-clause"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- input_normal:
type: file
description: BAM/CRAM file
pattern: "*.bam/cram"
- index_normal:
type: file
description: Index of BAM/CRAM file
pattern: "*.bai/crai"
- input_tumor:
type: file
description: BAM/CRAM file
pattern: "*.bam/cram"
- index_tumor:
type: file
description: Index of BAM/CRAM file
pattern: "*.bai/crai"
- intervals:
type: file
description: Interval file for targeted regions
pattern: "*.bed"

## TODO nf-core: Delete / customise this example input
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

## TODO nf-core: Add a description of all of the variables used as output
output:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
## TODO nf-core: Delete / customise this example output
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"

authors:
- "@vaxyzek"
maintainers:
- "@vaxyzek"
73 changes: 73 additions & 0 deletions modules/nf-core/deepsomatic/tests/main.nf.test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping we should be able to use the same data that is used on the mutect2 tests:
https://github.com/nf-core/modules/blob/master/modules/nf-core/gatk4/mutect2/tests/main.nf.test

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test deepsomatic
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "deepsomatic"

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used
test("tumor_normal_pair") {

// TODO nf-core: If you are created a test for a chained module
// (the module requires running more than one process to generate the required output)
// add the 'setup' method here.
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).

when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:

input[0] = [
[ id:'normal' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true),
]
input[1] = [
[ id:'tumor'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true),
]
input[2] = [
[ id:'intervals' ],
[]
]
input[3] = [
[ id:'genome' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[4] = [
[ id:'genome' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
]
input[5] = [
[ id: 'gzi' ],
[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{
assert snapshot(
process.out.vcf.collect { file(it[1]).getName() },
process.out.tbi.collect { file(it[1]).getName() },
process.out.stats,
process.out.f1r2,
process.out.versions,
).match()
}
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/deepsomatic/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"sarscov2 - bam - stub": {
"content": [
{
"0": [

],
"1": [

],
"bam": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.3"
},
"timestamp": "2024-08-21T17:53:00.524660985"
},
"sarscov2 - bam": {
"content": [
{
"0": [

],
"1": [

],
"bam": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.3"
},
"timestamp": "2024-08-21T17:52:54.704070521"
},
"tumor_normal_pair": {
"content": [
[

],
[

],
null,
null,
[

]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.3"
},
"timestamp": "2024-09-25T20:48:33.535517722"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/deepsomatic/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deepsomatic:
- "modules/nf-core/deepsomatic/**"