1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-26 07:49:54 +00:00

Merge pull request #136 from nf-core/metaphlan3/mergemetaphlantables

Add MetaPhlAn3 per-database multi-sample taxon tables
This commit is contained in:
James A. Fellows Yates 2022-09-19 13:45:50 +02:00 committed by GitHub
commit 187946ec80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 115 additions and 9 deletions

View file

@ -336,7 +336,7 @@ process {
] ]
} }
withName: METAPHLAN3 { withName: METAPHLAN3_METAPHLAN3 {
ext.args = { "${meta.db_params}" } ext.args = { "${meta.db_params}" }
ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" } ext.prefix = params.perform_runmerging ? { "${meta.id}-${meta.db_name}" } : { "${meta.id}-${meta.run_accession}-${meta.db_name}" }
publishDir = [ publishDir = [
@ -346,6 +346,15 @@ process {
] ]
} }
withName: METAPHLAN3_MERGEMETAPHLANTABLES {
ext.prefix = { "metaphlan3_${meta.id}_combined_reports" }
publishDir = [
path: { "${params.outdir}/metaphlan3/" },
mode: params.publish_dir_mode,
pattern: '*.{txt}'
]
}
withName: CENTRIFUGE_CENTRIFUGE { withName: CENTRIFUGE_CENTRIFUGE {
publishDir = [ publishDir = [
path: { "${params.outdir}/centrifuge/${meta.db_name}/" }, path: { "${params.outdir}/centrifuge/${meta.db_name}/" },

View file

@ -97,9 +97,13 @@
"branch": "master", "branch": "master",
"git_sha": "2d38566eca4cc15142b2ffa7c11837569b39aece" "git_sha": "2d38566eca4cc15142b2ffa7c11837569b39aece"
}, },
"metaphlan3/mergemetaphlantables": {
"branch": "master",
"git_sha": "36bcd675ae76a379a38165898a203f4915823f4f"
},
"metaphlan3/metaphlan3": { "metaphlan3/metaphlan3": {
"branch": "master", "branch": "master",
"git_sha": "940d7fe9d63962e0e2ba0987e2893fb0aff832e3" "git_sha": "978087354eb72ac1f6e18a3f790fad9bc4d05840"
}, },
"minimap2/align": { "minimap2/align": {
"branch": "master", "branch": "master",

View file

@ -0,0 +1,33 @@
process METAPHLAN3_MERGEMETAPHLANTABLES {
label 'process_single'
conda (params.enable_conda ? 'bioconda::metaphlan=3.0.12' : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/metaphlan:3.0.12--pyhb7b1952_0' :
'quay.io/biocontainers/metaphlan:3.0.12--pyhb7b1952_0' }"
input:
tuple val(meta), path(profiles)
output:
tuple val(meta), path("${prefix}.txt") , emit: txt
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}"
"""
merge_metaphlan_tables.py \\
$args \\
-o ${prefix}.txt \\
${profiles}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
metaphlan3: \$(metaphlan --version 2>&1 | awk '{print \$3}')
END_VERSIONS
"""
}

View file

@ -0,0 +1,44 @@
name: "metaphlan3_mergemetaphlantables"
description: Merges output abundance tables from MetaPhlAn3
keywords:
- metagenomics
- classification
- merge
- table
- profiles
tools:
- metaphlan3:
description: Identify clades (phyla to species) present in the metagenome obtained from a microbiome sample and their relative abundance
homepage: https://huttenhower.sph.harvard.edu/metaphlan/
documentation: https://github.com/biobakery/MetaPhlAn
doi: "10.7554/eLife.65088"
licence: ["MIT License"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- profiles:
type: file
description: List of per-sample MetaPhlAn3 taxonomic abundance tables
pattern: "*"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- txt:
type: txt
description: Combined MetaPhlAn3 table
pattern: "*.txt"
authors:
- "@jfy133"

View file

@ -1,4 +1,4 @@
process METAPHLAN3 { process METAPHLAN3_METAPHLAN3 {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'

View file

@ -1,4 +1,4 @@
name: metaphlan3 name: metaphlan3_metaphlan3
description: MetaPhlAn is a tool for profiling the composition of microbial communities from metagenomic shotgun sequencing data. description: MetaPhlAn is a tool for profiling the composition of microbial communities from metagenomic shotgun sequencing data.
keywords: keywords:
- metagenomics - metagenomics

View file

@ -7,7 +7,7 @@ include { MEGAN_RMA2INFO as MEGAN_RMA2INFO_TSV } from '../../modules/nf-core/mo
include { KRAKEN2_KRAKEN2 } from '../../modules/nf-core/modules/kraken2/kraken2/main' include { KRAKEN2_KRAKEN2 } from '../../modules/nf-core/modules/kraken2/kraken2/main'
include { CENTRIFUGE_CENTRIFUGE } from '../../modules/nf-core/modules/centrifuge/centrifuge/main' include { CENTRIFUGE_CENTRIFUGE } from '../../modules/nf-core/modules/centrifuge/centrifuge/main'
include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main' include { CENTRIFUGE_KREPORT } from '../../modules/nf-core/modules/centrifuge/kreport/main'
include { METAPHLAN3 } from '../../modules/nf-core/modules/metaphlan3/metaphlan3/main' include { METAPHLAN3_METAPHLAN3 } from '../../modules/nf-core/modules/metaphlan3/metaphlan3/main'
include { KAIJU_KAIJU } from '../../modules/nf-core/modules/kaiju/kaiju/main' include { KAIJU_KAIJU } from '../../modules/nf-core/modules/kaiju/kaiju/main'
include { DIAMOND_BLASTX } from '../../modules/nf-core/modules/diamond/blastx/main' include { DIAMOND_BLASTX } from '../../modules/nf-core/modules/diamond/blastx/main'
include { MOTUS_PROFILE } from '../../modules/nf-core/modules/motus/profile/main' include { MOTUS_PROFILE } from '../../modules/nf-core/modules/motus/profile/main'
@ -168,9 +168,9 @@ workflow PROFILING {
db: it[3] db: it[3]
} }
METAPHLAN3 ( ch_input_for_metaphlan3.reads, ch_input_for_metaphlan3.db ) METAPHLAN3_METAPHLAN3 ( ch_input_for_metaphlan3.reads, ch_input_for_metaphlan3.db )
ch_versions = ch_versions.mix( METAPHLAN3.out.versions.first() ) ch_versions = ch_versions.mix( METAPHLAN3_METAPHLAN3.out.versions.first() )
ch_raw_profiles = ch_raw_profiles.mix( METAPHLAN3.out.biom ) ch_raw_profiles = ch_raw_profiles.mix( METAPHLAN3_METAPHLAN3.out.profile )
} }

View file

@ -2,9 +2,10 @@
// Standardise output files e.g. aggregation // Standardise output files e.g. aggregation
// //
include { KRAKENTOOLS_COMBINEKREPORTS as KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE } from '../../modules/nf-core/modules/krakentools/combinekreports/main'
include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main' include { KAIJU_KAIJU2TABLE } from '../../modules/nf-core/modules/kaiju/kaiju2table/main'
include { KRAKENTOOLS_COMBINEKREPORTS } from '../../modules/nf-core/modules/krakentools/combinekreports/main' include { KRAKENTOOLS_COMBINEKREPORTS } from '../../modules/nf-core/modules/krakentools/combinekreports/main'
include { KRAKENTOOLS_COMBINEKREPORTS as KRAKENTOOLS_COMBINEKREPORTS_CENTRIFUGE } from '../../modules/nf-core/modules/krakentools/combinekreports/main'
include { METAPHLAN3_MERGEMETAPHLANTABLES } from '../../modules/nf-core/modules/metaphlan3/mergemetaphlantables/main'
include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main' include { MOTUS_MERGE } from '../../modules/nf-core/modules/motus/merge/main'
workflow STANDARDISATION_PROFILES { workflow STANDARDISATION_PROFILES {
@ -27,6 +28,7 @@ workflow STANDARDISATION_PROFILES {
motus: it[0]['tool'] == 'motus' motus: it[0]['tool'] == 'motus'
kraken2: it[0]['tool'] == 'kraken2' kraken2: it[0]['tool'] == 'kraken2'
centrifuge: it[0]['tool'] == 'centrifuge' centrifuge: it[0]['tool'] == 'centrifuge'
metaphlan3: it[0]['tool'] == 'metaphlan3'
unknown: true unknown: true
} }
@ -96,6 +98,20 @@ workflow STANDARDISATION_PROFILES {
ch_multiqc_files = ch_multiqc_files.mix( KRAKENTOOLS_COMBINEKREPORTS.out.txt ) ch_multiqc_files = ch_multiqc_files.mix( KRAKENTOOLS_COMBINEKREPORTS.out.txt )
ch_versions = ch_versions.mix( KRAKENTOOLS_COMBINEKREPORTS.out.versions ) ch_versions = ch_versions.mix( KRAKENTOOLS_COMBINEKREPORTS.out.versions )
// MetaPhlAn3
ch_profiles_for_metaphlan3 = ch_input_profiles.metaphlan3
.map { [it[0]['db_name'], it[1]] }
.groupTuple()
.map {
[[id:it[0]], it[1]]
}
METAPHLAN3_MERGEMETAPHLANTABLES ( ch_profiles_for_metaphlan3 )
ch_standardised_tables = ch_standardised_tables.mix( METAPHLAN3_MERGEMETAPHLANTABLES.out.txt )
ch_multiqc_files = ch_multiqc_files.mix( METAPHLAN3_MERGEMETAPHLANTABLES.out.txt )
ch_versions = ch_versions.mix( METAPHLAN3_MERGEMETAPHLANTABLES.out.versions )
// mOTUs // mOTUs
// mOTUs has a 'single' database, and cannot create custom ones. // mOTUs has a 'single' database, and cannot create custom ones.