mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
Add Manta/somatic module + (fix tiny strelka params problem, i know bad practice :( ) (#912)
* remove params statement * add manta/somatic module * fix strelka target bed thing * removing checksums should make this pass * Update modules/manta/somatic/main.nf Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com> * fix indentation Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
This commit is contained in:
parent
b552958341
commit
754db250a0
10 changed files with 326 additions and 28 deletions
78
modules/manta/somatic/functions.nf
Normal file
78
modules/manta/somatic/functions.nf
Normal file
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// Extract name of module from process name using $task.process
|
||||
//
|
||||
def getProcessName(task_process) {
|
||||
return task_process.tokenize(':')[-1]
|
||||
}
|
||||
|
||||
//
|
||||
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||
//
|
||||
def initOptions(Map args) {
|
||||
def Map options = [:]
|
||||
options.args = args.args ?: ''
|
||||
options.args2 = args.args2 ?: ''
|
||||
options.args3 = args.args3 ?: ''
|
||||
options.publish_by_meta = args.publish_by_meta ?: []
|
||||
options.publish_dir = args.publish_dir ?: ''
|
||||
options.publish_files = args.publish_files
|
||||
options.suffix = args.suffix ?: ''
|
||||
return options
|
||||
}
|
||||
|
||||
//
|
||||
// Tidy up and join elements of a list to return a path string
|
||||
//
|
||||
def getPathFromList(path_list) {
|
||||
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||
return paths.join('/')
|
||||
}
|
||||
|
||||
//
|
||||
// Function to save/publish module results
|
||||
//
|
||||
def saveFiles(Map args) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
|
||||
// Do not publish versions.yml unless running from pytest workflow
|
||||
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||
return null
|
||||
}
|
||||
if (ioptions.publish_by_meta) {
|
||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||
for (key in key_list) {
|
||||
if (args.meta && key instanceof String) {
|
||||
def path = key
|
||||
if (args.meta.containsKey(key)) {
|
||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
||||
}
|
||||
path = path instanceof String ? path : ''
|
||||
path_list.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ioptions.publish_files instanceof Map) {
|
||||
for (ext in ioptions.publish_files) {
|
||||
if (args.filename.endsWith(ext.key)) {
|
||||
def ext_list = path_list.collect()
|
||||
ext_list.add(ext.value)
|
||||
return "${getPathFromList(ext_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
} else if (ioptions.publish_files == null) {
|
||||
return "${getPathFromList(path_list)}/$args.filename"
|
||||
}
|
||||
}
|
67
modules/manta/somatic/main.nf
Normal file
67
modules/manta/somatic/main.nf
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process MANTA_SOMATIC {
|
||||
tag "$meta.id"
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::manta=1.6.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/manta:1.6.0--h9ee0642_1"
|
||||
} else {
|
||||
container "quay.io/biocontainers/manta:1.6.0--h9ee0642_1"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(cram_normal), path(crai_normal), path(cram_tumor), path(crai_tumor)
|
||||
path fasta
|
||||
path fai
|
||||
path target_bed
|
||||
path target_bed_tbi
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.candidate_small_indels.vcf.gz") , emit: candidate_small_indels_vcf
|
||||
tuple val(meta), path("*.candidate_small_indels.vcf.gz.tbi") , emit: candidate_small_indels_vcf_tbi
|
||||
tuple val(meta), path("*.candidate_sv.vcf.gz") , emit: candidate_sv_vcf
|
||||
tuple val(meta), path("*.candidate_sv.vcf.gz.tbi") , emit: candidate_sv_vcf_tbi
|
||||
tuple val(meta), path("*.diploid_sv.vcf.gz") , emit: diploid_sv_vcf
|
||||
tuple val(meta), path("*.diploid_sv.vcf.gz.tbi") , emit: diploid_sv_vcf_tbi
|
||||
tuple val(meta), path("*.somatic_sv.vcf.gz") , emit: somatic_sv_vcf
|
||||
tuple val(meta), path("*.somatic_sv.vcf.gz.tbi") , emit: somatic_sv_vcf_tbi
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def options_manta = target_bed ? "--exome --callRegions $target_bed" : ""
|
||||
|
||||
"""
|
||||
configManta.py \
|
||||
--tumorBam $cram_tumor \
|
||||
--normalBam $cram_normal \
|
||||
--reference $fasta \
|
||||
$options_manta \
|
||||
--runDir manta
|
||||
|
||||
python manta/runWorkflow.py -m local -j $task.cpus
|
||||
|
||||
mv manta/results/variants/candidateSmallIndels.vcf.gz ${prefix}.candidate_small_indels.vcf.gz
|
||||
mv manta/results/variants/candidateSmallIndels.vcf.gz.tbi ${prefix}.candidate_small_indels.vcf.gz.tbi
|
||||
mv manta/results/variants/candidateSV.vcf.gz ${prefix}.candidate_sv.vcf.gz
|
||||
mv manta/results/variants/candidateSV.vcf.gz.tbi ${prefix}.candidate_sv.vcf.gz.tbi
|
||||
mv manta/results/variants/diploidSV.vcf.gz ${prefix}.diploid_sv.vcf.gz
|
||||
mv manta/results/variants/diploidSV.vcf.gz.tbi ${prefix}.diploid_sv.vcf.gz.tbi
|
||||
mv manta/results/variants/somaticSV.vcf.gz ${prefix}.somatic_sv.vcf.gz
|
||||
mv manta/results/variants/somaticSV.vcf.gz.tbi ${prefix}.somatic_sv.vcf.gz.tbi
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
${getProcessName(task.process)}:
|
||||
${getSoftwareName(task.process)}: \$( configManta.py --version )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
103
modules/manta/somatic/meta.yml
Normal file
103
modules/manta/somatic/meta.yml
Normal file
|
@ -0,0 +1,103 @@
|
|||
name: manta_somatic
|
||||
description: Manta calls structural variants (SVs) and indels from mapped paired-end sequencing reads. It is optimized for analysis of germline variation in small sets of individuals and somatic variation in tumor/normal sample pairs.
|
||||
keywords:
|
||||
- somatic
|
||||
- wgs
|
||||
- wxs
|
||||
- panel
|
||||
- vcf
|
||||
- structural variants
|
||||
- small indels
|
||||
tools:
|
||||
- manta:
|
||||
description: Structural variant and indel caller for mapped sequencing data
|
||||
homepage: https://github.com/Illumina/manta
|
||||
documentation: https://github.com/Illumina/manta/blob/v1.6.0/docs/userGuide/README.md
|
||||
tool_dev_url: https://github.com/Illumina/manta
|
||||
doi: "10.1093/bioinformatics/btv710"
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- cram_normal:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- crai_normal:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM index file
|
||||
pattern: "*.{bai,crai,sai}"
|
||||
- cram_tumor:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- crai_tumor:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM index file
|
||||
pattern: "*.{bai,crai,sai}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: Genome reference FASTA file
|
||||
pattern: "*.{fa,fasta}"
|
||||
- fai:
|
||||
type: file
|
||||
description: Genome reference FASTA index file
|
||||
pattern: "*.{fa.fai,fasta.fai}"
|
||||
- target_bed:
|
||||
type: file
|
||||
description: BED file containing target regions for variant calling
|
||||
pattern: "*.{bed}"
|
||||
- target_bed_tbi:
|
||||
type: file
|
||||
description: Index for BED file containing target regions for variant calling
|
||||
pattern: "*.{bed.tbi}"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- candidate_small_indels_vcf:
|
||||
type: file
|
||||
description: Gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz}"
|
||||
- candidate_small_indels_vcf_tbi:
|
||||
type: file
|
||||
description: Index for gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz.tbi}"
|
||||
- candidate_sv_vcf:
|
||||
type: file
|
||||
description: Gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz}"
|
||||
- candidate_sv_vcf_tbi:
|
||||
type: file
|
||||
description: Index for gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz.tbi}"
|
||||
- diploid_sv_vcf:
|
||||
type: file
|
||||
description: Gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz}"
|
||||
- diploid_sv_vcf_tbi:
|
||||
type: file
|
||||
description: Index for gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz.tbi}"
|
||||
- somatic_sv_vcf:
|
||||
type: file
|
||||
description: Gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz}"
|
||||
- somatic_sv_vcf_tbi:
|
||||
type: file
|
||||
description: Index for gzipped VCF file containing variants
|
||||
pattern: "*.{vcf.gz.tbi}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@FriederikeHanssen"
|
|
@ -23,17 +23,19 @@ process STRELKA_GERMLINE {
|
|||
path fasta
|
||||
path fai
|
||||
path target_bed
|
||||
path target_bed_tbi
|
||||
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*variants.vcf.gz") , emit: vcf
|
||||
tuple val(meta), path("*variants.vcf.gz.tbi"), emit: vcf_tbi
|
||||
tuple val(meta), path("*genome.vcf.gz") , emit: genome_vcf
|
||||
tuple val(meta), path("*genome.vcf.gz.tbi") , emit: genome_vcf_tbi
|
||||
path "versions.yml" , emit: versions
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def regions = params.target_bed ? "--exome --callRegions ${target_bed}" : ""
|
||||
def regions = target_bed ? "--exome --callRegions ${target_bed}" : ""
|
||||
"""
|
||||
configureStrelkaGermlineWorkflow.py \\
|
||||
--bam $bam \\
|
||||
|
@ -50,7 +52,7 @@ process STRELKA_GERMLINE {
|
|||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
${getProcessName(task.process)}:
|
||||
${getSoftwareName(task.process)}: \$( configureStrelkaGermlineWorkflow.py --version )
|
||||
${getSoftwareName(task.process)}: \$( configureStrelkaSomaticWorkflow.py --version )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ process STRELKA_SOMATIC {
|
|||
|
||||
script:
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def options_strelka = params.target_bed ? "--exome --callRegions ${target_bed}" : ""
|
||||
def options_strelka = target_bed ? "--exome --callRegions ${target_bed}" : ""
|
||||
"""
|
||||
configureStrelkaSomaticWorkflow.py \\
|
||||
--tumor $cram_tumor \\
|
||||
|
|
|
@ -678,6 +678,10 @@ maltextract:
|
|||
- modules/maltextract/**
|
||||
- tests/modules/maltextract/**
|
||||
|
||||
manta/somatic:
|
||||
- modules/manta/somatic/**
|
||||
- tests/modules/manta/somatic/**
|
||||
|
||||
mash/sketch:
|
||||
- modules/mash/sketch/**
|
||||
- tests/modules/mash/sketch/**
|
||||
|
|
23
tests/modules/manta/somatic/main.nf
Normal file
23
tests/modules/manta/somatic/main.nf
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { MANTA_SOMATIC } from '../../../../modules/manta/somatic/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_manta_somatic {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram_crai'], 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)
|
||||
bed = file(params.test_data['homo_sapiens']['genome']['genome_bed_gz'], checkIfExists: true)
|
||||
bed_tbi = file(params.test_data['homo_sapiens']['genome']['genome_bed_gz_tbi'], checkIfExists: true)
|
||||
|
||||
MANTA_SOMATIC ( input, fasta, fai, bed, bed_tbi )
|
||||
}
|
18
tests/modules/manta/somatic/test.yml
Normal file
18
tests/modules/manta/somatic/test.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
- name: manta somatic test_manta_somatic
|
||||
command: nextflow run tests/modules/manta/somatic -entry test_manta_somatic -c tests/config/nextflow.config
|
||||
tags:
|
||||
- manta/somatic
|
||||
- manta
|
||||
files:
|
||||
- path: output/manta/test.candidate_small_indels.vcf.gz
|
||||
- path: output/manta/test.candidate_small_indels.vcf.gz.tbi
|
||||
md5sum: 4cb176febbc8c26d717a6c6e67b9c905
|
||||
- path: output/manta/test.candidate_sv.vcf.gz
|
||||
- path: output/manta/test.candidate_sv.vcf.gz.tbi
|
||||
md5sum: 4cb176febbc8c26d717a6c6e67b9c905
|
||||
- path: output/manta/test.diploid_sv.vcf.gz
|
||||
- path: output/manta/test.diploid_sv.vcf.gz.tbi
|
||||
md5sum: 4cb176febbc8c26d717a6c6e67b9c905
|
||||
- path: output/manta/test.somatic_sv.vcf.gz
|
||||
- path: output/manta/test.somatic_sv.vcf.gz.tbi
|
||||
md5sum: 4cb176febbc8c26d717a6c6e67b9c905
|
|
@ -5,30 +5,32 @@ nextflow.enable.dsl = 2
|
|||
include { STRELKA_GERMLINE } from '../../../../modules/strelka/germline/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_strelka_germline {
|
||||
input = [
|
||||
input = [
|
||||
[ id:'test'], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true),
|
||||
]
|
||||
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
|
||||
targets = []
|
||||
|
||||
STRELKA_GERMLINE ( input, fasta, fai, targets )
|
||||
|
||||
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)
|
||||
target_bed = []
|
||||
target_bed_tbi = []
|
||||
|
||||
STRELKA_GERMLINE ( input, fasta, fai, target_bed, target_bed_tbi )
|
||||
}
|
||||
|
||||
workflow test_strelka_germline_target_bed {
|
||||
input = [
|
||||
input = [
|
||||
[ id:'test'], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
|
||||
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true),
|
||||
]
|
||||
|
||||
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
|
||||
targets = file(params.test_data['sarscov2']['genome']['test_bed'], 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)
|
||||
target_bed = file(params.test_data['homo_sapiens']['genome']['genome_bed_gz'], checkIfExists: true)
|
||||
target_bed_tbi = file(params.test_data['homo_sapiens']['genome']['genome_bed_gz_tbi'], checkIfExists: true)
|
||||
|
||||
STRELKA_GERMLINE ( input, fasta, fai, targets )
|
||||
STRELKA_GERMLINE ( input, fasta, fai, target_bed, target_bed_tbi )
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
- name: strelka germline
|
||||
command: nextflow run ./tests/modules/strelka/germline -entry test_strelka_germline -c tests/config/nextflow.config
|
||||
- name: strelka germline test_strelka_germline
|
||||
command: nextflow run tests/modules/strelka/germline -entry test_strelka_germline -c tests/config/nextflow.config
|
||||
tags:
|
||||
- strelka
|
||||
- strelka/germline
|
||||
files:
|
||||
- path: output/strelka/test.variants.vcf.gz
|
||||
- path: output/strelka/test.variants.vcf.gz.tbi
|
||||
- path: output/strelka/test.genome.vcf.gz
|
||||
- path: output/strelka/test.genome.vcf.gz.tbi
|
||||
- name: strelka germline target bed
|
||||
command: nextflow run ./tests/modules/strelka/germline -entry test_strelka_germline_target_bed -c tests/config/nextflow.config
|
||||
- path: output/strelka/test.variants.vcf.gz
|
||||
- path: output/strelka/test.variants.vcf.gz.tbi
|
||||
|
||||
- name: strelka germline test_strelka_germline_target_bed
|
||||
command: nextflow run tests/modules/strelka/germline -entry test_strelka_germline_target_bed -c tests/config/nextflow.config
|
||||
tags:
|
||||
- strelka
|
||||
- strelka/germline
|
||||
files:
|
||||
- path: output/strelka/test.variants.vcf.gz
|
||||
- path: output/strelka/test.variants.vcf.gz.tbi
|
||||
- path: output/strelka/test.genome.vcf.gz
|
||||
- path: output/strelka/test.genome.vcf.gz.tbi
|
||||
- path: output/strelka/test.variants.vcf.gz
|
||||
- path: output/strelka/test.variants.vcf.gz.tbi
|
||||
|
|
Loading…
Reference in a new issue