Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module: nanoq #5896

Merged
merged 13 commits into from
Jul 2, 2024
9 changes: 9 additions & 0 deletions modules/nf-core/nanoq/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "nanoq"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::nanoq=0.10.0"
74 changes: 74 additions & 0 deletions modules/nf-core/nanoq/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
process NANOQ {

LilyAnderssonLee marked this conversation as resolved.
Show resolved Hide resolved
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"

LilyAnderssonLee marked this conversation as resolved.
Show resolved Hide resolved
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/nanoq:0.10.0--h031d066_2' :
'biocontainers/nanoq:0.10.0--h031d066_2'}"

input:
tuple val(meta), path(ontreads)
val(output_type) // u: uncompressed; b: Bzip2; g: Gzip; l: Lzma
SPPearce marked this conversation as resolved.
Show resolved Hide resolved

output:
tuple val(meta), path("*.stats") , emit: stats
tuple val(meta), path("*") , emit: reads
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
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}"
LilyAnderssonLee marked this conversation as resolved.
Show resolved Hide resolved
def seq_type = ontreads.baseName.split("\\.")[1]
SPPearce marked this conversation as resolved.
Show resolved Hide resolved

if (output_type == 'u') {
output_ext = ""
} else if (output_type == 'b') {
output_ext = ".bz2"
} else if (output_type == 'g') {
output_ext = ".gz"
} else if (output_type == 'l') {
output_ext = ".lzma"
}

LilyAnderssonLee marked this conversation as resolved.
Show resolved Hide resolved
"""
nanoq -i $ontreads \\
-r ${prefix}.stats \\
-O $output_type \\
-o ${prefix}_nanoq.${seq_type}${output_ext}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
nanoq: \$(nanoq --version | sed -e 's/nanoq //g')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def seq_type = ontreads.baseName.split("\\.")[1]
if (output_type == 'u') {
output_ext = ""
} else if (output_type == 'b') {
output_ext = ".bz2"
} else if (output_type == 'g') {
output_ext = ".gz"
} else if (output_type == 'l') {
output_ext = ".lzma"
}

LilyAnderssonLee marked this conversation as resolved.
Show resolved Hide resolved
"""
touch ${prefix}_nanoq.${seq_type}${output_ext}
touch ${prefix}.stats

cat <<-END_VERSIONS > versions.yml
"${task.process}":
nanoq: \$(nanoq --version | sed -e 's/nanoq //g')
END_VERSIONS
"""
}
61 changes: 61 additions & 0 deletions modules/nf-core/nanoq/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "nanoq"
description: Nanoq implements ultra-fast read filters and summary reports for high-throughput nanopore reads.
keywords:
- nanoq
- Read filters
- Read trimming
- Read report
tools:
- "nanoq":
description: "Ultra-fast quality control and summary reports for nanopore reads"
homepage: "https://github.com/esteinig/nanoq"
documentation: "https://github.com/esteinig/nanoq"
tool_dev_url: "https://github.com/esteinig/nanoq"
doi: "10.21105/joss.02991"
licence: ["MIT"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- ontreads:
type: file
description: Compressed or uncompressed nanopore reads in fasta or fastq formats.
pattern: "*.{fa,fna,faa,fasta,fq,fastq}{,.gz,.bz2,.xz}"

- output_type:
type: string
description: "Specifies the output compression type: 'b' for Bzip2, 'g' for gzip, 'l' for Lzma, and 'u' for uncompressed."
pattern: "*.{fa,fna,faa,fasta,fq,fastq}{,.gz,.bz2,.lzma}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- stats:
type: file
description: Summary report of reads statistics.
pattern: "*.stats"

- reads:
type: file
description: Filtered reads.
pattern: "*.{fa,fna,faa,fasta,fq,fastq}{,.gz,.bz2,.lzma}"

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@LilyAnderssonLee"
maintainers:
- "@LilyAnderssonLee"
122 changes: 122 additions & 0 deletions modules/nf-core/nanoq/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
nextflow_process {

name "Test Process NANOQ"
script "../main.nf"
process "NANOQ"

tag "modules"
tag "modules_nfcore"
tag "nanoq"

test("sarscov2 - nanopore_uncompressed") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]

input[1] = 'u'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("sarscov2 - nanopore_compressed_gz") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]
input[1] = 'g'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
test("sarscov2 - nanopore_uncompressed_bz2") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]
input[1] = 'b'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
test("sarscov2 - nanopore_uncompressed_lzma") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]
input[1] = 'l'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("sarscov2 - nanopore - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true)
]
input[1] = 'g'
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}
}
Loading
Loading