Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (customisable) 'method description' MultiQC section to pipeline template #1749

Merged
merged 24 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
02a96ca
Add new custom groovy library to generate a methods section for MultiQC
jfy133 Aug 14, 2022
63e3df6
Changelog
jfy133 Aug 14, 2022
d9a30d5
Add to schema
jfy133 Aug 14, 2022
de682fb
Update nf_core/pipeline-template/assets/methods_description_template.yml
jfy133 Aug 17, 2022
b2c5f1e
Apply suggestions from code review
jfy133 Aug 17, 2022
6f13ab2
Apply suggestions from code review
jfy133 Aug 23, 2022
4da8e9f
Update nf_core/pipeline-template/assets/methods_description_template.yml
jfy133 Aug 23, 2022
98eacbc
Add conditional DOI
jfy133 Aug 23, 2022
51231b6
Merge branch 'method-description' of github.com:jfy133/nf-core-tools …
jfy133 Aug 23, 2022
788f4ae
Merge branch 'dev' into method-description
jfy133 Aug 25, 2022
d94c50b
Generate new screengrabs with rich-codex
github-actions[bot] Aug 25, 2022
25d73bf
Update MultiQC and insert config correctly
jfy133 Sep 8, 2022
720f8ed
Update CHANGELOG.md
jfy133 Sep 8, 2022
3edfa5f
Improve message re logo
jfy133 Sep 8, 2022
919e10a
Merge branch 'dev' of github.com:jfy133/nf-core-tools into dev
jfy133 Sep 8, 2022
5fe2e8f
Update CHANGELOG.md
jfy133 Sep 8, 2022
f19641e
Try adding custom logo path parameter
jfy133 Sep 8, 2022
e3ec6dc
Remove MultiQC logo
jfy133 Sep 8, 2022
e5dafc8
Remove MultiQC logo from pipeline
jfy133 Sep 8, 2022
19c22f2
Re-add logo
jfy133 Sep 8, 2022
b9ff86d
Update nf_core/pipeline-template/assets/methods_description_template.yml
jfy133 Sep 9, 2022
3b8c303
Generate new screengrabs with rich-codex
github-actions[bot] Sep 9, 2022
c74af01
Make DOI notice a condition
jfy133 Sep 9, 2022
710044a
Merge remote-tracking branch 'origin/dev' into method-description
jfy133 Sep 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Make `nf-core create` fail if Git default branch name is dev or TEMPLATE ([#1705](https://github.com/nf-core/tools/pull/1705))
- Convert `console` snippets to `bash` snippets in the template where applicable ([#1729](https://github.com/nf-core/tools/pull/1729))
- Add `branch` field to module entries in `modules.json` to record what branch a module was installed from ([#1728](https://github.com/nf-core/tools/issues/1728))
- Add a 'recommend' methods description text to MultiQC to help pipeline users report pipeline usage in publications
jfy133 marked this conversation as resolved.
Show resolved Hide resolved

### Linting

Expand Down
25 changes: 25 additions & 0 deletions nf_core/pipeline-template/assets/methods_description_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
id: "${workflow.manifest.name.replace('/', '-')}-methods-description"
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
description: "Suggested methods description text of pipeline usage"
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
section_name: "${ workflow.manifest.name } Methods Description"
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
section_href: "https://github.com/${workflow.manifest.name}"
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
plot_type: "html"
## TODO nf-core: Update the HTML below to your prefered methods description, e.g. add publication citation for this pipeline
## You inject any metadata in the Nextflow '${workflow}' object
data: |
<b>Methods</b>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
<p>Data was processed using the ${workflow.manifest.name} (v${workflow.manifest.version}, doi: ${workflow.manifest.doi}) of the nf-core collection of workflows (Ewels et al. 2020).</p>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
<p>The pipeline was executed with Nextflow (v${workflow.nextflow.version}; Di Tommaso et al. 2017) with the following command:</p>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
<pre><code>${workflow.commandLine}</code></pre>
<b>References</b>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
<ul>
<li>Di Tommaso, P., Chatzou, M., Floden, E. W., Barja, P. P., Palumbo, E., & Notredame, C. (2017). Nextflow enables reproducible computational workflows. Nature Biotechnology, 35(4), 316-319. https://doi.org/10.1038/nbt.3820 </li>
<li>Ewels, P. A., Peltzer, A., Fillinger, S., Patel, H., Alneberg, J., Wilm, A., Garcia, M. U., Di Tommaso, P., & Nahnsen, S. (2020). The nf-core framework for community-curated bioinformatics pipelines. Nature Biotechnology, 38(3), 276-278. https://doi.org/10.1038/s41587-020-0439-x </li>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
</ul>
<blockquote>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
<b>Notes:</b><br>
<ul>
<li>If present, make sure to replace the pipeline DOI with correct reference information.</li>
<li>The command above does not include parameters contained in any configs pr profiles that may have been used. Ensure the config file is also uploaded with your publication!</li>
<li>You should also cite all software used within this run. Check the "Software Versions" of this report to get version information.</li>
</ul>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
</blockquote>
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions nf_core/pipeline-template/assets/multiqc_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ report_comment: >
analysis pipeline.{% if branded %} For information about how to interpret these results, please see the
<a href="https://nf-co.re/{{ short_name }}" target="_blank">documentation</a>.{% endif %}
report_section_order:
software_versions:
"{{ name.lower().replace('/', '-') }}-methods-description":
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
order: -1000
"{{ name.lower().replace('/', '-') }}-summary":
software_versions:
order: -1001
"{{ name.lower().replace('/', '-') }}-summary":
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
order: -1002

export_plots: true
15 changes: 15 additions & 0 deletions nf_core/pipeline-template/lib/WorkflowPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// This file holds several functions specific to the workflow/{{ short_name }}.nf in the {{ name }} pipeline
//

import groovy.text.SimpleTemplateEngine

class Workflow{{ short_name[0]|upper }}{{ short_name[1:] }} {

//
Expand Down Expand Up @@ -45,6 +47,19 @@ class Workflow{{ short_name[0]|upper }}{{ short_name[1:] }} {
return yaml_file_text
}

public static String methodsDescriptionText(run_workflow, mqc_methods_yaml) {
// Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file
def meta = [:]
meta.workflow = run_workflow.toMap()

def methods_text = mqc_methods_yaml.text

def engine = new SimpleTemplateEngine()
def description_html = engine.createTemplate(methods_text).make(meta)

return description_html
}

{%- if igenomes -%}
//
// Exit pipeline if incorrect --genome key provided
Expand Down
8 changes: 5 additions & 3 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ params {
{% endif -%}

// MultiQC options
multiqc_config = null
multiqc_title = null
max_multiqc_email_size = '25.MB'
multiqc_config = null
multiqc_title = null
max_multiqc_email_size = '25.MB'
multiqc_methods_description = null

// Boilerplate options
outdir = null
Expand Down Expand Up @@ -191,6 +192,7 @@ manifest {
mainScript = 'main.nf'
nextflowVersion = '!>=21.10.3'
version = '{{ version }}'
doi = ''
}

// Load modules.config for DSL2 module specific options
Expand Down
6 changes: 6 additions & 0 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@
"fa_icon": "fas fa-cog",
"hidden": true
},
"multiqc_methods_description": {
"type": "string",
"description": "Custom MultiQC yaml file containing HTML including a methods description.",
"fa_icon": "fas fa-cog",
"hidden": true
},
"tracedir": {
"type": "string",
"description": "Directory to keep pipeline Nextflow logs and reports.",
Expand Down
9 changes: 7 additions & 2 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input sample
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

ch_multiqc_config = file("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config) : Channel.empty()
ch_multiqc_config = file("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config) : Channel.empty()
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -89,10 +90,14 @@ workflow {{ short_name|upper }} {
workflow_summary = Workflow{{ short_name[0]|upper }}{{ short_name[1:] }}.paramsSummaryMultiqc(workflow, summary_params)
ch_workflow_summary = Channel.value(workflow_summary)

methods_description = WorkflowTestpipeline.methodsDescriptionText(workflow, ch_multiqc_custom_methods_description)
ch_methods_description = Channel.value(methods_description)

ch_multiqc_files = Channel.empty()
ch_multiqc_files = ch_multiqc_files.mix(Channel.from(ch_multiqc_config))
ch_multiqc_files = ch_multiqc_files.mix(ch_multiqc_custom_config.collect().ifEmpty([]))
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect())
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}.ifEmpty([]))

Expand Down