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

Added MetaPlAn subworkflow #5356

Merged
merged 17 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
30 changes: 30 additions & 0 deletions subworkflows/nf-core/fastq_taxonomic_profile_metaphlan/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
include { METAPHLAN_MAKEDB } from '../../../modules/nf-core/metaphlan/makedb/main'
include { METAPHLAN_METAPHLAN } from '../../../modules/nf-core/metaphlan/metaphlan/main'
include { METAPHLAN3_MERGEMETAPHLANTABLES } from '../../../modules/nf-core/metaphlan3/mergemetaphlantables/main'
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved


workflow FASTQ_TAXONOMIC_PROFILE_METAPHLAN {

take:
ch_fastq

main:

ch_versions = Channel.empty()

METAPHLAN_MAKEDB ( )
ch_versions = ch_versions.mix(METAPHLAN_MAKEDB.out.versions.first())

METAPHLAN_METAPHLAN ( ch_fastq, METAPHLAN_MAKEDB.out.db )
ch_versions = ch_versions.mix(METAPHLAN_METAPHLAN.out.versions.first())

METAPHLAN3_MERGEMETAPHLANTABLES ( METAPHLAN_METAPHLAN.out.profile.map{ [ [id:'all_samples'], it[1] ] }.groupTuple( sort: 'deep') )
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
ch_versions = ch_versions.mix(METAPHLAN3_MERGEMETAPHLANTABLES.out.versions.first())
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved

emit:
merged_taxa = METAPHLAN3_MERGEMETAPHLANTABLES.out.txt
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved


versions = ch_versions
}

52 changes: 52 additions & 0 deletions subworkflows/nf-core/fastq_taxonomic_profile_metaphlan/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "fastq_taxonomic_profile_metaphlan"
description: Subworkflow to taxonomically classify metagenomic sequencing data using MetaPhlAn
keywords:
- metaphlan
- metagenomics
- database
- classification
- merge
- profiles
components:
- metaphlan/makedb
- metaphlan/metaphlan
- metaphlan/mergemetaphlantables
input:
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:‘test’, single_end:false ]
- ch_fastq:
type: file
description: |
The input channel containing the FASTQ files
Structure: [ val(meta), path(fastqs) ]
pattern: "*.{fastq/fastq.gz}"
output:
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:‘test’, single_end:false ]
- versions:
type: file
description: |
File containing software versions
Structure: [ path(versions.yml) ]
pattern: "versions.yml"
- txt:
type: file
description: |
Combined MetaPhlAn table
Structure: [ val(meta), path(txt) ]
pattern: "*.txt"

authors:
- "@LaurenGonsalves"
- "@hhayden01"
- "@ErikLHendrickson"
- "@CarsonJM"
maintainers:
- "@LaurenGonsalves"
- "@CarsonJM"
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// nf-core subworkflows test fastq_taxonomic_profile_metaphlan
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
nextflow_workflow {

name "Test Subworkflow FASTQ_TAXONOMIC_PROFILE_METAPHLAN"
script "../main.nf"
workflow "FASTQ_TAXONOMIC_PROFILE_METAPHLAN"
config "./nextflow.config"

tag "subworkflows"
tag "subworkflows_nfcore"
tag "subworkflows/fastq_taxonomic_profile_metaphlan"
tag "metaphlan/makedb"
tag "metaphlan/metaphlan"
tag "metaphlan3/mergemetaphlantables"


test("sarscov2 - fastq - paired_end") {

when {
workflow {
"""
// TODO nf-core: define inputs of the workflow here.
LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
input[0] = Channel.of (
[
[ id:'test1', 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)
]
],
[
[ id:'test2', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true)
]
]
)


LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
"""
}
}

then {
assertAll(
{ assert workflow.success},
{ assert snapshot(workflow.out).match()}
//TODO nf-core: Add all required assertions to verify the test output.
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
process {

maxulysse marked this conversation as resolved.
Show resolved Hide resolved
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
withName: METAPHLAN_MAKEDB {
ext.args = '--index mpa_vJan21_TOY_CHOCOPhlAnSGB_202103'
}

LaurenGonsalves marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
subworkflows/fastq_taxonomic_profile_metaphlan:
- subworkflows/nf-core/fastq_taxonomic_profile_metaphlan/**
Loading