Merge pull request #130 from KevinMenden/master

Adding a QUAST module
This commit is contained in:
Harshil Patel 2021-02-01 13:17:57 +00:00 committed by GitHub
commit e851da8640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 360 additions and 0 deletions

40
.github/workflows/quast.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: quast
on:
push:
paths:
- software/quast/**
- .github/workflows/quast.yml
- tests
pull_request:
paths:
- software/pquast/**
- .github/workflows/quest.yml
- tests
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag quast --symlink --wt 2

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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"
}
}
}

48
software/quast/main.nf Normal file
View file

@ -0,0 +1,48 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process QUAST {
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
path fasta
path gff
val use_fasta
val use_gff
output:
path "${prefix}" , emit: results
path '*.tsv' , emit: tsv
path '*.version.txt', emit: version
script:
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 \\
$reference \\
$features \\
--threads $task.cpus \\
$options.args \\
${consensus.join(' ')}
ln -s ${prefix}/report.tsv
echo \$(quast.py --version 2>&1) | sed 's/^.*QUAST v//; s/ .*\$//' > ${software}.version.txt
"""
}

68
software/quast/meta.yml Normal file
View file

@ -0,0 +1,68 @@
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
- fasta:
type: file
description: |
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 the provided fasta reference genome file
- gff:
type: 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 the provided gff reference annotation file
output:
- quast:
type: directory
description: Directory containing complete quast report
pattern: "{prefix}.lineage_report.csv"
- report:
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@drpatelh"
- "@kevinmenden"

View file

@ -0,0 +1,25 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
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( consensus, fasta, gff, use_fasta, 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, gff, use_fasta, use_gtf )
}

View file

@ -0,0 +1,120 @@
- name: quast_ref
command: nextflow run ./tests/software/quast -profile docker -entry test_quast_ref -c ./tests/config/nextflow.config
tags:
- quast
- quast_reference
files:
- path: ./output/quast/quast/basic_stats/NGx_plot.pdf
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.coords.filtered
md5sum: ec9191d0acb5d5bce56b4842551a8598
- path: ./output/quast/quast/aligned_stats/NGAx_plot.pdf
- path: ./output/quast/quast/icarus_viewers/contig_size_viewer.html
md5sum: c42838b1553759fb0460a9854e39da36
- path: ./output/quast/report.tsv
md5sum: b203a9d2c995bd66552eeb5cb0a98762
- path: ./output/quast/quast/report.tex
md5sum: 8168f197dfb2f781accdefaa0d90fc87
- path: ./output/quast/quast/contigs_reports/misassemblies_frcurve_plot.pdf
- path: ./output/quast/quast/transposed_report.tex
md5sum: 0b8fd00649a5758024c8093d5919f71c
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.coords
md5sum: dda3fc0addc41ecc0d5183dee6f95886
- path: ./output/quast/quast/transposed_report.txt
md5sum: 73216314e65ef91c24422d5bdd0795e4
- path: ./output/quast/quast/report.html
- path: ./output/quast/quast/report.pdf
- path: ./output/quast/quast/contigs_reports/all_alignments_GCA_011545545-1_ASM1154554v1_cds_from_genomic.tsv
md5sum: c247152eb82b361106492642fd796e2c
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.used_snps.gz
md5sum: 7b1db1b433cd95243a949bcb72e7e3a6
- path: ./output/quast/quast/contigs_reports/unaligned_report.tex
md5sum: 48562e30903fcf33946e13b602b0e324
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.sf
- path: ./output/quast/quast/contigs_reports/transposed_report_misassemblies.txt
md5sum: 53c481fe8b3ef18280ea86cbded78b31
- path: ./output/quast/quast/contigs_reports/contigs_report_GCA_011545545-1_ASM1154554v1_cds_from_genomic.mis_contigs.info
md5sum: d41d8cd98f00b204e9800998ecf8427e
- path: ./output/quast/quast/contigs_reports/unaligned_report.tsv
md5sum: 769f2d9d7deb5e7a63e238d8ba0cfe13
- path: ./output/quast/quast/basic_stats/GCA_011545545.1_ASM1154554v1_cds_from_genomic_GC_content_plot.pdf
- path: ./output/quast/quast/genome_stats/features_cumulative_plot.pdf
- path: ./output/quast/quast/basic_stats/GC_content_plot.pdf
- path: ./output/quast/quast/contigs_reports/transposed_report_misassemblies.tex
md5sum: 85614257e0bb62ac750f7872886b2fbf
- path: ./output/quast/quast/quast.log
- path: ./output/quast/quast/contigs_reports/misassemblies_report.tsv
md5sum: 33144f8d064782864e8400e3a08b2a3a
- path: ./output/quast/quast/contigs_reports/contigs_report_GCA_011545545-1_ASM1154554v1_cds_from_genomic.unaligned.info
md5sum: a8505cf206bf53ca369f7e3073fee587
- path: ./output/quast/quast/genome_stats/GCA_011545545-1_ASM1154554v1_cds_from_genomic_genomic_features_any.txt
md5sum: 307b3bb1f42fc2f11a60a2e9846021d7
- path: ./output/quast/quast/icarus.html
md5sum: 6e57f5f7d07528496fc2f35b449951fe
- path: ./output/quast/quast/contigs_reports/transposed_report_misassemblies.tsv
md5sum: 4d24cc0da823a100a076aef36f9fd75e
- path: ./output/quast/quast/contigs_reports/contigs_report_GCA_011545545-1_ASM1154554v1_cds_from_genomic.stderr
- path: ./output/quast/quast/aligned_stats/cumulative_plot.pdf
- path: ./output/quast/quast/genome_stats/genome_info.txt
md5sum: bc3df27ad7356c045c9a108f9d4bcfbe
- path: ./output/quast/quast/genome_stats/features_frcurve_plot.pdf
- path: ./output/quast/quast/contigs_reports/misassemblies_report.txt
md5sum: 0784e0d31e9f2a165730cc0029023427
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.unaligned
md5sum: d41d8cd98f00b204e9800998ecf8427e
- path: ./output/quast/quast/contigs_reports/contigs_report_GCA_011545545-1_ASM1154554v1_cds_from_genomic.stdout
- path: ./output/quast/quast/contigs_reports/unaligned_report.txt
md5sum: c1c26797084ea743ec5a224ab97adb1f
- path: ./output/quast/quast/genome_stats/GCA_011545545-1_ASM1154554v1_cds_from_genomic_gaps.txt
md5sum: c52381f09ea40b6141be5232494727b6
- path: ./output/quast/quast/icarus_viewers/alignment_viewer.html
md5sum: ad5176f21d3c4809a9a8f9c27bb8d70a
- path: ./output/quast/quast/contigs_reports/misassemblies_report.tex
md5sum: ffe19cf4d5332952f0627e9cd82e3375
- path: ./output/quast/quast/contigs_reports/minimap_output/GCA_011545545-1_ASM1154554v1_cds_from_genomic.coords_tmp
md5sum: ce66eaeb99fdc11e4d50efadc1816e04
- path: ./output/quast/quast/basic_stats/gc.icarus.txt
md5sum: b3a770802ff9b2dd4ee8e47bddb2df3e
- path: ./output/quast/quast/basic_stats/Nx_plot.pdf
- path: ./output/quast/quast/transposed_report.tsv
md5sum: 1754bd6c6fa8a0172a342a48dd3ca505
- path: ./output/quast/quast/basic_stats/cumulative_plot.pdf
- path: ./output/quast/quast/report.txt
md5sum: e334b3390a5028cbf88fe4ccab2b6499
- path: ./output/quast/quast/contigs_reports/misassemblies_plot.pdf
- path: ./output/quast/quast/report.tsv
md5sum: b203a9d2c995bd66552eeb5cb0a98762
- path: ./output/quast/quast/contigs_reports/GCA_011545545_1_ASM1154554v1_cds_from_genomic.mis_contigs.fa
md5sum: d41d8cd98f00b204e9800998ecf8427e
- path: ./output/quast/quast/aligned_stats/NAx_plot.pdf
- name: quast_noref
command: nextflow run ./tests/software/quast -profile docker -entry test_quast_noref -c ./tests/config/nextflow.config
tags:
- quast
- quast_no_reference
files:
- path: ./output/quast/quast/icarus_viewers/contig_size_viewer.html
md5sum: d2680b8083139e62baf7af0f852d52b8
- path: ./output/quast/quast/transposed_report.txt
md5sum: b6b126e9dcfd8c8e7bd36dff9220caf0
- path: ./output/quast/report.tsv
md5sum: 55d2938fcdb678e97d441cf32b9c740e
- path: ./output/quast/quast/icarus.html
md5sum: dcb11b4c7b6c21190c1344c46288d3f4
- path: ./output/quast/quast/report.txt
md5sum: c8e87f40e888a0395be04f78532d9deb
- path: ./output/quast/quast/transposed_report.tsv
md5sum: 27b6c755be5d70e3eed22e1bf3f68ce5
- path: ./output/quast/quast/quast.log
- path: ./output/quast/quast/report.tex
md5sum: 69c31172ae6257663b22bb192ba84682
- path: ./output/quast/quast/report.pdf
- path: ./output/quast/quast/basic_stats/GCA_011545545.1_ASM1154554v1_cds_from_genomic_GC_content_plot.pdf
- path: ./output/quast/quast/basic_stats/cumulative_plot.pdf
- path: ./output/quast/quast/report.tsv
md5sum: 55d2938fcdb678e97d441cf32b9c740e
- path: ./output/quast/quast/transposed_report.tex
md5sum: 213fb615afe21904e52d670e602c1f62
- path: ./output/quast/quast/basic_stats/GC_content_plot.pdf
- path: ./output/quast/quast/basic_stats/Nx_plot.pdf
- path: ./output/quast/quast/report.html