Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 3 additions & 29 deletions modules/nf-core/hostile/clean/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process HOSTILE_CLEAN {
output:
tuple val(meta), path('*.fastq.gz'), emit: fastq
tuple val(meta), path('*.json') , emit: json
path 'versions.yml' , emit: versions
tuple val("${task.process}"), val('hostile'), eval("hostile --version"), emit: versions_hostile, topic: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -39,42 +39,16 @@ process HOSTILE_CLEAN {
--reorder \\
--airplane \\
| tee > ${prefix}.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
hostile: \$(hostile --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def sorted_reads = meta.single_end ? [reads].flatten() : reads.sort { read -> read.simpleName }
def reads_cmd = meta.single_end ? "--fastq1 ${sorted_reads[0]}" : "--fastq1 ${sorted_reads[0]} --fastq2 ${sorted_reads[1]}"
def fake_read2 = !meta.single_end ? "echo '' | gzip -c > ${prefix}.clean_2.fastq.gz" : ""
def fake_read2 = !meta.single_end ? "echo '' | gzip > ${prefix}.clean_2.fastq.gz" : ""
"""
export HOSTILE_CACHE_DIR=${reference_dir}

echo "hostile \\
clean \\
${args} \\
--threads ${task.cpus} \\
${reads_cmd} \\
--index ${reference_name} \\
--output . \\
--reorder \\
--airplane \\
| tee > ${prefix}.json"

export HOSTILE_CACHE_DIR=${reference_dir}
echo "" | gzip -c > ${prefix}.clean_1.fastq.gz
echo "" | gzip > ${prefix}.clean_1.fastq.gz
${fake_read2}

touch ${prefix}.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
hostile: \$(hostile --version)
END_VERSIONS
"""
}
32 changes: 22 additions & 10 deletions modules/nf-core/hostile/clean/meta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "hostile_clean"
description: Removes host reads from short- and long-read FASTQ sequencing files
keywords:
Expand All @@ -14,9 +13,9 @@ tools:
documentation: "https://github.com/bede/hostile"
tool_dev_url: "https://github.com/bede/hostile"
doi: "10.1093/bioinformatics/btad728"
licence: ["MIT"]
licence:
- "MIT"
identifier: biotools:hostile

input:
- - meta:
type: map
Expand All @@ -41,7 +40,6 @@ input:
indices AND explicitly specify `--aligner bowtie2`
ontologies:
- edam: "http://edamontology.org/data_1049"

output:
fastq:
- - meta:
Expand Down Expand Up @@ -69,13 +67,27 @@ output:
pattern: "*.json"
ontologies:
- edam: "http://edamontology.org/format_3464"
versions_hostile:
- - ${task.process}:
type: string
description: The name of the process
- hostile:
type: string
description: The name of the tool
- hostile --version:
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The name of the process
- hostile:
type: string
description: The name of the tool
- hostile --version:
type: eval
description: The expression to obtain the version of the tool
authors:
- "@jfy133"
maintainers:
Expand Down
19 changes: 5 additions & 14 deletions modules/nf-core/hostile/clean/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.fastq,
process.out.versions,
path(process.out.versions.get(0)).yaml,
path(process.out.json[0][1]).readLines().any{ it.contains('\"reads_removed\": 0')}
).match() }
{ assert path(process.out.json[0][1]).readLines().any{ it.contains('\"reads_removed\": 0')} },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys:["json"])).match() }
)
}

Expand Down Expand Up @@ -80,12 +76,8 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.fastq,
process.out.versions,
path(process.out.versions.get(0)).yaml,
path(process.out.json[0][1]).readLines().any{ it.contains('\"reads_removed\": 0')}
).match() }
{ assert path(process.out.json[0][1]).readLines().any{ it.contains('\"reads_removed\": 0')} },
{ assert snapshot(sanitizeOutput(process.out, unstableKeys:["json"])).match() }
)
}

Expand Down Expand Up @@ -113,8 +105,7 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert path(process.out.versions.get(0)).yaml}
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}

Expand Down
131 changes: 66 additions & 65 deletions modules/nf-core/hostile/clean/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"fastq - single-end - stub": {
"content": [
{
"0": [
"fastq": [
[
{
"id": "test",
Expand All @@ -11,7 +11,7 @@
"test.clean_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"json": [
[
{
"id": "test",
Expand All @@ -20,93 +20,94 @@
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,ada5e72cc34942b0eccc41d073c4247f"
],
"versions_hostile": [
[
"HOSTILE_CLEAN",
"hostile",
"2.0.2"
]
]
}
],
"timestamp": "2026-05-22T10:10:32.316335997",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.0"
}
},
"fastq - paired-end": {
"content": [
{
"fastq": [
[
{
"id": "test",
"single_end": true
"single_end": false
},
"test.clean_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
[
"test_1.clean_1.fastq.gz:md5,6de988b85909e6529bad0022703bcab2",
"test_2.clean_2.fastq.gz:md5,539acd65e93bf16a5ace7d6034e704c7"
]
]
],
"json": [
[
{
"id": "test",
"single_end": true
"single_end": false
},
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e"
"test.json"
]
],
"versions": [
"versions.yml:md5,ada5e72cc34942b0eccc41d073c4247f"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
},
"timestamp": "2025-09-11T19:36:13.16472899"
},
"fastq - paired-end": {
"content": [
[
[
{
"id": "test",
"single_end": false
},
"versions_hostile": [
[
"test_1.clean_1.fastq.gz:md5,6de988b85909e6529bad0022703bcab2",
"test_2.clean_2.fastq.gz:md5,539acd65e93bf16a5ace7d6034e704c7"
"HOSTILE_CLEAN",
"hostile",
"2.0.2"
]
]
],
[
"versions.yml:md5,ada5e72cc34942b0eccc41d073c4247f"
],
{
"HOSTILE_CLEAN": {
"hostile": "2.0.2"
}
},
true
}
],
"timestamp": "2026-05-22T10:13:45.740888243",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-11-09T16:15:42.374481236"
"nf-test": "0.9.5",
"nextflow": "26.04.0"
}
},
"fastq - single-end": {
"content": [
[
[
{
"id": "test",
"single_end": true
},
"test_1.clean.fastq.gz:md5,9224ada21765cb3ad5fc05f40df78f17"
]
],
[
"versions.yml:md5,ada5e72cc34942b0eccc41d073c4247f"
],
{
"HOSTILE_CLEAN": {
"hostile": "2.0.2"
}
},
true
"fastq": [
[
{
"id": "test",
"single_end": true
},
"test_1.clean.fastq.gz:md5,9224ada21765cb3ad5fc05f40df78f17"
]
],
"json": [
[
{
"id": "test",
"single_end": true
},
"test.json"
]
],
"versions_hostile": [
[
"HOSTILE_CLEAN",
"hostile",
"2.0.2"
]
]
}
],
"timestamp": "2026-05-22T10:13:22.374303854",
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
},
"timestamp": "2025-09-11T09:45:14.395763629"
"nf-test": "0.9.5",
"nextflow": "26.04.0"
}
}
}
13 changes: 1 addition & 12 deletions modules/nf-core/hostile/fetch/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process HOSTILE_FETCH {

output:
tuple val(index_name), path('reference/'), emit: reference
path 'versions.yml', emit: versions
tuple val("${task.process}"), val('hostile'), eval("hostile --version"), emit: versions_hostile, topic: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -27,29 +27,18 @@ process HOSTILE_FETCH {
fetch \\
--name ${index_name} \\
${args}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
hostile: \$(hostile --version)
END_VERSIONS
"""

stub:
"""
mkdir reference/
export HOSTILE_CACHE_DIR=./reference

touch reference/human-t2t-hla.1.bt2
touch reference/human-t2t-hla.2.bt2
touch reference/human-t2t-hla.3.bt2
touch reference/human-t2t-hla.4.bt2
touch reference/human-t2t-hla.rev.1.bt2
touch reference/human-t2t-hla.rev.2.bt2
touch reference/human-t2t-hla.mmi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
hostile: \$(hostile --version)
END_VERSIONS
"""
}
Loading
Loading