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

Template: add option to exclude citations for custom pipeline template #3101

Merged
merged 8 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
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"
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 @@ -107,6 +108,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

# Create a pipeline from the template
- name: create a pipeline from the template ${{ matrix.TEMPLATE }}
run: |
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))

### Linting

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
4 changes: 4 additions & 0 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
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": ["CITATIONS.md", "assets/methods_description_template.yml"],
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
}
# Get list of files we're skipping with the supplied skip keys
self.skip_paths = set(sp for k in skip_paths for sp in skippable_paths[k])
Expand Down Expand Up @@ -210,6 +211,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},
}

# Set the parameters for the jinja template
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 describe a Materials & Methods section describing the tools used in the pieline,
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
and the logics to add this section to the output MultiQC report (if the report is generated).
"""


class CustomPipeline(Screen):
"""Select if the pipeline will use genomic data."""
Expand Down Expand Up @@ -96,6 +103,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 a CITATIONS.md file to add pipeline tools citations.",
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
"citations",
),
classes="features-container",
)
yield Center(
Expand Down
511 changes: 255 additions & 256 deletions tests/__snapshots__/test_create_app.ambr

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/data/pipeline_create_template_skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ skip_features:
- igenomes
- nf_core_configs
- code_linters
- citations
Loading