Skip to content

Commit

Permalink
udpate yaml config only in pipeline repos
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Oct 2, 2024
1 parent a3468d3 commit d0a24be
Showing 1 changed file with 47 additions and 46 deletions.
93 changes: 47 additions & 46 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0a24be

Please sign in to comment.