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

MuTect2 Module #153

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ jobs:
tags: facets
- profile: "conda"
tags: mutect1
- profile: "conda"
tags: mutect2
- profile: "conda"
tags: phylowgs/createinput
- profile: "conda"
Expand Down
7 changes: 7 additions & 0 deletions modules/msk/mutect2/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:
- "YOUR-TOOL=HERE"
49 changes: 49 additions & 0 deletions modules/msk/mutect2/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process MUTECT2 {
Copy link
Collaborator

@buehlere buehlere Oct 28, 2024

Choose a reason for hiding this comment

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

I think you're missing the tag.yml and main.nf.test.snap files. You might want to double check some other parts of the nf-test. This might be why the testing and linting aren't running properly?

tag "$meta.id"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gatk4:4.5.0.0--py36hdfd78af_0':
'biocontainers/gatk4:4.5.0.0--py36hdfd78af_0' }"

input:
tuple val(meta), path(case_bam), path(control_bam), path(case_bai), path(control_bai)
tuple path(bed_file), path(fasta_file), path(fasta_index_file), path(fasta_dict_file)

output:
tuple val(meta), path("*.mutect2.vcf"), emit: mutect2_vcf

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

script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def case_sample_name = task.ext.prefix ?: "${meta.case_id}"
def control_sample_name = task.ext.prefix ?: "${meta.control_id}"
def bed_file = bed_file ? "--intervals ${bed_file}" : ''


"""
gatk "Mutect2" \\
Copy link
Collaborator

@johnoooh johnoooh Nov 4, 2024

Choose a reason for hiding this comment

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

Might be good to add in an arg here so we can add java options. In tempo we set the Xmx for example so it may be good to add a ${jvmarg} here or something. This is how it looks in our Tempo Module.

-R ${fasta_file} \\
-I ${case_bam} \\
-I ${control_bam} \\
-tumor ${case_sample_name} \\
-normal ${control_sample_name} \\
${args} \\
--output ${meta.id}.mutect2.vcf

"""

stub:
"""
touch ${meta.id}.mutect2.vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk "Mutect2": \$(gatk "Mutect2" --version | sed -e "s/gatk "Mutect2" v//g")
END_VERSIONS
"""
}
71 changes: 71 additions & 0 deletions modules/msk/mutect2/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "mutect2"

description:
This module wraps GATK 4.5.0 MuTect2 software, which generates VCF files
and standard output from case-control sample BAM files, BED file coordinates, and
a reference fasta.
keywords:
- vcf
- case-control
- bams
tools:
- "mutect2":
description:
"Generates MuTect2 VCF file and standard output for case-control
sample BAM files."
homepage: "https://gatk.broadinstitute.org/hc/en-us/articles/360037593851-Mutect2"

identifier: ""
input:
# Only when we have meta
- - meta:
type: map
description:
Groovy Map containing sample information e.g. `[ tumor_id:'tumor_sample',
normal_id:'normal_sample' ]`
- case_bam:
type: file
description: Case sample BAM file
pattern: "*.{bam}"
- control_bam:
type: file
description: Control sample BAM file
pattern: "*.{bam}"
- case_bai:
type: file
description: Case sample BAM index file
pattern: "*.{bai}"
- control_bai:
type: file
description: Control sample BAM index file
pattern: "*.{bai}"
- - bed_file:
type: file
description: Input BED file
pattern: "*.{bed}"
- fasta_file:
type: file
description: Input reference fasta file
pattern: "*.{fasta}"
- fasta_index_file:
type: list
description: Input reference fasta index file
pattern: "*.{fasta.fai}"
- fasta_dict_file:
type: file
description: Input reference fasta dictionary file
pattern: "*.{dict}"
output:
#Only when we have meta
- mutect2_vcf:
- meta:
type: map
description: Output meta map
- "*.mutect2.vcf":
type: file
description: Output MuTect2 generated VCF file
authors:
- "@rnaidu"
maintainers:
- "@rnaidu"
83 changes: 83 additions & 0 deletions modules/msk/mutect2/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

nextflow_process {

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

tag "modules"
tag "modules_msk"
tag "mutect2"


test("mutect2 - test - vcf") {

when {
process {
"""

input[0] = [
[id: 'test', case_id: 'tumor',control_id: 'normal'],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true)
]

input[1] = [
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true)
]


"""
}
}

then {
assertAll(
{ assert process.success }
)
}

}


test("mutect2 - vcf - stub") {

options "-stub"

when {
process {
"""

input[0] = [
[id: 'test', case_id: 'tumor',control_id: 'normal'],
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true)
]

input[1] = [
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true)
]

"""
}
}

then {
assertAll(
{ assert process.success }
)
}

}

}
2 changes: 2 additions & 0 deletions modules/msk/mutect2/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mutect2:
- "modules/msk/mutect2/**"
Loading