diff --git a/modules/nf-core/seqkit/fx2tab/main.nf b/modules/nf-core/seqkit/fx2tab/main.nf new file mode 100644 index 000000000000..892de6799ba4 --- /dev/null +++ b/modules/nf-core/seqkit/fx2tab/main.nf @@ -0,0 +1,37 @@ +process SEQKIT_FX2TAB { + tag "$meta.id" + label 'process_medium' + + conda "bioconda::seqkit=2.1.0" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/seqkit:2.1.0--h9ee0642_0' : + 'biocontainers/seqkit:2.1.0--h9ee0642_0' }" + + input: + tuple val(meta), path(fastx) + + output: + tuple val(meta), path("*.txt*"), emit: text + 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 suffix = task.ext.suffix ?: "txt.zst" + """ + seqkit \\ + fx2tab \\ + $args \\ + --threads $task.cpus \\ + $fastx \\ + -o ${prefix}.${suffix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + seqkit: \$( seqkit | sed '3!d; s/Version: //' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/seqkit/fx2tab/meta.yml b/modules/nf-core/seqkit/fx2tab/meta.yml new file mode 100644 index 000000000000..06497cd75d60 --- /dev/null +++ b/modules/nf-core/seqkit/fx2tab/meta.yml @@ -0,0 +1,42 @@ +name: seqkit_fx2tab +description: Convert FASTA/Q to tabular format, and provide various information, like sequence length, GC content/GC skew. +keywords: + - fasta + - fastq + - text + - tabular + - convert +tools: + - seqkit: + description: | + Cross-platform and ultrafast toolkit for FASTA/Q file manipulation, written by Wei Shen. + homepage: https://github.com/shenwei356/seqkit + documentation: https://bioinf.shenwei.me/seqkit/ + doi: 10.1371/journal.pone.0163962 + licence: ["MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastx: + type: file + description: Sequence file in fasta/q format + pattern: "*.{fasta,fastq,fa,fq,fas,fna,faa}[.gz,.zst]" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - text: + type: file + description: Text file in tabular format + pattern: "*.txt[.gz,.zstd,.zst]" + - 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 67552d2abe7d..93bb22da9881 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -3243,6 +3243,10 @@ sentieon/varcal: - modules/nf-core/sentieon/varcal/** - tests/modules/nf-core/sentieon/varcal/** +seqkit/fx2tab: + - modules/nf-core/seqkit/fx2tab/** + - tests/modules/nf-core/seqkit/fx2tab/** + seqkit/grep: - modules/nf-core/seqkit/grep/** - tests/modules/nf-core/seqkit/grep/** diff --git a/tests/modules/nf-core/seqkit/fx2tab/main.nf b/tests/modules/nf-core/seqkit/fx2tab/main.nf new file mode 100644 index 000000000000..0e2cf4e34a7b --- /dev/null +++ b/tests/modules/nf-core/seqkit/fx2tab/main.nf @@ -0,0 +1,25 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SEQKIT_FX2TAB } from '../../../../../modules/nf-core/seqkit/fx2tab/main.nf' + +workflow test_seqkit_fx2tab_fasta { + + input = [ [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + ] + + SEQKIT_FX2TAB ( input ) + +} + +workflow test_seqkit_fx2tab_fastq { + + input = [ [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] + ] + + SEQKIT_FX2TAB ( input ) + +} diff --git a/tests/modules/nf-core/seqkit/fx2tab/nextflow.config b/tests/modules/nf-core/seqkit/fx2tab/nextflow.config new file mode 100644 index 000000000000..0973dcfd5422 --- /dev/null +++ b/tests/modules/nf-core/seqkit/fx2tab/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: 'SEQKIT_FX2TAB' { + ext.args = "" + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + } +} diff --git a/tests/modules/nf-core/seqkit/fx2tab/test.yml b/tests/modules/nf-core/seqkit/fx2tab/test.yml new file mode 100644 index 000000000000..5c3663f7d3c0 --- /dev/null +++ b/tests/modules/nf-core/seqkit/fx2tab/test.yml @@ -0,0 +1,18 @@ +- name: seqkit fx2tab test_seqkit_fx2tab_fasta + command: nextflow run ./tests/modules/nf-core/seqkit/fx2tab -entry test_seqkit_fx2tab_fasta -c ./tests/config/nextflow.config + tags: + - seqkit/fx2tab + - seqkit + files: + - path: output/seqkit/test.txt.zst + md5sum: 9d6751134b38b57b1d2f76f508b610fa + - path: output/seqkit/versions.yml +- name: seqkit fx2tab test_seqkit_fx2tab_fastq + command: nextflow run ./tests/modules/nf-core/seqkit/fx2tab -entry test_seqkit_fx2tab_fastq -c ./tests/config/nextflow.config + tags: + - seqkit/fx2tab + - seqkit + files: + - path: output/seqkit/test.txt.zst + md5sum: df053f44dbaa8576e93426274e73c2b5 + - path: output/seqkit/versions.yml