nf-core_modules/modules/maxbin2/main.nf
James A. Fellows Yates bd2baa1e7c
New module: maxbin2 (#895)
* Specify more guidelines on input channels

* Linting

* Updates based on code review

* Update README.md

* Fix broken sentence

* feat: add megahit module, currently decompressed output

* Update main.nf

* Update tests/modules/megahit/test.yml

Co-authored-by: Maxime Borry <maxibor@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* feat: compress all outputs, remove md5sums due to gz stochasicity

* fix: wrong conda channel for pigz

* fix: broken singleend tests and update meta.yml

* Missed one

* Apply suggestions from code review

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* fix: pigz formatting

* Apply suggestions from code review

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Apply suggestions from code review

* Added, just need to finish tests once we have bacterial data

* Add prelim test data

* Fix version reporting

* Add tests based on proposed test-dataset

* Finalise new testdata

* Fix md5sum issue by removing it...

* Update main.nf

* Apply suggestions from code review

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
Co-authored-by: Maxime Borry <maxibor@users.noreply.github.com>
2021-10-26 22:07:33 +01:00

53 lines
2 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process MAXBIN2 {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::maxbin2=2.2.7" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/maxbin2:2.2.7--he1b5a44_2"
} else {
container "quay.io/biocontainers/maxbin2:2.2.7--he1b5a44_2"
}
input:
tuple val(meta), path(contigs), path(reads), path(abund)
output:
tuple val(meta), path("*.fasta.gz") , emit: binned_fastas
tuple val(meta), path("*.summary") , emit: summary
tuple val(meta), path("*.log.gz") , emit: log
tuple val(meta), path("*.marker.gz") , emit: marker_counts
tuple val(meta), path("*.noclass.gz") , emit: unbinned_fasta
tuple val(meta), path("*.tooshort.gz"), emit: tooshort_fasta
tuple val(meta), path("*_bin.tar.gz") , emit: marker_bins , optional: true
tuple val(meta), path("*_gene.tar.gz"), emit: marker_genes, optional: true
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def associate_files = reads ? "-reads $reads" : "-abund $abund"
"""
run_MaxBin.pl \\
-contig $contigs \\
$associate_files \\
-thread $task.cpus \\
$options.args \\
-out $prefix
gzip *.fasta *.noclass *.tooshort *log *.marker
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
maxbin2: \$( run_MaxBin.pl -v | head -n 1 | sed 's/MaxBin //' )
END_VERSIONS
"""
}