feat: add module for slimfastq

This commit is contained in:
Moritz E. Beber 2022-05-02 23:16:59 +02:00
parent f70cfbe1d7
commit 16aa3915e3
6 changed files with 189 additions and 0 deletions

52
modules/slimfastq/main.nf Normal file
View file

@ -0,0 +1,52 @@
def VERSION = '2.04'
process SLIMFASTQ {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::slimfastq=2.04" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/slimfastq:2.04--h87f3376_2':
'quay.io/biocontainers/slimfastq:2.04--h87f3376_2' }"
input:
tuple val(meta), path(fastq)
output:
tuple val(meta), path("*.sfq"), emit: sfq
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}"
if (meta.single_end) {
"""
gzip -d -c '${fastq}' | slimfastq \\
$args \\
-f '${prefix}.sfq'
cat <<-END_VERSIONS > versions.yml
"${task.process}":
slimfastq: ${VERSION}
END_VERSIONS
"""
} else {
"""
gzip -d -c '${fastq[0]}' | slimfastq \\
$args \\
-f '${prefix}_1.sfq'
gzip -d -c '${fastq[1]}' | slimfastq \\
$args \\
-f '${prefix}_2.sfq'
cat <<-END_VERSIONS > versions.yml
"${task.process}":
slimfastq: ${VERSION}
END_VERSIONS
"""
}
}

View file

@ -0,0 +1,41 @@
name: "slimfastq"
description: Fast, efficient, lossless compression of FASTQ files.
keywords:
- FASTQ
- compression
- lossless
tools:
- "slimfastq":
description: "slimfastq efficiently compresses/decompresses FASTQ files"
homepage: "https://github.com/Infinidat/slimfastq"
tool_dev_url: "https://github.com/Infinidat/slimfastq"
licence: "['BSD-3-clause']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fastq:
type: file
description: Either a single-end FASTQ file or paired-end files.
pattern: "*.{fq.gz,fastq.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"
- sfq:
type: file
description: Either one or two sequence files in slimfastq compressed format.
pattern: "*.{sfq}"
authors:
- "@Midnighter"

View file

@ -1727,6 +1727,10 @@ sistr:
- modules/sistr/** - modules/sistr/**
- tests/modules/sistr/** - tests/modules/sistr/**
slimfastq:
- modules/slimfastq/**
- tests/modules/slimfastq/**
snapaligner/index: snapaligner/index:
- modules/snapaligner/index/** - modules/snapaligner/index/**
- tests/modules/snapaligner/index/** - tests/modules/snapaligner/index/**

View file

@ -0,0 +1,46 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SLIMFASTQ } from '../../../modules/slimfastq/main.nf'
workflow test_slimfastq_single_end {
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
SLIMFASTQ ( input )
}
workflow test_slimfastq_paired_end {
input = [
[ id:'test', single_end:false ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)]
]
SLIMFASTQ ( input )
}
workflow test_slimfastq_nanopore {
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]
SLIMFASTQ ( input )
}
workflow test_slimfastq_pacbio {
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['homo_sapiens']['pacbio']['ccs_fq_gz'], checkIfExists: true)
]
SLIMFASTQ ( input )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,41 @@
- name: slimfastq test_slimfastq_single_end
command: nextflow run tests/modules/slimfastq -entry test_slimfastq_single_end -c tests/config/nextflow.config
tags:
- slimfastq
files:
- path: output/slimfastq/test.sfq
md5sum: 6a942eeca6c99ee9a9a0cedab5d246f1
- path: output/slimfastq/versions.yml
md5sum: f52351f5c9e6259af02745c8eae5c780
- name: slimfastq test_slimfastq_paired_end
command: nextflow run tests/modules/slimfastq -entry test_slimfastq_paired_end -c tests/config/nextflow.config
tags:
- slimfastq
files:
- path: output/slimfastq/test_1.sfq
md5sum: 6a942eeca6c99ee9a9a0cedab5d246f1
- path: output/slimfastq/test_2.sfq
md5sum: 0d2c60b52a39f7c2cb7843e848d90afd
- path: output/slimfastq/versions.yml
md5sum: 6239853705877651a4851c4cb6d62da4
- name: slimfastq test_slimfastq_nanopore
command: nextflow run tests/modules/slimfastq -entry test_slimfastq_nanopore -c tests/config/nextflow.config
tags:
- slimfastq
files:
- path: output/slimfastq/test.sfq
md5sum: e17f14d64d3a75356b03ff2f9e8881f7
- path: output/slimfastq/versions.yml
md5sum: 33153f1103482a2bd35cb2f4c337c5e8
- name: slimfastq test_slimfastq_pacbio
command: nextflow run tests/modules/slimfastq -entry test_slimfastq_pacbio -c tests/config/nextflow.config
tags:
- slimfastq
files:
- path: output/slimfastq/test.sfq
md5sum: 9e8389e47e6ddf8c25e92412dd628339
- path: output/slimfastq/versions.yml
md5sum: 1982789c3d5c7de37c0a9351e4ae63f7