mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2025-01-02 20:52:07 -05:00
refactored quast module
This commit is contained in:
parent
956bf22a58
commit
b5298f94d8
7 changed files with 31 additions and 172 deletions
|
@ -21,7 +21,9 @@ process QUAST {
|
||||||
input:
|
input:
|
||||||
path consensus
|
path consensus
|
||||||
path fasta
|
path fasta
|
||||||
|
val use_fasta
|
||||||
path gff
|
path gff
|
||||||
|
val use_gff
|
||||||
|
|
||||||
output:
|
output:
|
||||||
path "${prefix}" , emit: results
|
path "${prefix}" , emit: results
|
||||||
|
@ -29,14 +31,15 @@ process QUAST {
|
||||||
path '*.version.txt', emit: version
|
path '*.version.txt', emit: version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
prefix = options.suffix ?: software
|
prefix = options.suffix ?: software
|
||||||
def features = params.gff ? "--features $gff" : ''
|
def features = use_gff ? "--features $gff" : ''
|
||||||
|
def reference = use_fasta ? "-r $fasta" : ''
|
||||||
"""
|
"""
|
||||||
quast.py \\
|
quast.py \\
|
||||||
--output-dir $prefix \\
|
--output-dir $prefix \\
|
||||||
-r $fasta \\
|
${reference} \\
|
||||||
$features \\
|
${features} \\
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
${consensus.join(' ')}
|
${consensus.join(' ')}
|
|
@ -1,4 +1,4 @@
|
||||||
name: quast_reference
|
name: quast
|
||||||
description: Quality Assessment Tool for Genome Assemblies
|
description: Quality Assessment Tool for Genome Assemblies
|
||||||
keywords:
|
keywords:
|
||||||
- quast
|
- quast
|
||||||
|
@ -40,10 +40,16 @@ input:
|
||||||
- fasta:
|
- fasta:
|
||||||
type: file
|
type: file
|
||||||
description: |
|
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:
|
- gff:
|
||||||
type: file
|
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:
|
output:
|
||||||
- quast:
|
- quast:
|
|
@ -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
|
|
||||||
"""
|
|
||||||
}
|
|
|
@ -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/<SOFTWARE>`
|
|
||||||
- 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"
|
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,19 +2,24 @@
|
||||||
|
|
||||||
nextflow.enable.dsl = 2
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
include { QUAST as QUAST_NOREF } from '../../../software/quast/quast_noref/main.nf' addParams(options: [:])
|
include { QUAST } from '../../../software/quast/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 )
|
|
||||||
}
|
|
||||||
|
|
||||||
workflow test_quast_ref {
|
workflow test_quast_ref {
|
||||||
consensus = file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_cds_from_genomic.fna", checkIfExists: true)
|
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)
|
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)
|
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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue