From ee5f59705f61a93ed9af59e19da1b1f2240648e8 Mon Sep 17 00:00:00 2001 From: Michael L Heuer Date: Wed, 28 Sep 2022 03:23:18 -0500 Subject: [PATCH] Adding new module gfaffix (#1149) * Adding new module gfaffix. * add missing entry to pytest_modules.yml * update to 0.1.4--hec16e2b_0 * fixup after prettier * add when section * update md5sum * Change to process_single as discussed Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Co-authored-by: Simon Heumos --- modules/gfaffix/main.nf | 36 +++++++++++++++++++++ modules/gfaffix/meta.yml | 46 +++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/gfaffix/main.nf | 13 ++++++++ tests/modules/gfaffix/nextflow.config | 5 +++ tests/modules/gfaffix/test.yml | 9 ++++++ 6 files changed, 113 insertions(+) create mode 100644 modules/gfaffix/main.nf create mode 100644 modules/gfaffix/meta.yml create mode 100644 tests/modules/gfaffix/main.nf create mode 100644 tests/modules/gfaffix/nextflow.config create mode 100644 tests/modules/gfaffix/test.yml diff --git a/modules/gfaffix/main.nf b/modules/gfaffix/main.nf new file mode 100644 index 00000000..3ae5ad66 --- /dev/null +++ b/modules/gfaffix/main.nf @@ -0,0 +1,36 @@ +process GFAFFIX { + tag "$meta.id" + label 'process_single' + + conda (params.enable_conda ? 'bioconda::gfaffix=0.1.4' : null) + + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/gfaffix:0.1.4--hec16e2b_0' : + 'quay.io/biocontainers/gfaffix:0.1.4--hec16e2b_0' }" + + input: + tuple val(meta), path(gfa) + + output: + tuple val(meta), path("*.gfa"), emit: gfa + tuple val(meta), path("*.txt"), emit: affixes + 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}" + """ + gfaffix \\ + $args \\ + $gfa \\ + -o ${prefix}.gfaffix.gfa > ${prefix}.affixes.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gfaffix: \$(gfaffix --version 2>&1 | grep -o 'gfaffix .*' | cut -f2 -d ' ') + END_VERSIONS + """ +} diff --git a/modules/gfaffix/meta.yml b/modules/gfaffix/meta.yml new file mode 100644 index 00000000..0c3924a3 --- /dev/null +++ b/modules/gfaffix/meta.yml @@ -0,0 +1,46 @@ +name: gfaffix +description: Collapse walk-preserving shared affixes in variation graphs in GFA format +keywords: + - gfa + - graph + - pangenome + - variation graph +tools: + - gfaffix: + description: | + GFAffix identifies walk-preserving shared affixes in variation graphs and + collapses them into a non-redundant graph structure. + homepage: https://github.com/marschall-lab/GFAffix + documentation: https://github.com/marschall-lab/GFAffix + licence: ["MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - gfa: + type: file + description: Variation graph in GFA format + pattern: "*.{gfa}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - gfa: + type: file + description: Non-redundant variation graph in GFA 1.0 format + pattern: "*.{gfa}" + - affixes: + type: file + description: Shared affixes in tab-separated values (TSV) text format + pattern: "*.{txt}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@heuermh" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 99df6ba1..ec981331 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1087,6 +1087,10 @@ genrich: - modules/genrich/** - tests/modules/genrich/** +gfaffix: + - modules/gfaffix/** + - tests/modules/gfaffix/** + gffread: - modules/gffread/** - tests/modules/gffread/** diff --git a/tests/modules/gfaffix/main.nf b/tests/modules/gfaffix/main.nf new file mode 100644 index 00000000..333866c0 --- /dev/null +++ b/tests/modules/gfaffix/main.nf @@ -0,0 +1,13 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GFAFFIX } from '../../../modules/gfaffix/main.nf' + +workflow test_gfaffix { + input = [ [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['illumina']['assembly_gfa'], checkIfExists: true)] + ] + + GFAFFIX ( input ) +} diff --git a/tests/modules/gfaffix/nextflow.config b/tests/modules/gfaffix/nextflow.config new file mode 100644 index 00000000..8730f1c4 --- /dev/null +++ b/tests/modules/gfaffix/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/modules/gfaffix/test.yml b/tests/modules/gfaffix/test.yml new file mode 100644 index 00000000..d88db7c6 --- /dev/null +++ b/tests/modules/gfaffix/test.yml @@ -0,0 +1,9 @@ +- name: gfaffix + command: nextflow run ./tests/modules/gfaffix -entry test_gfaffix -c ./tests/config/nextflow.config -c ./tests/modules/gfaffix/nextflow.config + tags: + - gfaffix + files: + - path: output/gfaffix/test.gfaffix.gfa + md5sum: 7b51abeeab7706393957fcb66d31704a + - path: output/gfaffix/test.affixes.txt + md5sum: c3540baa386462552d7ebe4e4b7eda6a