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

nf-schema support #3116

Merged
merged 69 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a754fe0
add schema checking for draft 2020-12
nvnieuwk Aug 14, 2024
464f16e
update validate schema
nvnieuwk Aug 14, 2024
6658449
update more code to support draft 2020-12
nvnieuwk Aug 14, 2024
6ecde20
fix draft 7 schema using http
nvnieuwk Aug 14, 2024
36fad24
ruff
nvnieuwk Aug 14, 2024
6777694
fix tests + add draft 2020-12 as default draft
nvnieuwk Aug 14, 2024
0dfd15d
fix typo
nvnieuwk Aug 14, 2024
7f29f37
ruff
nvnieuwk Aug 14, 2024
730c677
add checks for nf-validation and nf-schema plugin config
nvnieuwk Aug 14, 2024
7fbbff7
linting fully works now!
nvnieuwk Aug 14, 2024
59e2eb0
Merge branch 'dev' into feat/linting-nf-schema
nvnieuwk Aug 19, 2024
0838d6b
warning for nf-validation
nvnieuwk Aug 19, 2024
ba329fa
Merge branch 'feat/linting-nf-schema' of github.com:nvnieuwk/tools in…
nvnieuwk Aug 19, 2024
8559c2d
fetch plugin on schema filename setting
nvnieuwk Aug 19, 2024
0296f7d
add a check for defs usage instead of $defs
nvnieuwk Aug 19, 2024
0b8d04f
change all definitions to self.defs_notation
nvnieuwk Aug 19, 2024
5443813
migrate template part 1
nvnieuwk Aug 19, 2024
5519c83
some small updates for the new release
nvnieuwk Aug 20, 2024
171640b
some more small updates to the template
nvnieuwk Aug 20, 2024
249b3da
update handling of ignored parameters
nvnieuwk Aug 20, 2024
af34d07
update validation plugin fetching
nvnieuwk Aug 20, 2024
e6381b7
update plugin linting
nvnieuwk Aug 21, 2024
e66a732
ignore genomes for now
nvnieuwk Aug 21, 2024
b6ae8d0
improve config linting for validation even more
nvnieuwk Aug 21, 2024
1be1737
check plugin includes in pipeline
nvnieuwk Aug 21, 2024
2f1a442
make nf-schema optional in the template
nvnieuwk Aug 22, 2024
72aa81f
Merge branch 'dev' into feat/linting-nf-schema
nvnieuwk Aug 22, 2024
364b54b
small fixes for template without nf-schema
nvnieuwk Aug 22, 2024
4e63138
bump nextflow version
nvnieuwk Aug 22, 2024
11efc55
update changelog
nvnieuwk Aug 22, 2024
47c3fe3
fix ruff linting
nvnieuwk Aug 22, 2024
09bfca2
add a plugin includes test
nvnieuwk Aug 22, 2024
44dbbf7
update review comments
nvnieuwk Aug 23, 2024
ea51814
remove duplicate code
nvnieuwk Aug 23, 2024
b85ea4d
update nf-schema subwf
nvnieuwk Aug 26, 2024
c538cfd
Merge branch 'dev' into feat/linting-nf-schema
nvnieuwk Aug 26, 2024
0fb97db
fix some issues
nvnieuwk Aug 26, 2024
7dee447
fix linting utils_nfschema_plugin
nvnieuwk Aug 26, 2024
6d01b0f
update utils subwfs
nvnieuwk Aug 26, 2024
a7dcdd7
fix some linting issues
nvnieuwk Aug 27, 2024
a77f5a1
Merge branch 'dev' into feat/linting-nf-schema
nvnieuwk Aug 27, 2024
fcdf65b
ruff
nvnieuwk Aug 27, 2024
56150dc
add linting doc for plugin_includes
nvnieuwk Aug 27, 2024
5a29c4e
readd file exists check
nvnieuwk Aug 27, 2024
18738ef
fix launch command
nvnieuwk Aug 27, 2024
ebf6a27
fix schema tests
nvnieuwk Aug 27, 2024
04fabe5
ruff
nvnieuwk Aug 27, 2024
0649a75
readd file exists check
nvnieuwk Aug 27, 2024
9fd9869
fix lint test
nvnieuwk Aug 27, 2024
6cccc1e
update textual snapshots
mirpedrol Aug 27, 2024
2ccbdd9
skip linting before and after Text params for custom pipelines
mirpedrol Aug 27, 2024
ed01eba
typo
mirpedrol Aug 27, 2024
1b597f1
Update nf_core/pipeline-template/nextflow.config
nvnieuwk Aug 27, 2024
93cc41b
Update nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipe…
nvnieuwk Aug 27, 2024
6e358f3
Update nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipe…
nvnieuwk Aug 27, 2024
dbe9318
Update nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipe…
nvnieuwk Aug 27, 2024
4025b54
Update nf_core/pipelines/create/templatefeatures.yml
nvnieuwk Aug 27, 2024
679de82
Update tests/pipelines/lint/test_plugin_includes.py
nvnieuwk Aug 27, 2024
3ac1bd8
review suggestions
nvnieuwk Aug 27, 2024
d4266c0
use latest version of utils_nextflow_pipeline
nvnieuwk Aug 27, 2024
bc20099
make help params snake_case
nvnieuwk Aug 27, 2024
829d594
Update nf_core/pipelines/create/templatefeatures.yml
nvnieuwk Aug 27, 2024
1ff7cbc
Update nf_core/pipelines/lint/plugin_includes.py
nvnieuwk Aug 27, 2024
aed9460
apply review suggestions
nvnieuwk Aug 27, 2024
7612e66
Merge branch 'feat/linting-nf-schema' of github.com:nvnieuwk/tools in…
nvnieuwk Aug 27, 2024
4407901
update utils_nextflow_pipeline commit messages
nvnieuwk Aug 27, 2024
330e43c
update ignoring of help params
nvnieuwk Aug 27, 2024
3600db7
update file exists docstring
nvnieuwk Aug 27, 2024
e816faf
update snapshot
nvnieuwk Aug 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/create-lint-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
NXF_VER:
- "23.04.0"
- "23.10.0"
- "latest-everything"
steps:
- name: go to subdirectory and change nextflow workdir
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-test-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
NXF_VER:
- "23.04.0"
- "23.10.0"
- "latest-everything"
steps:
- name: go to working directory
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
- add option to exclude changelog from custom pipeline template ([#3104](https://github.com/nf-core/tools/pull/3104))
- add option to exclude license from pipeline template ([#3125](https://github.com/nf-core/tools/pull/3125))
- add option to exclude email from pipeline template ([#3126](https://github.com/nf-core/tools/pull/3126))
- Use nf-schema instead of nf-validation ([#3116](https://github.com/nf-core/tools/pull/3116))
- add option to exclude nf-schema from the template ([#3116](https://github.com/nf-core/tools/pull/3116))
- add option to exclude fastqc from pipeline template ([#3129](https://github.com/nf-core/tools/pull/3129))
- add option to exclude documentation from pipeline template ([#3130](https://github.com/nf-core/tools/pull/3130))
- add option to exclude test configs from pipeline template ([#3133](https://github.com/nf-core/tools/pull/3133))
Expand All @@ -42,6 +44,10 @@
- Remove defaults from conda `environment.yml` file. ([#3029](https://github.com/nf-core/tools/pull/3029))
- Restructure pipeline tests and move pipeline linting into subfolder ([#3070](https://github.com/nf-core/tools/pull/3070))
- Fix module linting warning for process_high_memory ([#3086](https://github.com/nf-core/tools/issues/3086))
- Linting will now fail when an unpinned plugin is used ([#3116](https://github.com/nf-core/tools/pull/3116))
- Linting will now check if the schema is correct for the used validation plugin ([#3116])(https://github.com/nf-core/tools/pull/3116)
- Linting will now check the use of the right validation plugin include statements in the workflow scripts ([#3116])(https://github.com/nf-core/tools/pull/3116)
- Full linting for correct use of nf-schema and nf-validation ([#3116](https://github.com/nf-core/tools/pull/3116))

### Pipeline create command

Expand Down
5 changes: 5 additions & 0 deletions docs/api/_src/pipeline_lint_tests/plugin_includes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# plugin_includes

```{eval-rst}
.. automethod:: nf_core.pipelines.lint.PipelineLint.plugin_includes
```
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
NXF_VER:
- "23.04.0"
- "23.10.0"
- "latest-everything"
steps:
- name: Check out pipeline code
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 @@ -16,7 +16,7 @@
[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.XXXXXXX-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.XXXXXXX)
[![nf-test](https://img.shields.io/badge/unit_tests-nf--test-337ab7.svg)](https://www.nf-test.com)

[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A523.04.0-23aa62.svg)](https://www.nextflow.io/)
[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A523.10.0-23aa62.svg)](https://www.nextflow.io/)
[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/)
[![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/)
[![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/)
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/assets/schema_input.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/{{ name }}/master/assets/schema_input.json",
"title": "{{ name }} pipeline - params.input schema",
"description": "Schema for the file provided with params.input",
Expand Down
1 change: 0 additions & 1 deletion nf_core/pipeline-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ workflow {
//
PIPELINE_INITIALISATION (
params.version,
params.help,
params.validate_params,
params.monochrome_logs,
args,
Expand Down
12 changes: 6 additions & 6 deletions nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
"nf-core": {
"utils_nextflow_pipeline": {
"branch": "master",
"git_sha": "20c03aede5a80ff520a905cea1f8ca121b5bb661",
"git_sha": "d20fb2a9cc3e2835e9d067d1046a63252eb17352",
"installed_by": ["subworkflows"]
},
"utils_nfcore_pipeline": {
"branch": "master",
"git_sha": "92de218a329bfc9a9033116eb5f65fd270e72ba3",
"git_sha": "2fdce49d30c0254f76bc0f13c55c17455c1251ab",
"installed_by": ["subworkflows"]
},
"utils_nfvalidation_plugin": {
}{% if nf_schema %},
"utils_nfschema_plugin": {
"branch": "master",
"git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa",
"git_sha": "bbd5a41f4535a8defafe6080e00ea74c45f4f96c",
"installed_by": ["subworkflows"]
}
}{% endif %}
}
}
}
Expand Down
56 changes: 44 additions & 12 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ params {
{%- endif %}
monochrome_logs = false
hook_url = null
help = false
{% if nf_schema %}help = false
help_full = false
show_hidden = false{% endif %}
version = false
{% if test_config %}pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'{% endif %}

Expand All @@ -61,11 +63,7 @@ params {
max_time = '240.h'

// Schema validation default options
validationFailUnrecognisedParams = false
validationLenientMode = false
validationSchemaIgnoreParams = 'genomes,igenomes_base'
validationShowHiddenParams = false
validate_params = true
validate_params = true

}

Expand Down Expand Up @@ -204,11 +202,6 @@ podman.registry = 'quay.io'
singularity.registry = 'quay.io'
charliecloud.registry = 'quay.io'

// Nextflow plugins
plugins {
id '[email protected]' // Validation of pipeline parameters and creation of an input channel from a sample sheet
}

{% if igenomes -%}
// Load igenomes.config if required
if (!params.igenomes_ignore) {
Expand Down Expand Up @@ -266,11 +259,50 @@ manifest {
homePage = 'https://github.com/{{ name }}'
description = """{{ description }}"""
mainScript = 'main.nf'
nextflowVersion = '!>=23.04.0'
nextflowVersion = '!>=23.10.0'
version = '{{ version }}'
doi = ''
}

{% if nf_schema -%}
// Nextflow plugins
plugins {
id '[email protected]' // Validation of pipeline parameters and creation of an input channel from a sample sheet
}

validation {
defaultIgnoreParams = ["genomes", "helpFull", "showHidden", "help-full", "show-hidden"] // The last 4 parameters are here because of a bug in nf-schema. This will be fixed in a later version
nvnieuwk marked this conversation as resolved.
Show resolved Hide resolved
help {
enabled = true
command = "nextflow run $manifest.name -profile <docker/singularity/.../institute> --input samplesheet.csv --outdir <OUTDIR>"
fullParameter = "help_full"
showHiddenParameter = "show_hidden"
{%- if is_nfcore %}
beforeText = """
-\033[2m----------------------------------------------------\033[0m-
\033[0;32m,--.\033[0;30m/\033[0;32m,-.\033[0m
\033[0;34m ___ __ __ __ ___ \033[0;32m/,-._.--~\'\033[0m
\033[0;34m |\\ | |__ __ / ` / \\ |__) |__ \033[0;33m} {\033[0m
\033[0;34m | \\| | \\__, \\__/ | \\ |___ \033[0;32m\\`-._,-`-,\033[0m
\033[0;32m`._,._,\'\033[0m
\033[0;35m ${manifest.name} ${manifest.version}\033[0m
-\033[2m----------------------------------------------------\033[0m-
"""
afterText = """${manifest.doi ? "* The pipeline\n" : ""}${manifest.doi.tokenize(",").collect { " https://doi.org/${it.trim().replace('https://doi.org/','')}"}.join("\n")}${manifest.doi ? "\n" : ""}
* The nf-core framework
https://doi.org/10.1038/s41587-020-0439-x

* Software dependencies
https://github.com/${manifest.name}/blob/master/CITATIONS.md
"""{% endif %}
}{% if is_nfcore %}
summary {
beforeText = validation.help.beforeText
afterText = validation.help.afterText
}{% endif %}
}
{% endif -%}

// Load modules.config for DSL2 module specific options
includeConfig 'conf/modules.config'

Expand Down
52 changes: 16 additions & 36 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/{{ name }}/master/nextflow_schema.json",
"title": "{{ name }} pipeline parameters",
"description": "{{ description }}",
"type": "object",
"definitions": {
"$defs": {
"input_output_options": {
"title": "Input/output options",
"type": "object",
Expand Down Expand Up @@ -40,8 +40,7 @@
"type": "string",
"description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
"fa_icon": "fas fa-file-signature"
}
{% endif %}
}{% endif %}
}
},
{%- if igenomes %}
Expand Down Expand Up @@ -73,6 +72,14 @@
"fa_icon": "fas fa-ban",
"hidden": true,
"help_text": "Do not load `igenomes.config` when running the pipeline. You may choose this option if you observe clashes between custom parameters and those supplied in `igenomes.config`."
},
"igenomes_base": {
"type": "string",
"format": "directory-path",
"description": "The base path to the igenomes reference files",
"fa_icon": "fas fa-ban",
"hidden": true,
"default": "s3://ngi-igenomes/igenomes/"
}
}
},
Expand Down Expand Up @@ -169,12 +176,6 @@
"description": "Less common options for the pipeline, typically set in a config file.",
"help_text": "These options are common to all nf-core pipelines and allow you to customise some of the core preferences for how the pipeline runs.\n\nTypically these options would be set in a Nextflow config file loaded for all pipeline runs, such as `~/.nextflow/config`.",
"properties": {
"help": {
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
"type": "boolean",
"description": "Display help text.",
"fa_icon": "fas fa-question-circle",
"hidden": true
},
"version": {
"type": "boolean",
"description": "Display version and exit.",
Expand Down Expand Up @@ -252,27 +253,6 @@
"default": true,
"fa_icon": "fas fa-check-square",
"hidden": true
},
"validationShowHiddenParams": {
"type": "boolean",
"fa_icon": "far fa-eye-slash",
"description": "Show all params when using `--help`",
"hidden": true,
"help_text": "By default, parameters set as _hidden_ in the schema are not shown on the command line when a user runs with `--help`. Specifying this option will tell the pipeline to show all parameters."
},
"validationFailUnrecognisedParams": {
"type": "boolean",
"fa_icon": "far fa-check-circle",
"description": "Validation of parameters fails when an unrecognised parameter is found.",
"hidden": true,
"help_text": "By default, when an unrecognised parameter is found, it returns a warinig."
},
"validationLenientMode": {
"type": "boolean",
"fa_icon": "far fa-check-circle",
"description": "Validation of parameters in lenient more.",
"hidden": true,
"help_text": "Allows string values that are parseable as numbers or booleans. For further information see [JSONSchema docs](https://github.com/everit-org/json-schema#lenient-mode)."
}{% if test_config %},
"pipelines_testdata_base_path": {
"type": "string",
Expand All @@ -286,19 +266,19 @@
},
"allOf": [
{
"$ref": "#/definitions/input_output_options"
"$ref": "#/$defs/input_output_options"
},
{% if igenomes %}{
"$ref": "#/definitions/reference_genome_options"
"$ref": "#/$defs/reference_genome_options"
},{% endif %}
{% if nf_core_configs %}{
"$ref": "#/definitions/institutional_config_options"
"$ref": "#/$defs/institutional_config_options"
},{% endif %}
{
"$ref": "#/definitions/max_job_request_options"
"$ref": "#/$defs/max_job_request_options"
},
{
"$ref": "#/definitions/generic_options"
"$ref": "#/$defs/generic_options"
}
]
}
Loading
Loading