+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.12.1 ([#3648](https://github.com/nf-core/tools/pull/3648))
- Update error message for rocrate_readme_sync ([#3652](https://github.com/nf-core/tools/pull/3652))
- Update `nf-core modules info` command after `meta.yml` restructuring ([#3659](https://github.com/nf-core/tools/pull/3659))
- Enable parsing of multi-line config values ([#3629](https://github.com/nf-core/tools/pull/3629))

## [v3.3.1 - Tungsten Tamarin Patch](https://github.com/nf-core/tools/releases/tag/3.3.1) - [2025-06-02]

Expand Down
4 changes: 3 additions & 1 deletion nf_core/pipelines/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,9 @@ def rectify_raw_container_matches(self, raw_findings):
"""
direct_match = re.match(either_url_or_docker, container_value.strip())
if direct_match:
cleaned_matches.append(direct_match.group(0))
# eliminate known false positives also from direct matches
if direct_match.group(0) not in ["singularity", "apptainer"]:
cleaned_matches.append(direct_match.group(0))
continue # oh yes, that was plain sailing

"""
Expand Down
25 changes: 17 additions & 8 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,21 @@ def fetch_wf_config(wf_path: Path, cache_config: bool = True) -> dict:
result = run_cmd("nextflow", f"config -flat {wf_path}")
if result is not None:
nfconfig_raw, _ = result
for line in nfconfig_raw.splitlines():
ul = line.decode("utf-8")
try:
k, v = ul.split(" = ", 1)
config[k] = v.strip("'\"")
except ValueError:
log.debug(f"Couldn't find key=value config pair:\n {ul}")
nfconfig = nfconfig_raw.decode("utf-8")
multiline_key_value_pattern = re.compile(r"(^|\n)([^\n=]+?)\s*=\s*((?:(?!\n[^\n=]+?\s*=).)*)", re.DOTALL)

for config_match in multiline_key_value_pattern.finditer(nfconfig):
k = config_match.group(2).strip()
v = config_match.group(3).strip().strip("'\"")
if k and v == "":
config[k] = "null"
log.debug(f"Config key: {k}, value: empty string")
elif k and v:
config[k] = v
log.debug(f"Config key: {k}, value: {v}")
else:
log.debug(f"Couldn't find key=value config pair:\n {config_match.group(0)}")
del config_match

# Scrape main.nf for additional parameter declarations
# Values in this file are likely to be complex, so don't both trying to capture them. Just get the param name.
Expand All @@ -341,8 +349,9 @@ def fetch_wf_config(wf_path: Path, cache_config: bool = True) -> dict:
for line in fh:
line_str = line.decode("utf-8")
match = re.match(r"^\s*(params\.[a-zA-Z0-9_]+)\s*=(?!=)", line_str)
if match:
if match and match.group(1):
config[match.group(1)] = "null"

except FileNotFoundError as e:
log.debug(f"Could not open {main_nf} to look for parameter declarations - {e}")

Expand Down
8 changes: 8 additions & 0 deletions tests/data/mock_config_containers/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ process {
container = { "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/r-shinyngs:1.7.1--r42hdfd78af_1':'quay.io/biocontainers/r-shinyngs:1.7.1--r42hdfd78af_1' }" }
}

// example from nf-core/pairgenomealign 2.2.0

withName:'ALIGNMENT_.*' {
container = { "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/06/06beccfa4d48e5daf30dd8cee4f7e06fd51594963db0d5087ab695365b79903b/data' :
'community.wave.seqera.io/library/last_samtools_open-fonts:176a6ab0c8171057'}" }
}

}
24 changes: 16 additions & 8 deletions tests/pipelines/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,30 @@ def test__find_container_images_config_nextflow(self, tmp_path, mock_fetch_wf_co
if result is not None:
nfconfig_raw, _ = result
config = {}
for line in nfconfig_raw.splitlines():
ul = line.decode("utf-8")
try:
k, v = ul.split(" = ", 1)
config[k] = v.strip("'\"")
except ValueError:
pass
nfconfig = nfconfig_raw.decode("utf-8")
multiline_key_value_pattern = re.compile(r"(^|\n)([^\n=]+?)\s*=\s*((?:(?!\n[^\n=]+?\s*=).)*)", re.DOTALL)

for match in multiline_key_value_pattern.finditer(nfconfig):
k = match.group(2).strip()
v = match.group(3).strip().strip("'\"")
if k and v:
config[k] = v
mock_fetch_wf_config.return_value = config
download_obj.find_container_images("workflow")
assert len(download_obj.containers) == 4
assert "nfcore/methylseq:1.0" in download_obj.containers
assert "nfcore/methylseq:1.4" in download_obj.containers
assert "nfcore/sarek:dev" in download_obj.containers
assert (
"https://depot.galaxyproject.org/singularity/r-shinyngs:1.7.1--r42hdfd78af_1" in download_obj.containers
)
assert (
"https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/06/06beccfa4d48e5daf30dd8cee4f7e06fd51594963db0d5087ab695365b79903b/data"
in download_obj.containers
)
assert (
"community.wave.seqera.io/library/last_samtools_open-fonts:176a6ab0c8171057" in download_obj.containers
)
assert "singularity" not in download_obj.containers
# does not yet pick up nfcore/sarekvep:dev.${params.genome}, because that is no valid URL or Docker URI.

#
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载