From 650076cacf60e32315f3a9d8bd4c8497737da2ea Mon Sep 17 00:00:00 2001 From: Rike Date: Sat, 11 Jun 2022 13:01:18 +0200 Subject: [PATCH] add manta conversion script --- modules/manta/convertinversion/main.nf | 35 +++++++++++++++ modules/manta/convertinversion/meta.yml | 45 +++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/manta/convertinversion/main.nf | 23 ++++++++++ .../manta/convertinversion/nextflow.config | 5 +++ tests/modules/manta/convertinversion/test.yml | 18 ++++++++ 6 files changed, 130 insertions(+) create mode 100644 modules/manta/convertinversion/main.nf create mode 100644 modules/manta/convertinversion/meta.yml create mode 100644 tests/modules/manta/convertinversion/main.nf create mode 100644 tests/modules/manta/convertinversion/nextflow.config create mode 100644 tests/modules/manta/convertinversion/test.yml diff --git a/modules/manta/convertinversion/main.nf b/modules/manta/convertinversion/main.nf new file mode 100644 index 00000000..f3491530 --- /dev/null +++ b/modules/manta/convertinversion/main.nf @@ -0,0 +1,35 @@ +process MANTA_CONVERTINVERSION { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::samtools=1.15.1 bioconda::manta=1.6.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-40295ae41112676b05b649e513fe7000675e9b84:0b4be2c719f99f44df34be7b447b287bb7f86e01-0': + 'quay.io/biocontainers/mulled-v2-40295ae41112676b05b649e513fe7000675e9b84:0b4be2c719f99f44df34be7b447b287bb7f86e01-0' }" + + input: + tuple val(meta), path(vcf) + path fasta + + output: + tuple val(meta), path("*.vcf.gz") , emit: vcf + tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + convertInversion.py \$(which samtools) $fasta $vcf | bgzip --threads $task.cpus > ${prefix}.vcf.gz + tabix ${prefix}.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + manta: \$( configManta.py --version ) + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + END_VERSIONS + """ +} diff --git a/modules/manta/convertinversion/meta.yml b/modules/manta/convertinversion/meta.yml new file mode 100644 index 00000000..0ed8457c --- /dev/null +++ b/modules/manta/convertinversion/meta.yml @@ -0,0 +1,45 @@ +name: "manta_convertinversions" +description: Manta calls structural variants (SVs) and indels from mapped paired-end sequencing reads. This script reformats inversions into single inverted sequence junctions which was the format used in Manta versions <= 1.4.0. +keywords: + - structural variants + - conversion +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 ] + - vcf: + type: file + description: VCF file produces by Manta + pattern: "*.vcf.gz" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - vcf: + type: file + description: VCF file with reformatted inversions + pattern: "*.vcf.gz" + - tbi: + type: file + description: TBI file produces by Manta + pattern: "*.vcf.gz.tbi" +authors: + - "@FriederikeHanssen" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0f177f5f..6600082c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1242,6 +1242,10 @@ maltextract: - modules/maltextract/** - tests/modules/maltextract/** +manta/convertinversion: + - modules/manta/convertinversion/** + - tests/modules/manta/convertinversion/** + manta/germline: - modules/manta/germline/** - tests/modules/manta/germline/** diff --git a/tests/modules/manta/convertinversion/main.nf b/tests/modules/manta/convertinversion/main.nf new file mode 100644 index 00000000..7107dab9 --- /dev/null +++ b/tests/modules/manta/convertinversion/main.nf @@ -0,0 +1,23 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MANTA_CONVERTINVERSION } from '../../../../modules/manta/convertinversion/main.nf' +include { MANTA_TUMORONLY } from '../../../../modules/manta/tumoronly/main.nf' + +workflow test_manta_convertinversion { + + 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_21_fasta'], checkIfExists: true) + fai = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + + MANTA_TUMORONLY ( input, fasta, fai ) + + MANTA_CONVERTINVERSION ( MANTA_TUMORONLY.out.tumor_sv_vcf, fasta ) +} diff --git a/tests/modules/manta/convertinversion/nextflow.config b/tests/modules/manta/convertinversion/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/manta/convertinversion/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/manta/convertinversion/test.yml b/tests/modules/manta/convertinversion/test.yml new file mode 100644 index 00000000..33330b20 --- /dev/null +++ b/tests/modules/manta/convertinversion/test.yml @@ -0,0 +1,18 @@ +- name: manta convertinversion test_manta_convertinversion + command: nextflow run ./tests/modules/manta/convertinversion -entry test_manta_convertinversion -c ./tests/config/nextflow.config -c ./tests/modules/manta/convertinversion/nextflow.config + tags: + - manta + - manta/convertinversion + 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.tumor_sv.vcf.gz + - path: output/manta/test.tumor_sv.vcf.gz.tbi + md5sum: 4cb176febbc8c26d717a6c6e67b9c905 + - path: output/manta/test.vcf.gz + - path: output/manta/test.vcf.gz.tbi + md5sum: e7180bb953d2bd657c420a5f76a7164d