Skip to content

Commit

Permalink
Add seqkit/fx2tab module
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh committed Jul 18, 2023
1 parent ea06ec9 commit 87f9945
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 0 deletions.
37 changes: 37 additions & 0 deletions modules/nf-core/seqkit/fx2tab/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
42 changes: 42 additions & 0 deletions modules/nf-core/seqkit/fx2tab/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
25 changes: 25 additions & 0 deletions tests/modules/nf-core/seqkit/fx2tab/main.nf
Original file line number Diff line number Diff line change
@@ -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 )

}
7 changes: 7 additions & 0 deletions tests/modules/nf-core/seqkit/fx2tab/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {

withName: 'SEQKIT_FX2TAB' {
ext.args = ""
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
}
18 changes: 18 additions & 0 deletions tests/modules/nf-core/seqkit/fx2tab/test.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 87f9945

Please sign in to comment.