Skip to content

Commit 02b122b

Browse files
sofstamharis18s
authored andcommitted
Update link test dataset
1 parent ffd15c3 commit 02b122b

7 files changed

Lines changed: 402 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- "bioconda::centrifuger=1.1.0"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
process CENTRIFUGER_CENTRIFUGER {
2+
tag "$meta.id"
3+
label 'process_single'
4+
5+
6+
conda "${moduleDir}/environment.yml"
7+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8+
'https://depot.galaxyproject.org/singularity/centrifuger:1.1.0--hf426362_0':
9+
'biocontainers/centrifuger:1.1.0--hf426362_0' }"
10+
11+
input:
12+
tuple val(meta), path(reads)
13+
path db
14+
val save_unclassified
15+
val save_classified
16+
path barcode
17+
path umi
18+
19+
20+
output:
21+
tuple val(meta), path("${meta.id}.tsv"), emit: classification_file
22+
tuple val(meta), path("${meta.id}.classified*"), optional: true, emit: fastq_classified
23+
tuple val(meta), path("${meta.id}.unclassified*"), optional: true, emit: fastq_unclassified
24+
tuple val("${task.process}"), val('centrifuger'), eval("centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2"),emit: versions_centrifuger, topic: versions
25+
26+
when:
27+
task.ext.when == null || task.ext.when
28+
29+
script:
30+
def args = task.ext.args ?: ''
31+
def prefix = task.ext.prefix ?: "${meta.id}"
32+
def paired = meta.single_end ? "-u ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}"
33+
// Optional outputs
34+
def unclassified_arg = save_unclassified ? "--un ${prefix}.unclassified" : ""
35+
def classified_arg = save_classified ? "--cl ${prefix}.classified" : ""
36+
def barcode_arg = barcode ? "--barcode ${barcode}" : ""
37+
def umi_arg = umi ? "--UMI ${umi}" : ""
38+
39+
40+
"""
41+
db_name=`find -L ${db} -name "*.1.cfr" -not -name "._*" | sed 's/\\.1.cfr\$//'`
42+
43+
centrifuger \\
44+
-x \$db_name \\
45+
${paired} \\
46+
${unclassified_arg} \\
47+
${classified_arg} \\
48+
${barcode_arg} \\
49+
${umi_arg} \\
50+
-t ${task.cpus} \\
51+
${args} > ${prefix}.tsv
52+
53+
"""
54+
55+
stub:
56+
def args = task.ext.args ?: ''
57+
def prefix = task.ext.prefix ?: "${meta.id}"
58+
59+
"""
60+
echo ${args}
61+
#main output
62+
touch ${prefix}.tsv
63+
64+
#Optional outputs
65+
if ${save_unclassified}; then
66+
if ${meta.single_end}; then
67+
echo "" | gzip > ${prefix}.unclassified.fq.gz
68+
else
69+
echo "" | gzip > ${prefix}.unclassified_1.fq.gz
70+
echo "" | gzip > ${prefix}.unclassified_2.fq.gz
71+
fi
72+
fi
73+
74+
if ${save_classified}; then
75+
if ${meta.single_end}; then
76+
echo "" | gzip > ${prefix}.classified.fq.gz
77+
else
78+
echo "" | gzip > ${prefix}.classified_1.fq.gz
79+
echo "" | gzip > ${prefix}.classified_2.fq.gz
80+
fi
81+
fi
82+
83+
cat <<-END_VERSIONS > versions.yml
84+
"${task.process}":
85+
centrifuger: \$(centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2)
86+
END_VERSIONS
87+
"""
88+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: "centrifuger_centrifuger"
2+
description: Classification of sequencing reads using the Centrifuger tool.
3+
keywords:
4+
- metagenomics
5+
- classification
6+
- centrifuger
7+
tools:
8+
- "centrifuger":
9+
description: "Lossless compression of microbial genomes for efficient and accurate
10+
metagenomic sequence classification."
11+
homepage: "https://github.com/mourisl/centrifuger"
12+
documentation: "https://github.com/mourisl/centrifuger"
13+
tool_dev_url: "https://github.com/mourisl/centrifuger"
14+
doi: "10.1186/s13059-024-03244-4"
15+
licence:
16+
- "MIT"
17+
identifier: biotools:centrifuger
18+
input:
19+
- - meta:
20+
type: map
21+
description: Groovy Map containing sample information. e.g. `[
22+
id:'sample1', single_end:false ]`
23+
- reads:
24+
type: file
25+
description: |
26+
List of input FastQ files of size 1 and 2 for single-end and paired-end, respectively.
27+
pattern: "*.{fastq,fq,fastq.gz,fq.gz}"
28+
ontologies:
29+
- edam: http://edamontology.org/format_1930 #FASTQ
30+
- db:
31+
type: directory
32+
description: Path to directory containing Centrifuger database files.
33+
- save_unclassified:
34+
type: boolean
35+
description: |
36+
Optional - if true, output unclassified reads.
37+
- save_classified:
38+
type: boolean
39+
description: |
40+
Optional - if true, output classified reads.
41+
- barcode:
42+
type: file
43+
description: |
44+
Optional barcode file.
45+
- umi:
46+
type: file
47+
description: |
48+
Optional UMI file.
49+
output:
50+
classification_file:
51+
- - meta:
52+
type: map
53+
description: Groovy Map containing sample information. e.g. `[
54+
id:'sample1', single_end:false ]`
55+
- ${meta.id}.tsv:
56+
type: file
57+
description: |
58+
File contαining classification results
59+
pattern: "${prefix}.tsv"
60+
ontologies:
61+
- edam: http://edamontology.org/format_3475 #TSV
62+
63+
fastq_classified:
64+
- - meta:
65+
type: map
66+
description: |
67+
Groovy Map containing sample information
68+
e.g. [ id:'test', single_end:false ]
69+
- ${meta.id}.classified*:
70+
type: file
71+
description: FASTQ file(s) containing classified reads
72+
pattern: "*.{fastq,fq,fastq.gz,fq.gz}"
73+
ontologies:
74+
- edam: http://edamontology.org/format_1930
75+
76+
fastq_unclassified:
77+
- - meta:
78+
type: map
79+
description: |
80+
Groovy Map containing sample information
81+
e.g. [ id:'test', single_end:false ]
82+
- ${meta.id}.unclassified*:
83+
type: file
84+
description: FASTQ file(s) containing unclassified reads
85+
pattern: "*.{fastq,fq,fastq.gz,fq.gz}"
86+
ontologies:
87+
- edam: http://edamontology.org/format_1930
88+
versions_centrifuger:
89+
- - ${task.process}:
90+
type: string
91+
description: The name of the process
92+
- centrifuger:
93+
type: string
94+
description: The name of the tool
95+
- centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2:
96+
type: eval
97+
description: The expression to obtain the version of the tool
98+
topics:
99+
versions:
100+
- - ${task.process}:
101+
type: string
102+
description: The name of the process
103+
- centrifuger:
104+
type: string
105+
description: The name of the tool
106+
- centrifuger -v 2>&1 | head -n 1 | cut -d ' ' -f 2:
107+
type: eval
108+
description: The expression to obtain the version of the tool
109+
authors:
110+
- "@haris18s"
111+
maintainers:
112+
- "@haris18s"
113+
- "@sofstam"
114+
- "@jfy133"
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
nextflow_process {
2+
3+
name "Test Process CENTRIFUGER_CENTRIFUGER"
4+
script "../main.nf"
5+
process "CENTRIFUGER_CENTRIFUGER"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "centrifuger"
10+
tag "centrifuger/centrifuger"
11+
tag "untar"
12+
13+
setup {
14+
run("UNTAR") {
15+
script "../../../untar/main.nf"
16+
process {
17+
"""
18+
input[0] = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/cfr_files_short.tar.gz', checkIfExists: true) ]
19+
"""
20+
}
21+
}
22+
}
23+
24+
test("sarscov2 - fastq_single_end") {
25+
when {
26+
process {
27+
"""
28+
input[0] = [[ id:'test', single_end: true ],
29+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
30+
]
31+
input[1] = UNTAR.out.untar.map{ it[1] }
32+
input[2] = true
33+
input[3] = true
34+
input[4] = []
35+
input[5] = []
36+
"""
37+
}
38+
}
39+
then {
40+
assertAll(
41+
{assert process.success },
42+
{ assert snapshot(
43+
file(process.out.classification_file[0][1]).name,
44+
file(process.out.fastq_classified[0][1]).name,
45+
file(process.out.fastq_unclassified[0][1]).name,
46+
process.out.findAll { key, val -> key.startsWith('versions') }
47+
).match() }
48+
)
49+
}
50+
}
51+
test("sarscov2 - fastq_paired_end") {
52+
when {
53+
process {
54+
"""
55+
input[0] = [
56+
[ id:'test', single_end: false ],
57+
[
58+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
59+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
60+
]
61+
]
62+
input[1] = UNTAR.out.untar.map{ it[1] }
63+
input[2] = true
64+
input[3] = true
65+
input[4] = []
66+
input[5] = []
67+
"""
68+
}
69+
}
70+
then {
71+
assertAll(
72+
{assert process.success },
73+
{ assert snapshot(
74+
file(process.out.classification_file[0][1]).name,
75+
process.out.fastq_classified[0][1].collect { file(it).name },
76+
process.out.fastq_unclassified[0][1].collect {file (it).name },
77+
process.out.findAll { key, val -> key.startsWith('versions') }
78+
).match() }
79+
)
80+
}
81+
82+
}
83+
test("sarscov2 - fastq_single_end_stub") {
84+
options "-stub"
85+
86+
when {
87+
process {
88+
"""
89+
input[0] = [[ id:'test', single_end: true ],
90+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
91+
]
92+
input[1] = UNTAR.out.untar.map{ it[1] }
93+
input[2] = true
94+
input[3] = true
95+
input[4] = []
96+
input[5] = []
97+
"""
98+
}
99+
}
100+
then {
101+
assertAll(
102+
{assert process.success },
103+
{ assert snapshot(
104+
file(process.out.classification_file[0][1]).name,
105+
file(process.out.fastq_classified[0][1]).name,
106+
file(process.out.fastq_unclassified[0][1]).name,
107+
process.out.findAll { key, val -> key.startsWith('versions') }
108+
).match() }
109+
)
110+
}
111+
112+
}
113+
114+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"sarscov2 - fastq_paired_end": {
3+
"content": [
4+
"test.tsv",
5+
[
6+
"test.classified_1.fq.gz",
7+
"test.classified_2.fq.gz"
8+
],
9+
[
10+
"test.unclassified_1.fq.gz",
11+
"test.unclassified_2.fq.gz"
12+
],
13+
{
14+
"versions_centrifuger": [
15+
[
16+
"CENTRIFUGER_CENTRIFUGER",
17+
"centrifuger",
18+
"v1.1.0-r299"
19+
]
20+
]
21+
}
22+
],
23+
"timestamp": "2026-04-16T16:52:17.555484",
24+
"meta": {
25+
"nf-test": "0.9.4",
26+
"nextflow": "25.10.4"
27+
}
28+
},
29+
"sarscov2 - fastq_single_end": {
30+
"content": [
31+
"test.tsv",
32+
"test.classified.fq.gz",
33+
"test.unclassified.fq.gz",
34+
{
35+
"versions_centrifuger": [
36+
[
37+
"CENTRIFUGER_CENTRIFUGER",
38+
"centrifuger",
39+
"v1.1.0-r299"
40+
]
41+
]
42+
}
43+
],
44+
"timestamp": "2026-04-16T16:52:12.358403",
45+
"meta": {
46+
"nf-test": "0.9.4",
47+
"nextflow": "25.10.4"
48+
}
49+
},
50+
"sarscov2 - fastq_single_end_stub": {
51+
"content": [
52+
"test.tsv",
53+
"test.classified.fq.gz",
54+
"test.unclassified.fq.gz",
55+
{
56+
"versions_centrifuger": [
57+
[
58+
"CENTRIFUGER_CENTRIFUGER",
59+
"centrifuger",
60+
"v1.1.0-r299"
61+
]
62+
]
63+
}
64+
],
65+
"timestamp": "2026-04-16T16:52:22.944436",
66+
"meta": {
67+
"nf-test": "0.9.4",
68+
"nextflow": "25.10.4"
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)