1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-23 02:19:54 +00:00

Merge pull request #137 from nf-core/motus-merge-meta

Standardise mOTUs table merge
This commit is contained in:
James A. Fellows Yates 2022-09-16 16:01:38 +02:00 committed by GitHub
commit a2a9f458ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 12 deletions

View file

@ -418,6 +418,8 @@ process {
} }
withName: MOTUS_MERGE { withName: MOTUS_MERGE {
ext.args = { params.generate_biom_output ? "-B" : "" }
ext.prefix = { "motus_${meta.id}_combined_reports" }
publishDir = [ publishDir = [
path: { "${params.outdir}/motus/" }, path: { "${params.outdir}/motus/" },
mode: params.publish_dir_mode mode: params.publish_dir_mode

View file

@ -111,7 +111,7 @@
}, },
"motus/merge": { "motus/merge": {
"branch": "master", "branch": "master",
"git_sha": "b02e648c221e1da17cb589eefe297e61ec9e9c49" "git_sha": "54ff289487244bf15543ecfa62bd4df49be72b73"
}, },
"motus/profile": { "motus/profile": {
"branch": "master", "branch": "master",

View file

@ -1,6 +1,7 @@
VERSION = '3.0.1' VERSION = '3.0.1'
process MOTUS_MERGE { process MOTUS_MERGE {
tag "$meta.id"
label 'process_low' label 'process_low'
conda (params.enable_conda ? "bioconda::motus=3.0.1" : null) conda (params.enable_conda ? "bioconda::motus=3.0.1" : null)
@ -9,14 +10,13 @@ process MOTUS_MERGE {
'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }" 'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }"
input: input:
path input tuple val(meta), path(input)
path db // to stop docker saying it can't find it... would have to have the module in upstream steps anyway path db // to stop docker saying it can't find it... would have to have the module in upstream steps anyway
path profile_version_yml, stageAs: 'profile_version.yml' path profile_version_yml, stageAs: 'profile_version.yml'
val biom_format
output: output:
path("*.txt") , optional: true, emit: txt tuple val(meta), path("*.txt") , optional: true, emit: txt
path("*.biom"), optional: true, emit: biom tuple val(meta), path("*.biom"), optional: true, emit: biom
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
when: when:
@ -24,16 +24,16 @@ process MOTUS_MERGE {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = 'motus_merged' def prefix = task.ext.prefix ?: "${meta.id}"
def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}" def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}"
def output = biom_format ? "-B -o ${prefix}.biom" : "-o ${prefix}.txt" def suffix = task.ext.args?.contains("-B") ? "biom" : "txt"
""" """
motus \\ motus \\
merge \\ merge \\
-db $db \\ -db $db \\
${cmd_input} \\ ${cmd_input} \\
$args \\ $args \\
${output} -o ${prefix}.${suffix}
## Take version from the mOTUs/profile module output, as cannot reconstruct ## Take version from the mOTUs/profile module output, as cannot reconstruct
## version without having database staged in this directory. ## version without having database staged in this directory.

View file

@ -35,9 +35,6 @@ input:
this itself without having the motus database present and configured with the tool this itself without having the motus database present and configured with the tool
so here we take it from what is already reported by the upstream module. so here we take it from what is already reported by the upstream module.
pattern: "versions.yml" pattern: "versions.yml"
- biom_format:
type: boolean
description: Whether to save output OTU table in biom format
output: output:
- versions: - versions:

View file

@ -96,10 +96,21 @@ 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 )
// mOTUs
// mOTUs has a 'single' database, and cannot create custom ones. // mOTUs has a 'single' database, and cannot create custom ones.
// Therefore removing db info here, and publish merged at root mOTUs results // Therefore removing db info here, and publish merged at root mOTUs results
// directory // directory
MOTUS_MERGE ( ch_input_profiles.motus.map{it[1]}.collect(), ch_input_databases.motus.map{it[1]}, motu_version, params.generate_biom_output )
ch_profiles_for_motus = ch_input_profiles.motus
.map { [it[0]['db_name'], it[1]] }
.groupTuple()
.map {
[[id:it[0]], it[1]]
}
MOTUS_MERGE ( ch_profiles_for_motus, ch_input_databases.motus.map{it[1]}, motu_version )
if ( params.generate_biom_output ) { if ( params.generate_biom_output ) {
ch_standardised_tables = ch_standardised_tables.mix ( MOTUS_MERGE.out.biom ) ch_standardised_tables = ch_standardised_tables.mix ( MOTUS_MERGE.out.biom )
} else { } else {