Skip to content

Commit

Permalink
add module for yak (#6053)
Browse files Browse the repository at this point in the history
* add yak count

* add nf.test

* added snap

* added snap

* removed tailing spaces

* added keywords in meta

* change file type

* Update modules/nf-core/yak/count/tests/main.nf.test

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/main.nf

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/main.nf

Co-authored-by: Joon Klaps <[email protected]>

* add pe test in nf test

* fixed format

* test

* Update modules/nf-core/yak/count/meta.yml

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/main.nf

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/meta.yml

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/tests/main.nf.test

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/meta.yml

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/main.nf

Co-authored-by: Joon Klaps <[email protected]>

* Update modules/nf-core/yak/count/main.nf

Co-authored-by: Joon Klaps <[email protected]>

* minor changes in meta, regenerated snap

* minor changes in meta, regenerated snap

* removed pe test

* removed spaces

* fixed format

* removed tests and modify nf test order

---------

Co-authored-by: Joon Klaps <[email protected]>
  • Loading branch information
yumisims and Joon-Klaps authored Jul 31, 2024
1 parent 4133cae commit e5ac715
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/yak/count/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: "yak_count"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::yak=0.1"
49 changes: 49 additions & 0 deletions modules/nf-core/yak/count/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process YAK_COUNT {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/yak:0.1--he4a0461_4':
'biocontainers/yak:0.1--he4a0461_4' }"

input:
tuple val(meta), path(fastq)

output:
tuple val(meta), path("*.yak"), emit: yak
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}"
input_command = meta.single_end ? "${fastq}" : "<(zcat ${fastq}) <(zcat ${fastq})"
"""
yak \\
count \\
$args \\
-t${task.cpus} \\
-o ${prefix}.yak \\
$input_command
cat <<-END_VERSIONS > versions.yml
"${task.process}":
yak: \$(yak version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.yak
cat <<-END_VERSIONS > versions.yml
"${task.process}":
yak: \$(yak version)
END_VERSIONS
"""
}
47 changes: 47 additions & 0 deletions modules/nf-core/yak/count/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "yak_count"
description: a tool to build k-mer hash table for fasta and fastq files
keywords:
- kmer
- fastq
- sequence
- count
- assembly

tools:
- "yak":
description: "Yet another k-mer analyzer"
homepage: "https://github.com/lh3/yak"
documentation: "https://github.com/lh3/yak/blob/master/README.md"
tool_dev_url: "https://github.com/lh3/yak"
licence: ["MIT"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- fastq:
type: file
description: reads fastq/fasta file
pattern: "*.{fastq.gz,fq.gz,fasta.gz,fa.gz}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- yak:
type: file
description: k-mer hash table of input
pattern: "*.{yak}"

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

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

tag "modules"
tag "modules_nfcore"
tag "yak"
tag "yak/count"

test("sarscov2 - Illumina - se") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true)
]
"""
}
}

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

}

test("sarscov2 - Illumina - pe") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[ file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_2.fastq.gz", checkIfExists: true)]
]
"""
}
}

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

}

test("sarscov2 - Illumina - se - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true)
]
"""
}
}

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

}

}
107 changes: 107 additions & 0 deletions modules/nf-core/yak/count/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"sarscov2 - Illumina - se": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true
},
"test.yak:md5,0f7375059550949b7ba619a984ece2da"
]
],
"1": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"versions": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"yak": [
[
{
"id": "test",
"single_end": true
},
"test.yak:md5,0f7375059550949b7ba619a984ece2da"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-30T13:14:15.064795726"
},
"sarscov2 - Illumina - se - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true
},
"test.yak:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"versions": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"yak": [
[
{
"id": "test",
"single_end": true
},
"test.yak:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-30T13:14:36.315145428"
},
"sarscov2 - Illumina - pe": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.yak:md5,f4d1b22744d1ba9619bf7b66c89ecf10"
]
],
"1": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"versions": [
"versions.yml:md5,bf1f473f0df39c185adfaf52c9701874"
],
"yak": [
[
{
"id": "test",
"single_end": false
},
"test.yak:md5,f4d1b22744d1ba9619bf7b66c89ecf10"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-30T13:14:25.971171004"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/yak/count/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yak/count:
- "modules/nf-core/yak/count/**"

0 comments on commit e5ac715

Please sign in to comment.