Skip to content

Commit

Permalink
Merge pull request #3101 from mirpedrol/template-customisation-citations
Browse files Browse the repository at this point in the history
Template: add option to exclude citations for custom pipeline template
  • Loading branch information
mirpedrol authored Aug 7, 2024
2 parents 4ca051b + 88a354f commit 8e7739d
Show file tree
Hide file tree
Showing 12 changed files with 294 additions and 261 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 @@ -42,6 +42,7 @@ jobs:
- "template_skip_igenomes.yml"
- "template_skip_ci.yml"
- "template_skip_code_linters.yml"
- "template_skip_citations.yml"
- "template_skip_gitpod.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
Expand Down Expand Up @@ -108,6 +109,10 @@ jobs:
run: |
printf "org: my-prefix\nskip: code_linters" > create-test-lint-wf/template_skip_code_linters.yml
- name: Create template skip citations
run: |
printf "org: my-prefix\nskip: citations" > create-test-lint-wf/template_skip_citations.yml
- name: Create template skip gitpod
run: |
printf "org: my-prefix\nskip: gitpod" > create-test-lint-wf/template_skip_gitpod.yml
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Use filename in code block for `params.yml` ([#3055](https://github.com/nf-core/tools/pull/3055))
- Remove release announcement for non nf-core pipelines ([#3072](https://github.com/nf-core/tools/pull/3072))
- 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))

### Linting
Expand Down
3 changes: 3 additions & 0 deletions nf_core/pipeline-template/CITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

> Di Tommaso P, Chatzou M, Floden EW, Barja PP, Palumbo E, Notredame C. Nextflow enables reproducible computational workflows. Nat Biotechnol. 2017 Apr 11;35(4):316-319. doi: 10.1038/nbt.3820. PubMed PMID: 28398311.
{%- if citations %}

## Pipeline tools

- [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)
Expand Down Expand Up @@ -39,3 +41,4 @@
- [Singularity](https://pubmed.ncbi.nlm.nih.gov/28494014/)

> Kurtzer GM, Sochat V, Bauer MW. Singularity: Scientific containers for mobility of compute. PLoS One. 2017 May 11;12(5):e0177459. doi: 10.1371/journal.pone.0177459. eCollection 2017. PubMed PMID: 28494014; PubMed Central PMCID: PMC5426675.
> {%- endif %}
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ For further information or help, don't hesitate to get in touch on the [Slack `#
<!-- TODO nf-core: Add citation for pipeline after first release. Uncomment lines below and update Zenodo doi and badge at the top of this file. -->
<!-- If you use {{ name }} for your analysis, please cite it using the following doi: [10.5281/zenodo.XXXXXX](https://doi.org/10.5281/zenodo.XXXXXX) -->

<!-- TODO nf-core: Add bibliography of tools and data used in your pipeline -->
{% if citations %}<!-- TODO nf-core: Add bibliography of tools and data used in your pipeline -->

An extensive list of references for the tools used by the pipeline can be found in the [`CITATIONS.md`](CITATIONS.md) file.

{% endif %}
{% if is_nfcore -%}
You can cite the `nf-core` publication as follows:

Expand Down
3 changes: 2 additions & 1 deletion nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ params {
multiqc_title = null
multiqc_logo = null
max_multiqc_email_size = '25.MB'
multiqc_methods_description = null
{%- if citations %}
multiqc_methods_description = null{% endif %}

// Boilerplate options
outdir = null
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@
"description": "Custom logo file to supply to MultiQC. File name must also be set in the MultiQC config file",
"fa_icon": "fas fa-image",
"hidden": true
},
},{% if citations %}
"multiqc_methods_description": {
"type": "string",
"description": "Custom MultiQC yaml file containing HTML including a methods description.",
"fa_icon": "fas fa-cog"
},
},{% 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 @@ -207,6 +207,7 @@ def genomeExistsError() {
}
{%- endif %}

{%- if citations %}
//
// Generate methods description for MultiQC
//
Expand Down Expand Up @@ -270,3 +271,4 @@ def methodsDescriptionText(mqc_methods_yaml) {

return description_html.toString()
}
{% endif %}
6 changes: 5 additions & 1 deletion nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include { MULTIQC } from '../modules/nf-core/multiqc/main'
include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'
{% if citations %}include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'{% endif %}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -63,21 +63,25 @@ workflow {{ short_name|upper }} {
workflow, parameters_schema: "nextflow_schema.json")
ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params))

{%- if citations %}
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)
ch_methods_description = Channel.value(
methodsDescriptionText(ch_multiqc_custom_methods_description))
{%- endif %}

ch_multiqc_files = ch_multiqc_files.mix(
ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
{%- if citations %}
ch_multiqc_files = ch_multiqc_files.mix(
ch_methods_description.collectFile(
name: 'methods_description_mqc.yaml',
sort: true
)
)
{%- endif %}

MULTIQC (
ch_multiqc_files.collect(),
Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipelines/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(
".prettierrc.yml",
".github/workflows/fix-linting.yml",
],
"citations": ["assets/methods_description_template.yml"],
"gitpod": [".gitpod.yml"],
}
# Get list of files we're skipping with the supplied skip keys
Expand Down Expand Up @@ -211,6 +212,7 @@ def obtain_jinja_params_dict(self, features_to_skip, pipeline_dir):
"igenomes": {"file": True, "content": True},
"nf_core_configs": {"file": False, "content": True},
"code_linters": {"file": True, "content": True},
"citations": {"file": True, "content": True},
"gitpod": {"file": True, "content": True},
}

Expand Down
13 changes: 13 additions & 0 deletions nf_core/pipelines/create/custompipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
- prettier (https://github.com/prettier/prettier): enforces a consistent style (indentation, quoting, line length, etc).
"""

markdown_citations = """
If adding citations, the pipeline template will contain a `CITATIONS.md` file to add the citations of all tools used in the pipeline.
Additionally, it will include a YAML file (`assets/methods_description_template.yml`) to add a Materials & Methods section describing the tools used in the pieline,
and the logics to add this section to the output MultiQC report (if the report is generated).
"""

markdown_gitpod = """
Gitpod (https://www.gitpod.io/) provides standardized and automated development environments.
Expand Down Expand Up @@ -103,6 +110,12 @@ def compose(self) -> ComposeResult:
"The pipeline will include code linters and CI tests to lint your code: pre-commit, editor-config and prettier.",
"code_linters",
),
PipelineFeature(
markdown_citations,
"Include citations",
"Include pipeline tools citations in CITATIONS.md and a method description in the MultiQC report (if enabled).",
"citations",
),
PipelineFeature(
markdown_gitpod,
"Include a gitpod environment",
Expand Down
Loading

0 comments on commit 8e7739d

Please sign in to comment.