mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Add MOTUS/MERGE (#1734)
* Add motus/merge module, missing test yml * Fix prefix * Fix polymersase * Update test meta.yml * Try new version system * Typo fix * Clairfy docs for the version file * Switch to directory auto detection * Now with the change and not just meta * Remove now unneeded input parameter from test * Fix input type check * Try adding db requirement to fix docker issue * Update modules/motus/merge/main.nf * Fix input * Apply suggestions from code review * Fix md5sums * Replace debugging db location with actual * Fix contains due to further varialbility * Indenting
This commit is contained in:
parent
43d05d5482
commit
b02e648c22
8 changed files with 156 additions and 2 deletions
|
@ -33,7 +33,7 @@ process MOTUS_DOWNLOADDB {
|
||||||
## mOTUs will check the database version is same version as exec version.
|
## mOTUs will check the database version is same version as exec version.
|
||||||
cat <<-END_VERSIONS > versions.yml
|
cat <<-END_VERSIONS > versions.yml
|
||||||
"${task.process}":
|
"${task.process}":
|
||||||
mOTUs: \$(grep motus db_mOTU/db_mOTU_versions | sed 's/motus\\t//g')
|
motus: \$(grep motus db_mOTU/db_mOTU_versions | sed 's/motus\\t//g')
|
||||||
END_VERSIONS
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
47
modules/motus/merge/main.nf
Normal file
47
modules/motus/merge/main.nf
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
VERSION = '3.0.1'
|
||||||
|
|
||||||
|
process MOTUS_MERGE {
|
||||||
|
label 'process_low'
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::motus=3.0.1" : null)
|
||||||
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||||
|
'https://depot.galaxyproject.org/singularity/motus:3.0.1--pyhdfd78af_0':
|
||||||
|
'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }"
|
||||||
|
|
||||||
|
input:
|
||||||
|
path input
|
||||||
|
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'
|
||||||
|
val biom_format
|
||||||
|
|
||||||
|
output:
|
||||||
|
path("*.txt") , optional: true, emit: txt
|
||||||
|
path("*.biom"), optional: true, emit: biom
|
||||||
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
|
when:
|
||||||
|
task.ext.when == null || task.ext.when
|
||||||
|
|
||||||
|
script:
|
||||||
|
def args = task.ext.args ?: ''
|
||||||
|
def prefix = 'motus_merged'
|
||||||
|
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"
|
||||||
|
"""
|
||||||
|
motus \\
|
||||||
|
merge \\
|
||||||
|
-db $db \\
|
||||||
|
${cmd_input} \\
|
||||||
|
$args \\
|
||||||
|
${output}
|
||||||
|
|
||||||
|
## Take version from the mOTUs/profile module output, as cannot reconstruct
|
||||||
|
## version without having database staged in this directory.
|
||||||
|
VERSION=\$(cat ${profile_version_yml} | grep '/*motus:.*' | sed 's/.*otus: //g')
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
motus: \$VERSION
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
57
modules/motus/merge/meta.yml
Normal file
57
modules/motus/merge/meta.yml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
name: "motus_merge"
|
||||||
|
description: Taxonomic meta-omics profiling using universal marker genes
|
||||||
|
keywords:
|
||||||
|
- classify
|
||||||
|
- metagenomics
|
||||||
|
- fastq
|
||||||
|
- taxonomic profiling
|
||||||
|
- merging
|
||||||
|
- merge
|
||||||
|
- otu table
|
||||||
|
tools:
|
||||||
|
- "motus":
|
||||||
|
description: "Marker gene-based OTU (mOTU) profiling"
|
||||||
|
homepage: "https://motu-tool.org/"
|
||||||
|
documentation: "https://github.com/motu-tool/mOTUs/wiki"
|
||||||
|
tool_dev_url: "https://github.com/motu-tool/mOTUs"
|
||||||
|
doi: "10.1038/s41467-019-08844-4"
|
||||||
|
licence: "['GPL v3']"
|
||||||
|
|
||||||
|
input:
|
||||||
|
- input:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
List of output files (more than one) from motus profile,
|
||||||
|
or a single directory containing motus output files.
|
||||||
|
- db:
|
||||||
|
type: directory
|
||||||
|
description: |
|
||||||
|
mOTUs database downloaded by `motus downloadDB`
|
||||||
|
pattern: "db_mOTU/"
|
||||||
|
- profile_version_yml:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
A single versions.yml file output from motus/profile. motus/merge cannot reconstruct
|
||||||
|
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.
|
||||||
|
pattern: "versions.yml"
|
||||||
|
- biom_format:
|
||||||
|
type: boolean
|
||||||
|
description: Whether to save output OTU table in biom format
|
||||||
|
|
||||||
|
output:
|
||||||
|
- versions:
|
||||||
|
type: file
|
||||||
|
description: File containing software versions
|
||||||
|
pattern: "versions.yml"
|
||||||
|
- txt:
|
||||||
|
type: file
|
||||||
|
description: OTU table in txt format, if BIOM format not requested
|
||||||
|
pattern: "*.txt"
|
||||||
|
- biom:
|
||||||
|
type: file
|
||||||
|
description: OTU table in biom format, if BIOM format requested
|
||||||
|
pattern: "*.biom"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@jfy133"
|
|
@ -48,7 +48,7 @@ process MOTUS_PROFILE {
|
||||||
fi
|
fi
|
||||||
cat <<-END_VERSIONS > versions.yml
|
cat <<-END_VERSIONS > versions.yml
|
||||||
"${task.process}":
|
"${task.process}":
|
||||||
mOTUs: \$VERSION
|
motus: \$VERSION
|
||||||
END_VERSIONS
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -1470,6 +1470,10 @@ motus/downloaddb:
|
||||||
- modules/motus/downloaddb/**
|
- modules/motus/downloaddb/**
|
||||||
- tests/modules/motus/downloaddb/**
|
- tests/modules/motus/downloaddb/**
|
||||||
|
|
||||||
|
motus/merge:
|
||||||
|
- modules/motus/merge/**
|
||||||
|
- tests/modules/motus/merge/**
|
||||||
|
|
||||||
motus/profile:
|
motus/profile:
|
||||||
- modules/motus/profile/**
|
- modules/motus/profile/**
|
||||||
- tests/modules/motus/profile/**
|
- tests/modules/motus/profile/**
|
||||||
|
|
29
tests/modules/motus/merge/main.nf
Normal file
29
tests/modules/motus/merge/main.nf
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { MOTUS_DOWNLOADDB } from '../../../../modules/motus/downloaddb/main.nf'
|
||||||
|
include { MOTUS_PROFILE } from '../../../../modules/motus/profile/main.nf'
|
||||||
|
include { MOTUS_MERGE } from '../../../../modules/motus/merge/main.nf'
|
||||||
|
|
||||||
|
workflow test_motus_merge {
|
||||||
|
|
||||||
|
input = Channel.fromList(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
[ id:'test', single_end:true ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[ id:'test2', single_end:true ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
MOTUS_DOWNLOADDB ( file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py') )
|
||||||
|
MOTUS_PROFILE ( input, MOTUS_DOWNLOADDB.out.db )
|
||||||
|
MOTUS_MERGE ( MOTUS_PROFILE.out.out.map{it[1]}.collect(), MOTUS_DOWNLOADDB.out.db, MOTUS_PROFILE.out.versions.first(), false )
|
||||||
|
|
||||||
|
}
|
||||||
|
|
5
tests/modules/motus/merge/nextflow.config
Normal file
5
tests/modules/motus/merge/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
process {
|
||||||
|
|
||||||
|
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||||
|
|
||||||
|
}
|
12
tests/modules/motus/merge/test.yml
Normal file
12
tests/modules/motus/merge/test.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
- name: motus merge test_motus_merge
|
||||||
|
command: nextflow run ./tests/modules/motus/merge -entry test_motus_merge -c ./tests/config/nextflow.config -c ./tests/modules/motus/merge/nextflow.config
|
||||||
|
tags:
|
||||||
|
- motus
|
||||||
|
- motus/merge
|
||||||
|
files:
|
||||||
|
- path: output/motus/motus_merged.txt
|
||||||
|
contains: ["#consensus_taxonomy"]
|
||||||
|
- path: output/motus/test.out
|
||||||
|
contains: ["#consensus_taxonomy"]
|
||||||
|
- path: output/motus/test2.out
|
||||||
|
contains: ["#consensus_taxonomy"]
|
Loading…
Reference in a new issue