Merge pull request #82 from abhi18av/master

Add multiqc module
This commit is contained in:
Harshil Patel 2020-12-09 11:31:07 +00:00 committed by GitHub
commit 79a0ce79ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 589 additions and 4 deletions

38
.github/workflows/multiqc.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: multiqc
on:
push:
paths:
- software/multiqc/**
- .github/workflows/multiqc.yml
- tests
pull_request:
paths:
- software/multiqc/**
- .github/workflows/multiqc.yml
- tests
jobs:
ci_test:
runs-on: ubuntu-latest
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
run: |
export NXF_VER="20.07.1"
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 multiqc --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"
}
}
}

31
software/multiqc/main.nf Normal file
View file

@ -0,0 +1,31 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process MULTIQC {
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::multiqc=1.9" : null)
container "quay.io/biocontainers/multiqc:1.9--pyh9f0ad1d_0"
input:
path multiqc_files
output:
path "*multiqc_report.html", emit: report
path "*_data" , emit: data
path "*_plots" , optional:true, emit: plots
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
"""
multiqc -f $options.args .
multiqc --version | sed -e "s/multiqc, version //g" > ${software}.version.txt
"""
}

55
software/multiqc/meta.yml Normal file
View file

@ -0,0 +1,55 @@
name: MultiQC
description: Aggregate results from bioinformatics analyses across many samples into a single report
keywords:
- QC
- bioinformatics tools
- Beautiful stand-alone HTML report
tools:
- multiqc:
description: |
MultiQC searches a given directory for analysis logs and compiles a HTML report.
It's a general use tool, perfect for summarising the output from numerous bioinformatics tools.
homepage: https://multiqc.info/
documentation: https://multiqc.info/docs/
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
input:
- multiqc_files:
type: file
description: |
List of reports / files recognised by MultiQC, for example the html and zip output of FastQC
output:
- report:
type: file
description: MultiQC report file
pattern: "multiqc_report.html"
- data:
type: dir
description: MultiQC data dir
pattern: "multiqc_data"
- plots:
type: file
description: Plots created by MultiQC
pattern: "*_data"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@abhi18av"
- "@bunop"
- "@drpatelh"

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -23,11 +23,16 @@ workflow test_single_end {
workflow test_paired_end {
def input = []
input = [ [ id:'test', single_end:false ], // meta map
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ]
input = [[id: 'test', single_end: false], // meta map
[file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true)]]
FASTQC_PE(input)
emit:
html = FASTQC_PE.out.html
zip = FASTQC_PE.out.zip
FASTQC_PE ( input )
}
// TODO Test e2e

View file

@ -0,0 +1,16 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MULTIQC } from '../../../software/multiqc/main.nf' addParams(options: [publish_dir: 'test_multiqc'])
include { test_paired_end } from '../fastqc/main.nf' addParams(options: [publish_dir: 'test_paired_end'])
workflow test_multiqc {
test_paired_end()
input = [
test_paired_end.out.zip.collect { it[1] }.ifEmpty([])
]
MULTIQC(*input)
}

View file

@ -0,0 +1,7 @@
- name: Run multiqc test workflow
command: nextflow run ./tests/software/multiqc/ -profile docker -entry test_multiqc -c tests/config/nextflow.config
tags:
- multiqc
files:
- path: output/test_multiqc/multiqc_report.html