mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
module: MALT/BUILD (#645)
* Specify more guidelines on input channels * Linting * Updates based on code review * Update README.md * Fix broken sentence * Start MALT-build * Start MALT build (missing meta files and outputs specS) * Local tests * Correct test map_type * Finished module, just waiting for UNZIP module to finalise tests * Correct tests in preparation for Unzip * Ouptut log file too * Update meta.yml * Rename log file * Rename log file * Remove debugging stuff * Add Unzip module * Linting update * Linting update * Fix input db * Fix db file in cmd * Update modules/malt/build/main.nf * Update modules/malt/build/main.nf * Update main.nf
This commit is contained in:
parent
4f1c1601cf
commit
6913da9d2d
8 changed files with 261 additions and 0 deletions
|
@ -7,3 +7,4 @@ bump-versions:
|
|||
rseqc/inferexperiment: False
|
||||
rseqc/innerdistance: False
|
||||
sortmerna: False
|
||||
malt/build: False
|
||||
|
|
68
modules/malt/build/functions.nf
Normal file
68
modules/malt/build/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||
//
|
||||
def initOptions(Map args) {
|
||||
def Map options = [:]
|
||||
options.args = args.args ?: ''
|
||||
options.args2 = args.args2 ?: ''
|
||||
options.args3 = args.args3 ?: ''
|
||||
options.publish_by_meta = args.publish_by_meta ?: []
|
||||
options.publish_dir = args.publish_dir ?: ''
|
||||
options.publish_files = args.publish_files
|
||||
options.suffix = args.suffix ?: ''
|
||||
return options
|
||||
}
|
||||
|
||||
//
|
||||
// Tidy up and join elements of a list to return a path string
|
||||
//
|
||||
def getPathFromList(path_list) {
|
||||
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||
return paths.join('/')
|
||||
}
|
||||
|
||||
//
|
||||
// Function to save/publish module results
|
||||
//
|
||||
def saveFiles(Map args) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
if (ioptions.publish_by_meta) {
|
||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||
for (key in key_list) {
|
||||
if (args.meta && key instanceof String) {
|
||||
def path = key
|
||||
if (args.meta.containsKey(key)) {
|
||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
||||
}
|
||||
path = path instanceof String ? path : ''
|
||||
path_list.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ioptions.publish_files instanceof Map) {
|
||||
for (ext in ioptions.publish_files) {
|
||||
if (args.filename.endsWith(ext.key)) {
|
||||
def ext_list = path_list.collect()
|
||||
ext_list.add(ext.value)
|
||||
return "${getPathFromList(ext_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
} else if (ioptions.publish_files == null) {
|
||||
return "${getPathFromList(path_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
}
|
58
modules/malt/build/main.nf
Normal file
58
modules/malt/build/main.nf
Normal file
|
@ -0,0 +1,58 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process MALT_BUILD {
|
||||
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||
|
||||
// Do not **auto-bump** due to problem with change of version numbering between 0.4.1 and 0.5.2
|
||||
// (originally 0.4.1 was listed as 0.41, so is always selected as 'latest' even though it is not!)
|
||||
conda (params.enable_conda ? "bioconda::malt=0.5.2" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/malt:0.5.2--0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/malt:0.5.2--0"
|
||||
}
|
||||
|
||||
input:
|
||||
path fastas
|
||||
val seq_type
|
||||
path gff
|
||||
path map_db
|
||||
|
||||
output:
|
||||
path "malt_index/" , emit: index
|
||||
path "*.version.txt" , emit: version
|
||||
path "malt-build.log", emit: log
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def avail_mem = 6
|
||||
if (!task.memory) {
|
||||
log.info '[MALT_BUILD] Available memory not known - defaulting to 6GB. Specify process memory requirements to change this.'
|
||||
} else {
|
||||
avail_mem = task.memory.giga
|
||||
}
|
||||
def igff = gff ? "-igff ${gff}" : ""
|
||||
|
||||
"""
|
||||
malt-build \\
|
||||
-J-Xmx${avail_mem}g \\
|
||||
-v \\
|
||||
--input ${fastas.join(' ')} \\
|
||||
-s $seq_type \\
|
||||
$igff \\
|
||||
-d 'malt_index/' \\
|
||||
-t ${task.cpus} \\
|
||||
$options.args \\
|
||||
-mdb ${map_db}/*.db |&tee malt-build.log
|
||||
|
||||
malt-build --help |& tail -n 3 | head -n 1 | cut -f 2 -d'(' | cut -f 1 -d ',' | cut -d ' ' -f 2 > ${software}.version.txt
|
||||
"""
|
||||
}
|
55
modules/malt/build/meta.yml
Normal file
55
modules/malt/build/meta.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
name: malt_build
|
||||
description: MALT, an acronym for MEGAN alignment tool, is a sequence alignment and analysis tool designed for processing high-throughput sequencing data, especially in the context of metagenomics.
|
||||
keywords:
|
||||
- malt
|
||||
- alignment
|
||||
- metagenomics
|
||||
- ancient DNA
|
||||
- aDNA
|
||||
- palaeogenomics
|
||||
- archaeogenomics
|
||||
- microbiome
|
||||
- database
|
||||
tools:
|
||||
- malt:
|
||||
description: A tool for mapping metagenomic data
|
||||
homepage: https://www.wsi.uni-tuebingen.de/lehrstuehle/algorithms-in-bioinformatics/software/malt/
|
||||
documentation: https://software-ab.informatik.uni-tuebingen.de/download/malt/manual.pdf
|
||||
tool_dev_url: None
|
||||
doi: "10.1038/s41559-017-0446-6"
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- fastas:
|
||||
type: file
|
||||
description: Directory of, or FASTA reference files for indexing
|
||||
pattern: "*/|*.fasta"
|
||||
- seq_type:
|
||||
type: string
|
||||
description: Type of input data
|
||||
pattern: "DNA|Protein"
|
||||
- gff:
|
||||
type: file
|
||||
description: Directory of, or GFF3 files of input FASTA files
|
||||
pattern: "*/|*.gff|*.gff3"
|
||||
- map_db:
|
||||
type: file
|
||||
description: MEGAN .db file from https://software-ab.informatik.uni-tuebingen.de/download/megan6/welcome.html
|
||||
pattern:
|
||||
|
||||
output:
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
- index:
|
||||
type: directory
|
||||
description: Directory containing MALT database index directory
|
||||
pattern: "malt_index/"
|
||||
- log:
|
||||
type: file
|
||||
description: Log file from STD out of malt-build
|
||||
pattern: "malt-build.log"
|
||||
|
||||
authors:
|
||||
- "@jfy133"
|
|
@ -474,6 +474,10 @@ lofreq/indelqual:
|
|||
- modules/lofreq/indelqual/**
|
||||
- tests/modules/lofreq/indelqual/**
|
||||
|
||||
malt/build:
|
||||
- modules/malt/build/**
|
||||
- tests/modules/malt/build_test/**
|
||||
|
||||
mash/sketch:
|
||||
- modules/mash/sketch/**
|
||||
- tests/modules/mash/sketch/**
|
||||
|
|
1
tests/modules/malt/build
Symbolic link
1
tests/modules/malt/build
Symbolic link
|
@ -0,0 +1 @@
|
|||
build_test/
|
26
tests/modules/malt/build_test/main.nf
Normal file
26
tests/modules/malt/build_test/main.nf
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { UNZIP } from '../../../../modules/unzip/main.nf' addParams( options: [:] )
|
||||
include { MALT_BUILD } from '../../../../modules/malt/build/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_malt_build {
|
||||
fastas = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
seq_type = "DNA"
|
||||
gff = []
|
||||
map_db = file("https://software-ab.informatik.uni-tuebingen.de/download/megan6/megan-nucl-Jan2021.db.zip", checkIfExists: true)
|
||||
|
||||
UNZIP ( map_db )
|
||||
MALT_BUILD ( fastas, seq_type, gff, UNZIP.out.unzipped_archive )
|
||||
}
|
||||
|
||||
workflow test_malt_build_gff {
|
||||
fastas = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||
seq_type = "DNA"
|
||||
gff = file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true)
|
||||
map_db = file("https://software-ab.informatik.uni-tuebingen.de/download/megan6/megan-nucl-Jan2021.db.zip", checkIfExists: true)
|
||||
|
||||
UNZIP ( map_db )
|
||||
MALT_BUILD ( fastas, seq_type, gff, UNZIP.out.unzipped_archive )
|
||||
}
|
48
tests/modules/malt/build_test/test.yml
Normal file
48
tests/modules/malt/build_test/test.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
- name: malt build
|
||||
command: nextflow run ./tests/modules/malt/build_test -entry test_malt_build -c tests/config/nextflow.config
|
||||
tags:
|
||||
- malt
|
||||
- malt/build
|
||||
files:
|
||||
- path: output/malt/malt_index/index0.idx
|
||||
md5sum: 1954f2c00b418d00112829b0a6adb8ce
|
||||
- path: output/malt/malt_index/ref.db
|
||||
md5sum: 772a09aeb162515485b037604399f2bd
|
||||
- path: output/malt/malt_index/ref.idx
|
||||
md5sum: 7dea362b3fac8e00956a4952a3d4f474
|
||||
- path: output/malt/malt_index/ref.inf
|
||||
md5sum: b146842067cf278ef1d23e6c2e7c0c35
|
||||
- path: output/malt/malt_index/table0.db
|
||||
- path: output/malt/malt_index/table0.idx
|
||||
- path: output/malt/malt_index/taxonomy.idx
|
||||
md5sum: bb335e7c378a5bd85761b6eeed16d984
|
||||
- path: output/malt/malt_index/taxonomy.map
|
||||
md5sum: ae2ea08b2119eba932a9cbcd9e634917
|
||||
- path: output/malt/malt_index/taxonomy.tre
|
||||
md5sum: 511ec8ff4fd8aaa20d59b5a91ed4e852
|
||||
- name: malt build gff
|
||||
command: nextflow run ./tests/modules/malt/build_test -entry test_malt_build_gff -c tests/config/nextflow.config
|
||||
tags:
|
||||
- malt
|
||||
- malt/build
|
||||
files:
|
||||
- path: output/malt/malt_index/aadd.dbx
|
||||
md5sum: 4e2ed57e713d5372bd09350f447cdf53
|
||||
- path: output/malt/malt_index/aadd.idx
|
||||
md5sum: 0994061bc8673ebd283fa6546c3dd12c
|
||||
- path: output/malt/malt_index/index0.idx
|
||||
md5sum: 1954f2c00b418d00112829b0a6adb8ce
|
||||
- path: output/malt/malt_index/ref.db
|
||||
md5sum: 772a09aeb162515485b037604399f2bd
|
||||
- path: output/malt/malt_index/ref.idx
|
||||
md5sum: 7dea362b3fac8e00956a4952a3d4f474
|
||||
- path: output/malt/malt_index/ref.inf
|
||||
md5sum: b146842067cf278ef1d23e6c2e7c0c35
|
||||
- path: output/malt/malt_index/table0.db
|
||||
- path: output/malt/malt_index/table0.idx
|
||||
- path: output/malt/malt_index/taxonomy.idx
|
||||
md5sum: bb335e7c378a5bd85761b6eeed16d984
|
||||
- path: output/malt/malt_index/taxonomy.map
|
||||
md5sum: ae2ea08b2119eba932a9cbcd9e634917
|
||||
- path: output/malt/malt_index/taxonomy.tre
|
||||
md5sum: 511ec8ff4fd8aaa20d59b5a91ed4e852
|
Loading…
Reference in a new issue