Skip to content

Commit

Permalink
Merge pull request #3280 from mirpedrol/run-pre-commit-with-lint-tests
Browse files Browse the repository at this point in the history
General: Run pre-commit when testing linting the template pipeline
  • Loading branch information
mirpedrol authored Nov 14, 2024
2 parents 0848508 + 269af7d commit d26c3e9
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion nf_core/pipeline-template/conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
6 changes: 4 additions & 2 deletions nf_core/pipeline-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
}
Expand Down
33 changes: 21 additions & 12 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,7 +64,8 @@ params {
config_profile_url = null
{%- endif %}

{% if nf_schema -%}
{%- if nf_schema %}

// Schema validation default options
validate_params = true
{%- endif %}
Expand Down Expand Up @@ -173,7 +182,7 @@ profiles {
wave.freeze = true
wave.strategy = 'conda,container'
}
{% if gitpod -%}
{%- if gitpod %}
gitpod {
executor.name = 'local'
executor.cpus = 4
Expand All @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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()

Expand All @@ -250,8 +254,10 @@ def toolBibliographyText() {
// Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "<li>Author (2023) Pub name, Journal, DOI</li>" : "",
// Uncomment function in methodsDescriptionText to render in MultiQC report
def reference_text = [
{% if fastqc %}"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",{% endif %}
{% if multiqc %}"<li>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</li>"{% endif %}
{%- if fastqc %}
"<li>Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).</li>",{% endif %}
{%- if multiqc %}
"<li>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</li>"{% endif %}
].join(' ').trim()

return reference_text
Expand Down
18 changes: 12 additions & 6 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

/*
Expand All @@ -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 %}
//
Expand Down

0 comments on commit d26c3e9

Please sign in to comment.