From fe4eb459fbc76fbcbf63e204b6f5b79f88dca452 Mon Sep 17 00:00:00 2001 From: Lauri Mesilaakso Date: Tue, 1 Mar 2022 14:29:46 +0100 Subject: [PATCH] Add stranger (#1360) * Add stranger * Add when clause * Update paths * Update modules/stranger/main.nf Co-authored-by: Mahesh Binzer-Panchal Co-authored-by: Mahesh Binzer-Panchal --- modules/stranger/main.nf | 33 +++++++++++++++++++ modules/stranger/meta.yml | 44 ++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/stranger/main.nf | 19 +++++++++++ tests/modules/stranger/nextflow.config | 5 +++ tests/modules/stranger/test.yml | 13 ++++++++ 6 files changed, 118 insertions(+) create mode 100644 modules/stranger/main.nf create mode 100644 modules/stranger/meta.yml create mode 100644 tests/modules/stranger/main.nf create mode 100644 tests/modules/stranger/nextflow.config create mode 100644 tests/modules/stranger/test.yml diff --git a/modules/stranger/main.nf b/modules/stranger/main.nf new file mode 100644 index 00000000..2e647627 --- /dev/null +++ b/modules/stranger/main.nf @@ -0,0 +1,33 @@ +process STRANGER { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::stranger=0.8.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/stranger:0.8.1--pyh5e36f6f_0': + 'quay.io/biocontainers/stranger:0.8.1--pyh5e36f6f_0' }" + + input: + tuple val(meta), path(vcf) + + output: + tuple val(meta), path("*.gz"), emit: vcf + 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}" + """ + stranger \\ + $args \\ + $vcf | gzip --no-name > ${prefix}.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + stranger: \$( stranger --version ) + END_VERSIONS + """ +} diff --git a/modules/stranger/meta.yml b/modules/stranger/meta.yml new file mode 100644 index 00000000..a9a280ad --- /dev/null +++ b/modules/stranger/meta.yml @@ -0,0 +1,44 @@ +name: stranger +description: Annotates output files from ExpansionHunter with the pathologic implications of the repeat sizes. +keywords: + - STR + - repeat_expansions + - annotate + - vcf +tools: + - stranger: + description: Annotate VCF files with str variants + homepage: https://github.com/moonso/stranger + documentation: https://github.com/moonso/stranger + tool_dev_url: https://github.com/moonso/stranger + doi: "10.5281/zenodo.4548873" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: VCF with repeat expansions + pattern: "*.{vcf.gz,vcf}" + +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: annotated VCF with keys STR_STATUS, NormalMax and PathologicMin + pattern: "*.{vcf.gz}" + +authors: + - "@ljmesi" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index f3cbaa33..8ec52a63 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1565,6 +1565,10 @@ star/genomegenerate: - modules/star/genomegenerate/** - tests/modules/star/genomegenerate/** +stranger: + - modules/stranger/** + - tests/modules/stranger/** + strelka/germline: - modules/strelka/germline/** - tests/modules/strelka/germline/** diff --git a/tests/modules/stranger/main.nf b/tests/modules/stranger/main.nf new file mode 100644 index 00000000..bc4bd3ce --- /dev/null +++ b/tests/modules/stranger/main.nf @@ -0,0 +1,19 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { EXPANSIONHUNTER } from '../../../modules/expansionhunter/main.nf' +include { STRANGER } from '../../../modules/stranger/main.nf' + +workflow test_stranger { + + input = [ [ id:'test', gender:'male' ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true), + ] + fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + variant_catalog = file(params.test_data['homo_sapiens']['genome']['repeat_expansions'], checkIfExists: true) + + EXPANSIONHUNTER ( input, fasta, variant_catalog ) + STRANGER ( EXPANSIONHUNTER.out.vcf ) +} diff --git a/tests/modules/stranger/nextflow.config b/tests/modules/stranger/nextflow.config new file mode 100644 index 00000000..8730f1c4 --- /dev/null +++ b/tests/modules/stranger/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/modules/stranger/test.yml b/tests/modules/stranger/test.yml new file mode 100644 index 00000000..821928e8 --- /dev/null +++ b/tests/modules/stranger/test.yml @@ -0,0 +1,13 @@ +- name: stranger test_stranger + command: nextflow run tests/modules/stranger -entry test_stranger -c tests/config/nextflow.config + tags: + - stranger + files: + - path: output/expansionhunter/test.vcf + md5sum: cfd4a1d35c0e469b99eb6aaa6d22de76 + - path: output/expansionhunter/versions.yml + md5sum: f3962a6eecfddf9682414c0f605a885a + - path: output/stranger/test.vcf.gz + md5sum: bbe15159195681d5c18596d3ad85c78f + - path: output/stranger/versions.yml + md5sum: 5ec35fd835fb1be50bc3e7c004310fc0