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
7 changes: 7 additions & 0 deletions modules/nf-core/picrust2/pipeline/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::picrust2=2.6.2"
63 changes: 63 additions & 0 deletions modules/nf-core/picrust2/pipeline/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
process PICRUST2_PIPELINE {
tag "${meta.id}"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/6a/6a9b732fec49b33334dcff4f8875dcd552402ead5654443a54c7f4f79823df78/data'
: 'community.wave.seqera.io/library/picrust2:2.6.2--a7c158f7c987b452'}"

input:
tuple val(meta), path(sequences), path(otu_table)

output:
tuple val(meta), path("${prefix}/") , emit: output_dir
tuple val(meta), path("${prefix}/*_reduced.tre") , emit: trees
tuple val(meta), path("${prefix}_metagenome_*_abundances.tsv.gz"), emit: function_abundances
tuple val(meta), path("${prefix}_pathway_abundances.tsv.gz") , emit: pathway_abundances
path 'versions.yml', emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
picrust2_pipeline.py \\
--study_fasta ${sequences} \\
--input ${otu_table} \\
--processes ${task.cpus} \\
--output ${prefix} \\
${args}

cp ${prefix}/pathways_out/path_abun_unstrat.tsv.gz ${prefix}_pathway_abundances.tsv.gz

for metagenome_dir in ${prefix}/*_metagenome_out; do
func_type=\$(basename \$metagenome_dir _metagenome_out)
cp \${metagenome_dir}/pred_metagenome_unstrat.tsv.gz ${prefix}_metagenome_\${func_type}_abundances.tsv.gz
done

cat <<-END_VERSIONS > versions.yml
"${task.process}":
picrust2: \$( picrust2_pipeline.py --version | sed 's/PICRUSt2 //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo ${args}

mkdir -p ${prefix}
touch ${prefix}/bac_reduced.tre
echo '' | gzip -c > ${prefix}_metagenome_EC_abundances.tsv.gz
echo '' | gzip -c > ${prefix}_pathway_abundances.tsv.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
picrust2: \$( picrust2_pipeline.py --version | sed 's/PICRUSt2 //' )
END_VERSIONS
"""
}
97 changes: 97 additions & 0 deletions modules/nf-core/picrust2/pipeline/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "picrust2_pipeline"
description: Predict metagenome functional content from marker gene sequences
and OTU/ASV abundance data
keywords:
- metagenomics
- functional prediction
- 16S
- microbiome
tools:
- "picrust2":
description: "PICRUSt2: Phylogenetic Investigation of Communities by Reconstruction
of Unobserved States"
homepage: "https://github.com/picrust/picrust2/wiki"
documentation: "https://github.com/picrust/picrust2/wiki"
tool_dev_url: "https://github.com/picrust/picrust2"
doi: "10.1038/s41587-020-0548-6"
licence: ["GPL v3"]
identifier: biotools:picrust2

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- sequences:
type: file
description: FASTA file containing study sequences (e.g., 16S rRNA
sequences)
pattern: "*.{fasta,fa,fna}"
ontologies: []
- otu_table:
type: file
description: OTU/ASV abundance table in BIOM or TSV format
pattern: "*.{biom,tsv,txt}"

ontologies:
- edam: http://edamontology.org/format_3746 # BIOM format
- edam: http://edamontology.org/format_3475 # TSV
output:
output_dir:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- ${prefix}/:
type: directory
description: Complete output directory of PICRUSt2 pipeline
trees:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- ${prefix}/*_reduced.tre:
type: file
description: Phylogenetic trees with reduced marker gene sequences
pattern: "*_reduced.tre"
ontologies: []
function_abundances:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- ${prefix}/*_metagenome_out/pred_metagenome_unstrat.tsv.gz:
type: file
description: Predicted metagenome functional abundances (unstratified)
pattern: "pred_metagenome_unstrat.tsv.gz"
ontologies:
- edam: http://edamontology.org/format_3989 # GZIP format
pathway_abundances:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- ${prefix}/pathways_out/path_abun_unstrat.tsv.gz:
type: file
description: Predicted pathway abundances (unstratified)
pattern: "path_abun_unstrat.tsv.gz"
ontologies:
- edam: http://edamontology.org/format_3989 # GZIP format
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: "http://edamontology.org/format_3750" # YAML

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

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

tag "modules"
tag "modules_nfcore"
tag "picrust2"
tag "picrust2/pipeline"


test("picrust2 pipeline [16s otu]") {

config "./nextflow.config"

when {
process {
"""
input[0] = [
[ id: 'test' ],
file(params.modules_testdata_base_path + 'metabarcoding/16S_OTU/rep-seq.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'metabarcoding/16S_OTU/feature-table.tsv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.trees,
process.out.function_abundances,
process.out.pathway_abundances
).match() },
{ assert snapshot(
path(process.out.versions.get(0)).yaml
).match("versions") }
)
}

}

test("picrust2 pipeline [16s otu] - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'metabarcoding/16S_OTU/rep-seq.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'metabarcoding/16S_OTU/feature-table.tsv', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.trees,
process.out.function_abundances,
process.out.pathway_abundances,
path(process.out.versions.get(0)).yaml
).match() }
)
}

}

}
90 changes: 90 additions & 0 deletions modules/nf-core/picrust2/pipeline/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"picrust2 pipeline [16s otu] - stub": {
"content": [
[
[
{
"id": "test"
},
"bac_reduced.tre:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
[
{
"id": "test"
},
"test_metagenome_EC_abundances.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
[
[
{
"id": "test"
},
"test_pathway_abundances.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
{
"PICRUST2_PIPELINE": {
"picrust2": "2.6.2"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.8"
},
"timestamp": "2025-10-23T09:22:34.879189621"
},
"versions": {
"content": [
{
"PICRUST2_PIPELINE": {
"picrust2": "2.6.2"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.8"
},
"timestamp": "2025-10-21T05:16:14.5417447"
},
"picrust2 pipeline [16s otu]": {
"content": [
[
[
{
"id": "test"
},
[
"arc_reduced.tre:md5,35617cfa837738468b8e6a15b6bc8795",
"bac_reduced.tre:md5,72049e7bc0531b9d55771481cb970883"
]
]
],
[
[
{
"id": "test"
},
"test_metagenome_EC_abundances.tsv.gz:md5,b4e292e86ec6f663c8d3ece1c5f47eb9"
]
],
[
[
{
"id": "test"
},
"test_pathway_abundances.tsv.gz:md5,632c0078254a10e6518e2ae6019b5f17"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.8"
},
"timestamp": "2025-10-23T09:22:29.693722206"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/picrust2/pipeline/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: PICRUST2_PIPELINE {
ext.args = "--in_traits 'EC' -t sepp --remove_intermediate"
}
}
Loading