adding new manta/germline + manta/tumoronly modules (#906)

* feat: all manta/single to modules

* fix module name

* fix module name

* fix: changes from review comments

* fix: test data
This commit is contained in:
Maxime U. Garcia 2021-10-27 18:24:48 +02:00 committed by GitHub
parent 257078bb39
commit 80d8e87fa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 593 additions and 0 deletions

View 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"
}
}

View file

@ -0,0 +1,68 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process MANTA_GERMLINE {
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), path(crai)
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
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 \
--bam $cram \
--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
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( configManta.py --version )
END_VERSIONS
"""
}

View file

@ -0,0 +1,87 @@
name: manta_germline
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:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- crai:
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}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@maxulysse"

View 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"
}
}

View file

@ -0,0 +1,68 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process MANTA_TUMORONLY {
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), path(crai)
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("*tumor_sv.vcf.gz") , emit: tumor_sv_vcf
tuple val(meta), path("*tumor_sv.vcf.gz.tbi") , emit: tumor_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 \
--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/tumorSV.vcf.gz \
${prefix}.tumor_sv.vcf.gz
mv manta/results/variants/tumorSV.vcf.gz.tbi \
${prefix}.tumor_sv.vcf.gz.tbi
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( configManta.py --version )
END_VERSIONS
"""
}

View file

@ -0,0 +1,88 @@
name: manta_tumoronly
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:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- crai:
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}"
- tumor_sv_vcf:
type: file
description: Gzipped VCF file containing variants
pattern: "*.{vcf.gz}"
- tumor_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:
- "@maxulysse"

View file

@ -682,10 +682,18 @@ maltextract:
- modules/maltextract/**
- tests/modules/maltextract/**
manta/germline:
- modules/manta/germline/**
- tests/modules/manta/germline/**
manta/somatic:
- modules/manta/somatic/**
- tests/modules/manta/somatic/**
manta/tumoronly:
- modules/manta/tumoronly/**
- tests/modules/manta/tumoronly/**
mash/sketch:
- modules/mash/sketch/**
- tests/modules/mash/sketch/**

View file

@ -0,0 +1,35 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MANTA_GERMLINE } from '../../../../modules/manta/germline/main.nf' addParams( options: [:] )
workflow test_manta_germline {
input = [
[ id:'test'], // 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)
]
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 = []
bed_tbi = []
MANTA_GERMLINE ( input, fasta, fai, bed, bed_tbi )
}
workflow test_manta_germline_target_bed {
input = [
[ id:'test'], // 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)
]
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_GERMLINE ( input, fasta, fai, bed, bed_tbi )
}

View file

@ -0,0 +1,24 @@
- name: manta germline
command: nextflow run ./tests/modules/manta/germline -entry test_manta_germline -c tests/config/nextflow.config
tags:
- manta
- manta/germline
files:
- path: output/manta/test.candidate_small_indels.vcf.gz
- path: output/manta/test.candidate_small_indels.vcf.gz.tbi
- path: output/manta/test.candidate_sv.vcf.gz
- path: output/manta/test.candidate_sv.vcf.gz.tbi
- path: output/manta/test.diploid_sv.vcf.gz
- path: output/manta/test.diploid_sv.vcf.gz.tbi
- name: manta germline target bed
command: nextflow run ./tests/modules/manta/germline -entry test_manta_germline_target_bed -c tests/config/nextflow.config
tags:
- manta
- manta/germline
files:
- path: output/manta/test.candidate_small_indels.vcf.gz
- path: output/manta/test.candidate_small_indels.vcf.gz.tbi
- path: output/manta/test.candidate_sv.vcf.gz
- path: output/manta/test.candidate_sv.vcf.gz.tbi
- path: output/manta/test.diploid_sv.vcf.gz
- path: output/manta/test.diploid_sv.vcf.gz.tbi

View file

@ -0,0 +1,35 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MANTA_TUMORONLY } from '../../../../modules/manta/tumoronly/main.nf' addParams( options: [:] )
workflow test_manta_tumoronly {
input = [
[ id:'test'], // meta map
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 = []
bed_tbi = []
MANTA_TUMORONLY ( input, fasta, fai, bed, bed_tbi )
}
workflow test_manta_tumoronly_target_bed {
input = [
[ id:'test'], // meta map
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_TUMORONLY ( input, fasta, fai, bed, bed_tbi )
}

View file

@ -0,0 +1,24 @@
- name: manta tumoronly
command: nextflow run ./tests/modules/manta/tumoronly -entry test_manta_tumoronly -c tests/config/nextflow.config
tags:
- manta
- manta/tumoronly
files:
- path: output/manta/test.candidate_small_indels.vcf.gz
- path: output/manta/test.candidate_small_indels.vcf.gz.tbi
- path: output/manta/test.candidate_sv.vcf.gz
- path: output/manta/test.candidate_sv.vcf.gz.tbi
- path: output/manta/test.tumor_sv.vcf.gz
- path: output/manta/test.tumor_sv.vcf.gz.tbi
- name: manta tumoronly target bed
command: nextflow run ./tests/modules/manta/tumoronly -entry test_manta_tumoronly_target_bed -c tests/config/nextflow.config
tags:
- manta
- manta/tumoronly
files:
- path: output/manta/test.candidate_small_indels.vcf.gz
- path: output/manta/test.candidate_small_indels.vcf.gz.tbi
- path: output/manta/test.candidate_sv.vcf.gz
- path: output/manta/test.candidate_sv.vcf.gz.tbi
- path: output/manta/test.tumor_sv.vcf.gz
- path: output/manta/test.tumor_sv.vcf.gz.tbi