From 55bee0b02e78394e6534049f6bf607abda057271 Mon Sep 17 00:00:00 2001 From: "Robert A. Petit III" Date: Sun, 27 Feb 2022 17:58:35 -0700 Subject: [PATCH] add module for hpsuisero (#1331) * add module for hpsuisero * Update meta.yml * Update main.nf Co-authored-by: Sateesh <33637490+sateeshperi@users.noreply.github.com> --- modules/hpsuissero/main.nf | 44 ++++++++++++++++++++++++ modules/hpsuissero/meta.yml | 43 +++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/hpsuissero/main.nf | 15 ++++++++ tests/modules/hpsuissero/nextflow.config | 5 +++ tests/modules/hpsuissero/test.yml | 9 +++++ 6 files changed, 120 insertions(+) create mode 100644 modules/hpsuissero/main.nf create mode 100644 modules/hpsuissero/meta.yml create mode 100644 tests/modules/hpsuissero/main.nf create mode 100644 tests/modules/hpsuissero/nextflow.config create mode 100644 tests/modules/hpsuissero/test.yml diff --git a/modules/hpsuissero/main.nf b/modules/hpsuissero/main.nf new file mode 100644 index 00000000..4b31f91c --- /dev/null +++ b/modules/hpsuissero/main.nf @@ -0,0 +1,44 @@ +def VERSION = '1.0.1' // Version information not provided by tool on CLI + +process HPSUISSERO { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::hpsuissero=1.0.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hpsuissero%3A1.0.1--hdfd78af_0': + 'quay.io/biocontainers/hpsuissero:1.0.1--hdfd78af_0' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*.tsv"), emit: tsv + 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}" + def is_compressed = fasta.getName().endsWith(".gz") ? true : false + def fasta_name = fasta.getName().replace(".gz", "") + """ + if [ "$is_compressed" == "true" ]; then + gzip -c -d $fasta > $fasta_name + fi + + HpsuisSero.sh \\ + -i $fasta_name \\ + -o ./ \\ + -s $prefix \\ + -x fasta \\ + -t $task.cpus + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hpsuissero: $VERSION + END_VERSIONS + """ +} diff --git a/modules/hpsuissero/meta.yml b/modules/hpsuissero/meta.yml new file mode 100644 index 00000000..2f48c6c3 --- /dev/null +++ b/modules/hpsuissero/meta.yml @@ -0,0 +1,43 @@ +name: hpsuissero +description: Serotype prediction of Haemophilus parasuis assemblies +keywords: + - bacteria + - fasta + - haemophilus +tools: + - hpsuissero: + description: Rapid Haemophilus parasuis serotyping pipeline for Nanpore data + homepage: https://github.com/jimmyliu1326/HpsuisSero + documentation: https://github.com/jimmyliu1326/HpsuisSero + tool_dev_url: https://github.com/jimmyliu1326/HpsuisSero + doi: "" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Assembly in FASTA format + pattern: "*.{fasta,fasta.gz,fa,fa.gz,fna,fna.gz,faa,faa.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" + - tsv: + type: file + description: Tab-delimited serotype prediction + pattern: "*.{tsv}" + +authors: + - "@rpetit3" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 5ae30708..b4e8428f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -807,6 +807,10 @@ homer/makeucscfile: - modules/homer/makeucscfile/** - tests/modules/homer/makeucscfile/** +hpsuissero: + - modules/hpsuissero/** + - tests/modules/hpsuissero/** + ichorcna/createpon: - modules/ichorcna/createpon/** - tests/modules/ichorcna/createpon/** diff --git a/tests/modules/hpsuissero/main.nf b/tests/modules/hpsuissero/main.nf new file mode 100644 index 00000000..f66fcd93 --- /dev/null +++ b/tests/modules/hpsuissero/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { HPSUISSERO } from '../../../modules/hpsuissero/main.nf' + +workflow test_hpsuissero { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true) + ] + + HPSUISSERO ( input ) +} diff --git a/tests/modules/hpsuissero/nextflow.config b/tests/modules/hpsuissero/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/hpsuissero/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/hpsuissero/test.yml b/tests/modules/hpsuissero/test.yml new file mode 100644 index 00000000..33b26eb2 --- /dev/null +++ b/tests/modules/hpsuissero/test.yml @@ -0,0 +1,9 @@ +- name: hpsuissero test_hpsuissero + command: nextflow run tests/modules/hpsuissero -entry test_hpsuissero -c tests/config/nextflow.config + tags: + - hpsuissero + files: + - path: output/hpsuissero/test_serotyping_res.tsv + md5sum: 559dd2ca386eeb58f3975e3204ce9d43 + - path: output/hpsuissero/versions.yml + md5sum: f65438e63a74ac6ee365bfdbbd3f996a