From a974b6ac2b8c05d23d716ee0a91c98af7eb8bc9f Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 14 Nov 2024 10:27:43 +0100 Subject: [PATCH 1/3] run pre-commit when testing linting the template pipeline --- .github/workflows/create-test-lint-wf-template.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index 2672d1e21..b38c1ea5a 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -152,6 +152,12 @@ jobs: run: nf-core --log-file log.txt --hide-progress pipelines lint --dir my-prefix-testpipeline --fail-warned working-directory: create-test-lint-wf + # Run code style linting + - name: run pre-commit + shell: bash + run: pre-commit run --all-files + working-directory: create-test-lint-wf + # Run bump-version - name: nf-core pipelines bump-version run: nf-core --log-file log.txt pipelines bump-version --dir my-prefix-testpipeline/ 1.1 From 555d88eafb45219bd20e171e22cbcac4a19b0076 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 14 Nov 2024 09:43:27 +0000 Subject: [PATCH 2/3] [automated] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a449cf681..b15fe92c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ ### Linting +- General: Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280)) + ### Modules - add a panel around diff previews when updating ([#3246](https://github.com/nf-core/tools/pull/3246)) From 269af7d0a676d7466e25a1d41dd4b34ef752e90a Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 14 Nov 2024 11:25:51 +0100 Subject: [PATCH 3/3] fix template trailing spaces --- nf_core/pipeline-template/conf/modules.config | 4 ++- nf_core/pipeline-template/main.nf | 6 ++-- nf_core/pipeline-template/nextflow.config | 33 ++++++++++++------- .../utils_nfcore_pipeline_pipeline/main.nf | 18 ++++++---- .../pipeline-template/workflows/pipeline.nf | 18 ++++++---- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/nf_core/pipeline-template/conf/modules.config b/nf_core/pipeline-template/conf/modules.config index 35e861d9b..1614e2b1a 100644 --- a/nf_core/pipeline-template/conf/modules.config +++ b/nf_core/pipeline-template/conf/modules.config @@ -18,13 +18,15 @@ process { saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] - {% if fastqc -%} + {%- if fastqc %} + withName: FASTQC { ext.args = '--quiet' } {%- endif %} {%- if multiqc %} + withName: 'MULTIQC' { ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } publishDir = [ diff --git a/nf_core/pipeline-template/main.nf b/nf_core/pipeline-template/main.nf index 6644d74a2..70bdc274e 100644 --- a/nf_core/pipeline-template/main.nf +++ b/nf_core/pipeline-template/main.nf @@ -109,8 +109,10 @@ workflow { {%- endif %} params.outdir, params.monochrome_logs, - {% if adaptivecard or slackreport %}params.hook_url,{% endif %} - {% if multiqc %}{{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report{% endif %} + {%- if adaptivecard or slackreport %} + params.hook_url,{% endif %} + {%- if multiqc %} + {{ prefix_nodash|upper }}_{{ short_name|upper }}.out.multiqc_report{% endif %} ) {%- endif %} } diff --git a/nf_core/pipeline-template/nextflow.config b/nf_core/pipeline-template/nextflow.config index 599998f38..6970d0518 100644 --- a/nf_core/pipeline-template/nextflow.config +++ b/nf_core/pipeline-template/nextflow.config @@ -13,39 +13,47 @@ params { // Input options input = null - {% if igenomes -%} + {%- if igenomes %} + // References genome = null igenomes_base = 's3://ngi-igenomes/igenomes/' igenomes_ignore = false {%- endif %} - {% if multiqc -%} + {%- 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 - {% if modules %}publish_dir_mode = 'copy'{% endif %} + {%- if modules %} + publish_dir_mode = 'copy'{% endif %} {%- if email %} email = null email_on_fail = null plaintext_email = false {%- endif %} - {% if modules %}monochrome_logs = false{% endif %} - {% if slackreport or adaptivecard %}hook_url = null{% endif %} - {% if nf_schema %}help = false + {%- if modules %} + monochrome_logs = false{% endif %} + {%- if slackreport or adaptivecard %} + hook_url = null{% endif %} + {%- 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 %} + {%- if test_config %} + pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/'{% endif %} - {% if nf_core_configs -%} + {%- if nf_core_configs -%} // Config options config_profile_name = null config_profile_description = null @@ -56,7 +64,8 @@ params { config_profile_url = null {%- endif %} - {% if nf_schema -%} + {%- if nf_schema %} + // Schema validation default options validate_params = true {%- endif %} @@ -173,7 +182,7 @@ profiles { wave.freeze = true wave.strategy = 'conda,container' } - {% if gitpod -%} + {%- if gitpod %} gitpod { executor.name = 'local' executor.cpus = 4 @@ -187,7 +196,7 @@ profiles { } } {%- endif %} - {% if test_config -%} + {%- if test_config %} test { includeConfig 'conf/test.config' } test_full { includeConfig 'conf/test_full.config' } {%- endif %} diff --git a/nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf b/nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf index 263eca55d..be5776b83 100644 --- a/nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf +++ b/nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf @@ -128,8 +128,10 @@ workflow PIPELINE_COMPLETION { {%- endif %} outdir // path: Path to output directory where results will be published monochrome_logs // boolean: Disable ANSI colour codes in log output - {% if adaptivecard or slackreport %}hook_url // string: hook URL for notifications{% endif %} - {% if multiqc %}multiqc_report // string: Path to MultiQC report{% endif %} + {%- if adaptivecard or slackreport %} + hook_url // string: hook URL for notifications{% endif %} + {%- if multiqc %} + multiqc_report // string: Path to MultiQC report{% endif %} main: {%- if nf_schema %} @@ -237,8 +239,10 @@ def toolCitationText() { // Uncomment function in methodsDescriptionText to render in MultiQC report def citation_text = [ "Tools used in the workflow included:", - {% if fastqc %}"FastQC (Andrews 2010),",{% endif %} - {% if multiqc %}"MultiQC (Ewels et al. 2016)",{% endif %} + {%- if fastqc %} + "FastQC (Andrews 2010),",{% endif %} + {%- if multiqc %} + "MultiQC (Ewels et al. 2016)",{% endif %} "." ].join(' ').trim() @@ -250,8 +254,10 @@ def toolBibliographyText() { // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "
  • Author (2023) Pub name, Journal, DOI
  • " : "", // Uncomment function in methodsDescriptionText to render in MultiQC report def reference_text = [ - {% if fastqc %}"
  • Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).
  • ",{% endif %} - {% if multiqc %}"
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354
  • "{% endif %} + {%- if fastqc %} + "
  • Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).
  • ",{% endif %} + {%- if multiqc %} + "
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354
  • "{% endif %} ].join(' ').trim() return reference_text diff --git a/nf_core/pipeline-template/workflows/pipeline.nf b/nf_core/pipeline-template/workflows/pipeline.nf index 4dd8674c1..6126f9ec6 100644 --- a/nf_core/pipeline-template/workflows/pipeline.nf +++ b/nf_core/pipeline-template/workflows/pipeline.nf @@ -5,12 +5,17 @@ */ {%- if modules %} -{% if fastqc %}include { FASTQC } from '../modules/nf-core/fastqc/main'{% endif %} -{% if multiqc %}include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %} -{% if nf_schema %}include { paramsSummaryMap } from 'plugin/nf-schema'{% endif %} -{% if multiqc %}include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %} +{%- if fastqc %} +include { FASTQC } from '../modules/nf-core/fastqc/main'{% endif %} +{%- if multiqc %} +include { MULTIQC } from '../modules/nf-core/multiqc/main'{% endif %} +{%- if nf_schema %} +include { paramsSummaryMap } from 'plugin/nf-schema'{% endif %} +{%- if multiqc %} +include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'{% endif %} include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline' -{% if citations or multiqc %}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 %} {%- endif %} /* @@ -28,7 +33,8 @@ workflow {{ short_name|upper }} { main: ch_versions = Channel.empty() - {% if multiqc %}ch_multiqc_files = Channel.empty(){% endif %} + {%- if multiqc %} + ch_multiqc_files = Channel.empty(){% endif %} {%- if fastqc %} //