Skip to content

Commit

Permalink
Merge pull request #3103 from mirpedrol/template-customisation-mutiqc
Browse files Browse the repository at this point in the history
Template: add option to exclude multiqc from pipeline template
  • Loading branch information
mirpedrol authored Aug 7, 2024
2 parents 0aede5f + f8d5463 commit 442f0a8
Show file tree
Hide file tree
Showing 26 changed files with 497 additions and 441 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "template_skip_code_linters.yml"
- "template_skip_citations.yml"
- "template_skip_gitpod.yml"
- "template_skip_multiqc.yml"
runner:
# use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default
- ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }}
Expand Down Expand Up @@ -117,6 +118,10 @@ jobs:
run: |
printf "org: my-prefix\nskip: gitpod" > create-test-lint-wf/template_skip_gitpod.yml
- name: Create template skip multiqc
run: |
printf "org: my-prefix\nskip: multiqc" > create-test-lint-wf/template_skip_multiqc.yml
# Create a pipeline from the template
- name: create a pipeline from the template ${{ matrix.TEMPLATE }}
run: |
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ docs/api/_build
testing
nf_core/module-template/meta.yml
nf_core/pipeline-template/nextflow_schema.json
nf_core/pipeline-template/modules.json
nf_core/pipeline-template/tower.yml
# don't run on things handled by ruff
*.py
*.pyc
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- add option to exclude code linters for custom pipeline template ([#3084](https://github.com/nf-core/tools/pull/3084))
- add option to exclude citations for custom pipeline template ([#3101](https://github.com/nf-core/tools/pull/3101))
- add option to exclude gitpod for custom pipeline template ([#3100](https://github.com/nf-core/tools/pull/3100))
- add option to exclude multiqc from pipeline template ([#3103](https://github.com/nf-core/tools/pull/3103))

### Linting

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ If you wish to contribute a new step, please use the following coding standards:
6. Add sanity checks and validation for all relevant parameters.
7. Perform local tests to validate that the new code works as expected.
8. If applicable, add a new test command in `.github/workflow/ci.yml`.
{%- if multiqc %}
9. Update MultiQC config `assets/multiqc_config.yml` so relevant suffixes, file name clean up and module plots are in the appropriate order. If applicable, add a [MultiQC](https://https://multiqc.info/) module.
10. Add a description of the output files and if relevant any appropriate images from the MultiQC report to `docs/output.md`.
{% endif %}

### Default values

Expand Down
5 changes: 3 additions & 2 deletions nf_core/pipeline-template/CITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

> Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online].
- [MultiQC](https://pubmed.ncbi.nlm.nih.gov/27312411/)
{% if multiqc %}- [MultiQC](https://pubmed.ncbi.nlm.nih.gov/27312411/)

> Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. doi: 10.1093/bioinformatics/btw354. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924.
> Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. doi: 10.1093/bioinformatics/btw354. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924.
> {%- endif %}
## Software packaging/containerisation tools

Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<!-- TODO nf-core: Fill in short bullet-pointed list of the default steps in the pipeline -->

1. Read QC ([`FastQC`](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/))
2. Present QC for raw reads ([`MultiQC`](http://multiqc.info/))
{% if multiqc %}2. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)){% endif %}

## Usage

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/assets/sendmail_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Content-Disposition: inline; filename="{{ name_noslash }}_logo_light.png"
join( '\n' ) %>

<%
{%- if multiqc %}
if (mqcFile){
def mqcFileObj = new File("$mqcFile")
if (mqcFileObj.length() < mqcMaxSize){
Expand All @@ -48,6 +49,7 @@ ${mqcFileObj.
join( '\n' )}
"""
}}
{%- endif %}
%>

--nfcoremimeboundary--
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ process {
ext.args = '--quiet'
}

{%- if multiqc %}
withName: 'MULTIQC' {
ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' }
publishDir = [
Expand All @@ -30,5 +31,6 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
{%- endif %}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 4 additions & 11 deletions nf_core/pipeline-template/docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

This document describes the output produced by the pipeline. Most of the plots are taken from the MultiQC report, which summarises results at the end of the pipeline.
This document describes the output produced by the pipeline. {% if multiqc %}Most of the plots are taken from the MultiQC report, which summarises results at the end of the pipeline.{% endif %}

The directories listed below will be created in the results directory after the pipeline has finished. All paths are relative to the top-level results directory.

Expand All @@ -13,7 +13,7 @@ The directories listed below will be created in the results directory after the
The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes data using the following steps:

- [FastQC](#fastqc) - Raw read QC
- [MultiQC](#multiqc) - Aggregate report describing results and QC from the whole pipeline
{% if multiqc %}- [MultiQC](#multiqc) - Aggregate report describing results and QC from the whole pipeline{% endif %}
- [Pipeline information](#pipeline-information) - Report metrics generated during the workflow execution

### FastQC
Expand All @@ -29,15 +29,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d

[FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) gives general quality metrics about your sequenced reads. It provides information about the quality score distribution across your reads, per base sequence content (%A/T/G/C), adapter contamination and overrepresented sequences. For further reading and documentation see the [FastQC help pages](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/).

![MultiQC - FastQC sequence counts plot](images/mqc_fastqc_counts.png)

![MultiQC - FastQC mean quality scores plot](images/mqc_fastqc_quality.png)

![MultiQC - FastQC adapter content plot](images/mqc_fastqc_adapter.png)

:::note
The FastQC plots displayed in the MultiQC report shows _untrimmed_ reads. They may contain adapter sequence and potentially regions with low quality.
:::
{%- if multiqc %}

### MultiQC

Expand All @@ -54,6 +46,7 @@ The FastQC plots displayed in the MultiQC report shows _untrimmed_ reads. They m
[MultiQC](http://multiqc.info) is a visualization tool that generates a single HTML report summarising all samples in your project. Most of the pipeline QC results are visualised in the report and further statistics are available in the report data directory.

Results generated by MultiQC collate pipeline QC from supported tools e.g. FastQC. The pipeline has special steps which also allow the software versions to be reported in the MultiQC output for future traceability. For more information about how to use MultiQC reports, see <http://multiqc.info>.
{% endif %}

### Pipeline information

Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ It is a good idea to specify a pipeline version when running the pipeline on you

First, go to the [{{ name }} releases page](https://github.com/{{ name }}/releases) and find the latest pipeline version - numeric only (eg. `1.3.1`). Then specify this when running the pipeline with `-r` (one hyphen) - eg. `-r 1.3.1`. Of course, you can switch to another version by changing the number after the `-r` flag.

This version number will be logged in reports when you run the pipeline, so that you'll know what you used when you look back in the future. For example, at the bottom of the MultiQC reports.
This version number will be logged in reports when you run the pipeline, so that you'll know what you used when you look back in the future. {% if multiqc %}For example, at the bottom of the MultiQC reports.{% endif %}

To further assist in reproducbility, you can use share and re-use [parameter files](#running-the-pipeline) to repeat pipeline runs with the same settings without having to write out a command with every single parameter.

Expand Down
6 changes: 3 additions & 3 deletions nf_core/pipeline-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ workflow {{ prefix_nodash|upper }}_{{ short_name|upper }} {
{{ short_name|upper }} (
samplesheet
)

{%- if multiqc %}
emit:
multiqc_report = {{ short_name|upper }}.out.multiqc_report // channel: /path/to/multiqc_report.html

{%- endif %}
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -101,7 +101,7 @@ workflow {
params.outdir,
params.monochrome_logs,
params.hook_url,
{{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report
{%- if multiqc %}{{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report{% endif %}
)
}

Expand Down
3 changes: 2 additions & 1 deletion nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"branch": "master",
"git_sha": "285a50500f9e02578d90b3ce6382ea3c30216acd",
"installed_by": ["modules"]
},
}{%- if multiqc %},
"multiqc": {
"branch": "master",
"git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a",
"installed_by": ["modules"]
}
{%- endif %}
}
},
"subworkflows": {
Expand Down
5 changes: 3 additions & 2 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ params {
igenomes_ignore = false
{%- endif %}

{%- if multiqc %}
// MultiQC options
multiqc_config = null
multiqc_title = null
multiqc_logo = null
max_multiqc_email_size = '25.MB'
{%- if citations %}
multiqc_methods_description = null{% endif %}
{% if citations %}multiqc_methods_description = null{% endif %}
{%- endif %}

// Boilerplate options
outdir = null
Expand Down
8 changes: 6 additions & 2 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
"fa_icon": "fas fa-envelope",
"help_text": "Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits. If set in your user config file (`~/.nextflow/config`) then you don't need to specify this on the command line for every run.",
"pattern": "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"
},
}{% if multiqc %},
"multiqc_title": {
"type": "string",
"description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
"fa_icon": "fas fa-file-signature"
}
{% endif %}
}
},
{%- if igenomes %}
Expand Down Expand Up @@ -201,6 +202,7 @@
"fa_icon": "fas fa-remove-format",
"hidden": true
},
{%- if multiqc %}
"max_multiqc_email_size": {
"type": "string",
"description": "File size limit when attaching MultiQC reports to summary emails.",
Expand All @@ -209,6 +211,7 @@
"fa_icon": "fas fa-file-upload",
"hidden": true
},
{% endif %}
"monochrome_logs": {
"type": "boolean",
"description": "Do not use coloured log outputs.",
Expand All @@ -222,6 +225,7 @@
"help_text": "Incoming hook URL for messaging service. Currently, MS Teams and Slack are supported.",
"hidden": true
},
{%- if multiqc %}
"multiqc_config": {
"type": "string",
"format": "file-path",
Expand All @@ -239,7 +243,7 @@
"type": "string",
"description": "Custom MultiQC yaml file containing HTML including a methods description.",
"fa_icon": "fas fa-cog"
},{% endif %}
},{% endif %}{% endif %}
"validate_params": {
"type": "boolean",
"description": "Boolean whether to validate parameters against the schema at runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ workflow PIPELINE_COMPLETION {
outdir // path: Path to output directory where results will be published
monochrome_logs // boolean: Disable ANSI colour codes in log output
hook_url // string: hook URL for notifications
multiqc_report // string: Path to MultiQC report
{% if multiqc %}multiqc_report // string: Path to MultiQC report{% endif %}

main:

Expand All @@ -134,7 +134,11 @@ workflow PIPELINE_COMPLETION {
//
workflow.onComplete {
if (email || email_on_fail) {
{%- if multiqc %}
completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, multiqc_report.toList())
{%- else %}
completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, [])
{%- endif %}
}

completionSummary(monochrome_logs)
Expand Down Expand Up @@ -206,8 +210,7 @@ def genomeExistsError() {
}
}
{%- endif %}

{%- if citations %}
{%- if citations or multiqc %}
//
// Generate methods description for MultiQC
//
Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/tower.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
reports:
{%- if multiqc %}
multiqc_report.html:
display: "MultiQC HTML report"
{%- endif %}
samplesheet.csv:
display: "Auto-created samplesheet with collated metadata and FASTQ paths"
15 changes: 8 additions & 7 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

include { FASTQC } from '../modules/nf-core/fastqc/main'
include { MULTIQC } from '../modules/nf-core/multiqc/main'
{% if multiqc %}include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %}
include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
{% if multiqc %}include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %}
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
{% if citations %}include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'{% endif %}
{% if citations or multiqc %}include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'{% endif %}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -25,15 +25,15 @@ workflow {{ short_name|upper }} {
main:

ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
{% if multiqc %}ch_multiqc_files = Channel.empty(){% endif %}

//
// MODULE: Run FastQC
//
FASTQC (
ch_samplesheet
)
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]})
{% if multiqc %}ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}){% endif %}
ch_versions = ch_versions.mix(FASTQC.out.versions.first())

//
Expand All @@ -47,6 +47,7 @@ workflow {{ short_name|upper }} {
newLine: true
).set { ch_collated_versions }

{% if multiqc %}
//
// MODULE: MultiQC
//
Expand Down Expand Up @@ -89,9 +90,9 @@ workflow {{ short_name|upper }} {
ch_multiqc_custom_config.toList(),
ch_multiqc_logo.toList()
)

{% endif %}
emit:
multiqc_report = MULTIQC.out.report.toList() // channel: /path/to/multiqc_report.html
{%- if multiqc %}multiqc_report = MULTIQC.out.report.toList() // channel: /path/to/multiqc_report.html{% endif %}
versions = ch_versions // channel: [ path(versions.yml) ]
}

Expand Down
Loading

0 comments on commit 442f0a8

Please sign in to comment.