diff --git a/software/quast/quast_noref/functions.nf b/software/quast/functions.nf similarity index 100% rename from software/quast/quast_noref/functions.nf rename to software/quast/functions.nf diff --git a/software/quast/quast_ref/main.nf b/software/quast/main.nf similarity index 82% rename from software/quast/quast_ref/main.nf rename to software/quast/main.nf index 0a811445..3690c08b 100644 --- a/software/quast/quast_ref/main.nf +++ b/software/quast/main.nf @@ -21,7 +21,9 @@ process QUAST { input: path consensus path fasta + val use_fasta path gff + val use_gff output: path "${prefix}" , emit: results @@ -29,14 +31,15 @@ process QUAST { path '*.version.txt', emit: version script: - def software = getSoftwareName(task.process) - prefix = options.suffix ?: software - def features = params.gff ? "--features $gff" : '' + def software = getSoftwareName(task.process) + prefix = options.suffix ?: software + def features = use_gff ? "--features $gff" : '' + def reference = use_fasta ? "-r $fasta" : '' """ quast.py \\ --output-dir $prefix \\ - -r $fasta \\ - $features \\ + ${reference} \\ + ${features} \\ --threads $task.cpus \\ $options.args \\ ${consensus.join(' ')} diff --git a/software/quast/quast_ref/meta.yml b/software/quast/meta.yml similarity index 80% rename from software/quast/quast_ref/meta.yml rename to software/quast/meta.yml index 03526be7..ae63de65 100644 --- a/software/quast/quast_ref/meta.yml +++ b/software/quast/meta.yml @@ -1,4 +1,4 @@ -name: quast_reference +name: quast description: Quality Assessment Tool for Genome Assemblies keywords: - quast @@ -40,10 +40,16 @@ input: - fasta: type: file description: | - The genome assembly to be evaluated + The genome assembly to be evaluated. Has to contain at least a non-empty string dummy value. + - use_fasta: + type: boolean + description: Whether to use a fasta reference - gff: type: file - description: The genome GFF file + description: The genome GFF file. Has to contain at least a non-empty string dummy value. + - use_gff: + type: boolean + description: Whether to use a gff reference output: - quast: diff --git a/software/quast/quast_noref/main.nf b/software/quast/quast_noref/main.nf deleted file mode 100644 index 2ad9ac79..00000000 --- a/software/quast/quast_noref/main.nf +++ /dev/null @@ -1,41 +0,0 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process QUAST { - tag "$fasta" - label 'process_medium' - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - - conda (params.enable_conda ? 'bioconda::quast=5.0.2' : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container 'https://depot.galaxyproject.org/singularity/quast:5.0.2--py37pl526hb5aa323_2' - } else { - container 'quay.io/biocontainers/quast:5.0.2--py37pl526hb5aa323_2' - } - - input: - path consensus - - output: - path "${prefix}" , emit: results - path '*.tsv' , emit: tsv - path '*.version.txt', emit: version - - script: - def software = getSoftwareName(task.process) - prefix = options.suffix ?: software - """ - quast.py \\ - --output-dir $prefix \\ - --threads $task.cpus \\ - $options.args \\ - $consensus - ln -s ${prefix}/report.tsv - echo \$(quast.py --version 2>&1) | sed 's/^.*QUAST v//; s/ .*\$//' > ${software}.version.txt - """ -} diff --git a/software/quast/quast_noref/meta.yml b/software/quast/quast_noref/meta.yml deleted file mode 100644 index 8f758b10..00000000 --- a/software/quast/quast_noref/meta.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: quast -description: Quality Assessment Tool for Genome Assemblies -keywords: - - quast - - assembly - - quality -tools: - - quast: - description: | - QUAST calculates quality metrics for genome assemblies - homepage: http://bioinf.spbau.ru/quast - doi: -params: - - outdir: - type: string - description: | - The pipeline's output directory. By default, the module will - output files into `$params.outdir/` - - publish_dir_mode: - type: string - description: | - Value for the Nextflow `publishDir` mode parameter. - Available: symlink, rellink, link, copy, copyNoFollow, move. - - enable_conda: - type: boolean - description: | - Run the module with Conda using the software specified - via the `conda` directive - - singularity_pull_docker_container: - type: boolean - description: | - Instead of directly downloading Singularity images for use with Singularity, - force the workflow to pull and convert Docker containers instead. - -input: - - consensus: - type: file - description: | - Fasta file containing the assembly of interest - -output: - - results: - type: file - description: The lineage report - pattern: "{prefix}.lineage_report.csv" - - tsv: - - - version: - type: file - description: File containing software version - pattern: "*.{version.txt}" - -authors: - - "@drpatelh" - - "@kevinmenden" diff --git a/software/quast/quast_ref/functions.nf b/software/quast/quast_ref/functions.nf deleted file mode 100644 index d25eea86..00000000 --- a/software/quast/quast_ref/functions.nf +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ----------------------------------------------------- - * 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.publish_by_id = args.publish_by_id ?: false - 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_id) { - path_list.add(args.publish_id) - } - 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" - } - } -} diff --git a/tests/software/quast/main.nf b/tests/software/quast/main.nf index 366b0c90..7ef3d9ac 100644 --- a/tests/software/quast/main.nf +++ b/tests/software/quast/main.nf @@ -2,19 +2,24 @@ nextflow.enable.dsl = 2 -include { QUAST as QUAST_NOREF } from '../../../software/quast/quast_noref/main.nf' addParams(options: [:]) -include { QUAST as QUAST_REF } from '../../../software/quast/quast_ref/main.nf' addParams(options: [:]) - -workflow test_quast_noref { - consensus = file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_genomic.fna", checkIfExists: true) - - QUAST_NOREF( consensus ) -} +include { QUAST } from '../../../software/quast/main.nf' addParams(options: [:]) workflow test_quast_ref { consensus = file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_cds_from_genomic.fna", checkIfExists: true) gff = file("${launchDir}/tests/data/gff/sarscov2/GCA_011545545.1_ASM1154554v1_genomic.gtf", checkIfExists: true) fasta = file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_genomic.fna", checkIfExists: true) + def use_fasta = true + def use_gtf = true - QUAST_REF( consensus, fasta, gff ) + QUAST( consensus, fasta, use_fasta, gff, use_gtf) +} + +workflow test_quast_noref { + consensus = file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_cds_from_genomic.fna", checkIfExists: true) + gff = file('gff_dummy') + fasta = file('fasta_dummy') + def use_fasta = false + def use_gtf = false + + QUAST( consensus, fasta, use_fasta, gff, use_gtf) }