From d0a24be2c7da106f45aafd1be763cb772e0a9fa3 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Wed, 2 Oct 2024 09:52:14 +0200 Subject: [PATCH] udpate yaml config only in pipeline repos --- nf_core/utils.py | 93 ++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 7fcb6026f..4e29994ca 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -1136,52 +1136,53 @@ def load_tools_config(directory: Union[str, Path] = ".") -> Tuple[Optional[Path] error_message += f"\n{error['loc'][0]}: {error['msg']}" raise AssertionError(error_message) - # Retrieve information if template from config file is empty - wf_config = fetch_wf_config(Path(directory)) - config_template_keys = tools_config["template"].keys() if "template" in tools_config else [] - if nf_core_yaml_config.template is None: - # The .nf-core.yml file did not contain template information - nf_core_yaml_config.template = NFCoreTemplateConfig( - org="nf-core", - name=wf_config["manifest.name"].strip('"').strip("'").split("/")[-1], - description=wf_config["manifest.description"].strip('"').strip("'"), - author=wf_config["manifest.author"].strip('"').strip("'"), - version=wf_config["manifest.version"].strip('"').strip("'"), - outdir=str(directory), - is_nfcore=True, - ) - elif "prefix" in config_template_keys or "skip" in config_template_keys: - # The .nf-core.yml file contained the old prefix or skip keys - nf_core_yaml_config.template = NFCoreTemplateConfig( - org=tools_config["template"]["prefix"] - if "prefix" in config_template_keys - else tools_config["template"]["org"] - if "org" in config_template_keys - else "nf-core", - name=tools_config["template"]["name"] - if "name" in config_template_keys - else wf_config["manifest.name"].strip('"').strip("'").split("/")[-1], - description=tools_config["template"]["description"] - if "description" in config_template_keys - else wf_config["manifest.description"].strip('"').strip("'"), - author=tools_config["template"]["author"] - if "author" in config_template_keys - else wf_config["manifest.author"].strip('"').strip("'"), - version=tools_config["template"]["version"] - if "version" in config_template_keys - else wf_config["manifest.version"].strip('"').strip("'"), - outdir=tools_config["template"]["outdir"] if "outdir" in config_template_keys else str(directory), - skip_features=tools_config["template"]["skip"] - if "skip" in config_template_keys - else tools_config["template"]["skip_features"] - if "skip_features" in config_template_keys - else None, - is_nfcore=tools_config["template"]["prefix"] == "nf-core" - if "prefix" in config_template_keys - else tools_config["template"]["org"] == "nf-core" - if "org" in config_template_keys - else True, - ) + if nf_core_yaml_config["repository_type"] == "pipeline": + # Retrieve information if template from config file is empty + wf_config = fetch_wf_config(Path(directory)) + config_template_keys = tools_config["template"].keys() if "template" in tools_config else [] + if nf_core_yaml_config.template is None: + # The .nf-core.yml file did not contain template information + nf_core_yaml_config.template = NFCoreTemplateConfig( + org="nf-core", + name=wf_config["manifest.name"].strip('"').strip("'").split("/")[-1], + description=wf_config["manifest.description"].strip('"').strip("'"), + author=wf_config["manifest.author"].strip('"').strip("'"), + version=wf_config["manifest.version"].strip('"').strip("'"), + outdir=str(directory), + is_nfcore=True, + ) + elif "prefix" in config_template_keys or "skip" in config_template_keys: + # The .nf-core.yml file contained the old prefix or skip keys + nf_core_yaml_config.template = NFCoreTemplateConfig( + org=tools_config["template"]["prefix"] + if "prefix" in config_template_keys + else tools_config["template"]["org"] + if "org" in config_template_keys + else "nf-core", + name=tools_config["template"]["name"] + if "name" in config_template_keys + else wf_config["manifest.name"].strip('"').strip("'").split("/")[-1], + description=tools_config["template"]["description"] + if "description" in config_template_keys + else wf_config["manifest.description"].strip('"').strip("'"), + author=tools_config["template"]["author"] + if "author" in config_template_keys + else wf_config["manifest.author"].strip('"').strip("'"), + version=tools_config["template"]["version"] + if "version" in config_template_keys + else wf_config["manifest.version"].strip('"').strip("'"), + outdir=tools_config["template"]["outdir"] if "outdir" in config_template_keys else str(directory), + skip_features=tools_config["template"]["skip"] + if "skip" in config_template_keys + else tools_config["template"]["skip_features"] + if "skip_features" in config_template_keys + else None, + is_nfcore=tools_config["template"]["prefix"] == "nf-core" + if "prefix" in config_template_keys + else tools_config["template"]["org"] == "nf-core" + if "org" in config_template_keys + else True, + ) log.debug("Using config file: %s", config_fn) return config_fn, nf_core_yaml_config