Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/nf-core/tools into remove-ch…
Browse files Browse the repository at this point in the history
…annel-operations-from-oncomplete
  • Loading branch information
mirpedrol committed Dec 3, 2024
2 parents 4b2338f + a7351a2 commit 2475ad1
Show file tree
Hide file tree
Showing 28 changed files with 632 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
rev: v0.8.1
hooks:
- id: ruff # linter
args: [--fix, --exit-non-zero-on-fix] # sort imports and fix
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
- Fix a typo ([#3268](https://github.com/nf-core/tools/pull/3268))
- Remove `def` from `nextflow.config` and add `trace_report_suffix` param ([#3296](https://github.com/nf-core/tools/pull/3296))
- Move `includeConfig 'conf/modules.config'` next to `includeConfig 'conf/base.config'` to not overwrite tests profiles configurations ([#3301](https://github.com/nf-core/tools/pull/3301))
- Use `params.monochrome_logs` in the template and update nf-core components ([#3310](https://github.com/nf-core/tools/pull/3310))
- Fix some typos and improve writing in `usage.md` and `CONTRIBUTING.md` ([#3302](https://github.com/nf-core/tools/pull/3302))
- Add `manifest.contributors` to `nextflow.config` ([#3311](https://github.com/nf-core/tools/pull/3311))

### Download

- First steps towards fixing [#3179](https://github.com/nf-core/tools/issues/3179): Modify `prioritize_direct_download()` to retain Seqera Singularity https:// Container URIs and hardcode Seqera Containers into `gather_registries()` ([#3244](https://github.com/nf-core/tools/pull/3244)).
- Further steps towards fixing [#3179](https://github.com/nf-core/tools/issues/3179): Enable limited support for `oras://` container paths (_only absolute URIs, no flexible registries like with Docker_) and prevent unnecessary image downloads for Seqera Container modules with `reconcile_seqera_container_uris()` ([#3293](https://github.com/nf-core/tools/pull/3293)).
- Update dawidd6/action-download-artifact action to v7 ([#3306](https://github.com/nf-core/tools/pull/3306))

### Linting

- General: Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
- allow mixed `str` and `dict` entries in lint config ([#3228](https://github.com/nf-core/tools/pull/3228))

### Modules

Expand Down Expand Up @@ -49,6 +54,8 @@
- Update codecov/codecov-action action to v5 ([#3283](https://github.com/nf-core/tools/pull/3283))
- Update python:3.12-slim Docker digest to 2a6386a ([#3284](https://github.com/nf-core/tools/pull/3284))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 ([#3299](https://github.com/nf-core/tools/pull/3299))
- Update gitpod/workspace-base Docker digest to 12853f7 ([#3309](https://github.com/nf-core/tools/pull/3309))
- Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
- Remove toList() channel operation from inside onComplete block ([#3304](https://github.com/nf-core/tools/pull/3304))

## [v3.0.2 - Titanium Tapir Patch](https://github.com/nf-core/tools/releases/tag/3.0.2) - [2024-10-11]
Expand Down
4 changes: 2 additions & 2 deletions nf_core/components/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from nf_core.components.nfcore_component import NFCoreComponent
from nf_core.modules.modules_json import ModulesJson
from nf_core.pipelines.lint_utils import console
from nf_core.utils import LintConfigType
from nf_core.utils import NFCoreYamlLintConfig
from nf_core.utils import plural_s as _s

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(
self.failed: List[LintResult] = []
self.all_local_components: List[NFCoreComponent] = []

self.lint_config: Optional[LintConfigType] = None
self.lint_config: Optional[NFCoreYamlLintConfig] = None
self.modules_json: Optional[ModulesJson] = None

if self.component_type == "modules":
Expand Down
2 changes: 1 addition & 1 deletion nf_core/gitpod/gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build -t gitpod:test -f nf_core/gitpod/gitpod.Dockerfile .

# See https://docs.renovatebot.com/docker/#digest-pinning for why a digest is used.
FROM gitpod/workspace-base@sha256:2cc134fe5bd7d8fdbe44cab294925d4bc6d2d178d94624f4c376584a22d1f7b6
FROM gitpod/workspace-base@sha256:12853f7c901eb2b677a549cb112c85f9679d18feb30093bcc63aa252540ecad9

USER root

Expand Down
10 changes: 5 additions & 5 deletions nf_core/pipeline-template/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{ name }}: Contributing Guidelines
# `{{ name }}`: Contributing Guidelines

Hi there!
Many thanks for taking an interest in improving {{ name }}.
Expand Down Expand Up @@ -66,7 +66,7 @@ These tests are run both with the latest available version of `Nextflow` and als

- On your own fork, make a new branch `patch` based on `upstream/master`.
- Fix the bug, and bump version (X.Y.Z+1).
- A PR should be made on `master` from patch to directly this particular bug.
- Open a pull-request from `patch` to `master` with the changes.

{% if is_nfcore -%}

Expand All @@ -78,13 +78,13 @@ For further information/help, please consult the [{{ name }} documentation](http

## Pipeline contribution conventions

To make the {{ name }} code and processing logic more understandable for new contributors and to ensure quality, we semi-standardise the way the code and other contributions are written.
To make the `{{ name }}` code and processing logic more understandable for new contributors and to ensure quality, we semi-standardise the way the code and other contributions are written.

### Adding a new step

If you wish to contribute a new step, please use the following coding standards:

1. Define the corresponding input channel into your new process from the expected previous process channel
1. Define the corresponding input channel into your new process from the expected previous process channel.
2. Write the process block (see below).
3. Define the output channel if needed (see below).
4. Add any new parameters to `nextflow.config` with a default (see below).
Expand All @@ -99,7 +99,7 @@ If you wish to contribute a new step, please use the following coding standards:

### Default values

Parameters should be initialised / defined with default values in `nextflow.config` under the `params` scope.
Parameters should be initialised / defined with default values within the `params` scope in `nextflow.config`.

Once there, use `nf-core pipelines schema build` to add to `nextflow_schema.json`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download lint results
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7
with:
workflow: linting.yml
workflow_conclusion: completed
Expand Down
28 changes: 12 additions & 16 deletions nf_core/pipeline-template/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ If you wish to repeatedly use the same parameters for multiple runs, rather than

Pipeline settings can be provided in a `yaml` or `json` file via `-params-file <file>`.

:::warning
Do not use `-c <file>` to specify parameters as this will result in errors. Custom config files specified with `-c` must only be used for [tuning process resource specifications](https://nf-co.re/docs/usage/configuration#tuning-workflow-resources), other infrastructural tweaks (such as output directories), or module arguments (args).
:::
> [!WARNING]
> Do not use `-c <file>` to specify parameters as this will result in errors. Custom config files specified with `-c` must only be used for [tuning process resource specifications](https://nf-co.re/docs/usage/configuration#tuning-workflow-resources), other infrastructural tweaks (such as output directories), or module arguments (args).
The above pipeline run specified with a params file in yaml format:

Expand Down Expand Up @@ -110,37 +109,34 @@ nextflow pull {{ name }}

### Reproducibility

It is a good idea to specify a pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you'll be running the same version of the pipeline, even if there have been changes to the code since.
It is a good idea to specify the pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you'll be running the same version of the pipeline, even if there have been changes to the code since.

First, go to the [{{ name }} releases page](https://github.com/{{ name }}/releases) and find the latest pipeline version - numeric only (eg. `1.3.1`). Then specify this when running the pipeline with `-r` (one hyphen) - eg. `-r 1.3.1`. Of course, you can switch to another version by changing the number after the `-r` flag.

This version number will be logged in reports when you run the pipeline, so that you'll know what you used when you look back in the future. {% if multiqc %}For example, at the bottom of the MultiQC reports.{% endif %}

To further assist in reproducibility, you can use share and reuse [parameter files](#running-the-pipeline) to repeat pipeline runs with the same settings without having to write out a command with every single parameter.

:::tip
If you wish to share such profile (such as upload as supplementary material for academic publications), make sure to NOT include cluster specific paths to files, nor institutional specific profiles.
:::
> [!TIP]
> If you wish to share such profile (such as upload as supplementary material for academic publications), make sure to NOT include cluster specific paths to files, nor institutional specific profiles.
## Core Nextflow arguments

:::note
These options are part of Nextflow and use a _single_ hyphen (pipeline parameters use a double-hyphen).
:::
> [!NOTE]
> These options are part of Nextflow and use a _single_ hyphen (pipeline parameters use a double-hyphen)
### `-profile`

Use this parameter to choose a configuration profile. Profiles can give configuration presets for different compute environments.

Several generic profiles are bundled with the pipeline which instruct the pipeline to use software packaged using different methods (Docker, Singularity, Podman, Shifter, Charliecloud, Apptainer, Conda) - see below.

:::info
We highly recommend the use of Docker or Singularity containers for full pipeline reproducibility, however when this is not possible, Conda is also supported.
:::
> [!IMPORTANT]
> We highly recommend the use of Docker or Singularity containers for full pipeline reproducibility, however when this is not possible, Conda is also supported.
{%- if nf_core_configs %}

The pipeline also dynamically loads configurations from [https://github.com/nf-core/configs](https://github.com/nf-core/configs) when it runs, making multiple config profiles for various institutional clusters available at run time. For more information and to see if your system is available in these configs please see the [nf-core/configs documentation](https://github.com/nf-core/configs#documentation).
The pipeline also dynamically loads configurations from [https://github.com/nf-core/configs](https://github.com/nf-core/configs) when it runs, making multiple config profiles for various institutional clusters available at run time. For more information and to check if your system is suported, please see the [nf-core/configs documentation](https://github.com/nf-core/configs#documentation).
{% else %}
{% endif %}
Note that multiple profiles can be loaded, for example: `-profile test,docker` - the order of arguments is important!
Expand Down Expand Up @@ -185,13 +181,13 @@ Specify the path to a specific config file (this is a core Nextflow command). Se

### Resource requests

Whilst the default requirements set within the pipeline will hopefully work for most people and with most input data, you may find that you want to customise the compute resources that the pipeline requests. Each step in the pipeline has a default set of requirements for number of CPUs, memory and time. For most of the steps in the pipeline, if the job exits with any of the error codes specified [here](https://github.com/nf-core/rnaseq/blob/4c27ef5610c87db00c3c5a3eed10b1d161abf575/conf/base.config#L18) it will automatically be resubmitted with higher requests (2 x original, then 3 x original). If it still fails after the third attempt then the pipeline execution is stopped.
Whilst the default requirements set within the pipeline will hopefully work for most people and with most input data, you may find that you want to customise the compute resources that the pipeline requests. Each step in the pipeline has a default set of requirements for number of CPUs, memory and time. For most of the pipeline steps, if the job exits with any of the error codes specified [here](https://github.com/nf-core/rnaseq/blob/4c27ef5610c87db00c3c5a3eed10b1d161abf575/conf/base.config#L18) it will automatically be resubmitted with higher resources request (2 x original, then 3 x original). If it still fails after the third attempt then the pipeline execution is stopped.

To change the resource requests, please see the [max resources](https://nf-co.re/docs/usage/configuration#max-resources) and [tuning workflow resources](https://nf-co.re/docs/usage/configuration#tuning-workflow-resources) section of the nf-core website.

### Custom Containers

In some cases you may wish to change which container or conda environment a step of the pipeline uses for a particular tool. By default nf-core pipelines use containers and software from the [biocontainers](https://biocontainers.pro/) or [bioconda](https://bioconda.github.io/) projects. However in some cases the pipeline specified version maybe out of date.
In some cases, you may wish to change the container or conda environment used by a pipeline steps for a particular tool. By default, nf-core pipelines use containers and software from the [biocontainers](https://biocontainers.pro/) or [bioconda](https://bioconda.github.io/) projects. However, in some cases the pipeline specified version maybe out of date.

To use a different container from the default container or conda environment specified in a pipeline, please see the [updating tool versions](https://nf-co.re/docs/usage/configuration#updating-tool-versions) section of the nf-core website.

Expand Down
18 changes: 16 additions & 2 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ params {
email_on_fail = null
plaintext_email = false
{%- endif %}
{%- if modules %}
{%- if modules or nf_schema %}
monochrome_logs = false{% endif %}
{%- if slackreport or adaptivecard %}
hook_url = null{% endif %}
Expand Down Expand Up @@ -274,7 +274,20 @@ dag {

manifest {
name = '{{ name }}'
author = """{{ author }}"""
author = """{{ author }}""" // The author field is deprecated from Nextflow version 24.10.0, use contributors instead
contributors = [
// TODO nf-core: Update the field with the details of the contributors to your pipeline. New with Nextflow version 24.10.0
{%- for author_name in author.split(",") %}
[
name: '{{ author_name }}',
affiliation: '',
email: '',
github: '',
contribution: [], // List of contribution types ('author', 'maintainer' or 'contributor')
orcid: ''
],
{%- endfor %}
]
homePage = 'https://github.com/{{ name }}'
description = """{{ description }}"""
mainScript = 'main.nf'
Expand All @@ -291,6 +304,7 @@ plugins {

validation {
defaultIgnoreParams = ["genomes"]
monochromeLogs = params.monochrome_logs
help {
enabled = true
command = "nextflow run {{ name }} -profile <docker/singularity/.../institute> --input samplesheet.csv --outdir <OUTDIR>"
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"fa_icon": "fas fa-file-upload",
"hidden": true
},{% endif %}
{%- if modules %}
{%- if modules or nf_schema %}
"monochrome_logs": {
"type": "boolean",
"description": "Do not use coloured log outputs.",
Expand Down
16 changes: 8 additions & 8 deletions nf_core/pipelines/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
import shutil
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union, cast
from typing import Dict, List, Optional, Tuple, Union

import git
import git.config
Expand All @@ -22,7 +22,7 @@
from nf_core.pipelines.create_logo import create_logo
from nf_core.pipelines.lint_utils import run_prettier_on_file
from nf_core.pipelines.rocrate import ROCrate
from nf_core.utils import LintConfigType, NFCoreTemplateConfig
from nf_core.utils import NFCoreTemplateConfig, NFCoreYamlLintConfig

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(
_, config_yml = nf_core.utils.load_tools_config(outdir if outdir else Path().cwd())
# Obtain a CreateConfig object from `.nf-core.yml` config file
if config_yml is not None and getattr(config_yml, "template", None) is not None:
self.config = CreateConfig(**config_yml["template"].model_dump())
self.config = CreateConfig(**config_yml["template"].model_dump(exclude_none=True))
else:
raise UserWarning("The template configuration was not provided in '.nf-core.yml'.")
# Update the output directory
Expand Down Expand Up @@ -206,7 +206,7 @@ def obtain_jinja_params_dict(
config_yml = None

# Set the parameters for the jinja template
jinja_params = self.config.model_dump()
jinja_params = self.config.model_dump(exclude_none=True)

# Add template areas to jinja params and create list of areas with paths to skip
skip_areas = []
Expand Down Expand Up @@ -369,8 +369,8 @@ def render_template(self) -> None:
config_fn, config_yml = nf_core.utils.load_tools_config(self.outdir)
if config_fn is not None and config_yml is not None:
with open(str(config_fn), "w") as fh:
config_yml.template = NFCoreTemplateConfig(**self.config.model_dump())
yaml.safe_dump(config_yml.model_dump(), fh)
config_yml.template = NFCoreTemplateConfig(**self.config.model_dump(exclude_none=True))
yaml.safe_dump(config_yml.model_dump(exclude_none=True), fh)
log.debug(f"Dumping pipeline template yml to pipeline config file '{config_fn.name}'")

# Run prettier on files
Expand Down Expand Up @@ -401,9 +401,9 @@ def fix_linting(self):
# Add the lint content to the preexisting nf-core config
config_fn, nf_core_yml = nf_core.utils.load_tools_config(self.outdir)
if config_fn is not None and nf_core_yml is not None:
nf_core_yml.lint = cast(LintConfigType, lint_config)
nf_core_yml.lint = NFCoreYamlLintConfig(**lint_config)
with open(self.outdir / config_fn, "w") as fh:
yaml.dump(nf_core_yml.model_dump(), fh, default_flow_style=False, sort_keys=False)
yaml.dump(nf_core_yml.model_dump(exclude_none=True), fh, default_flow_style=False, sort_keys=False)

def make_pipeline_logo(self):
"""Fetch a logo for the new pipeline from the nf-core website"""
Expand Down
Loading

0 comments on commit 2475ad1

Please sign in to comment.