Skip to content

Commit

Permalink
fix: further adaptation to Snakemake 8
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Jan 23, 2024
1 parent 72d705c commit bffcbfd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
4 changes: 0 additions & 4 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ report: "report/report.rst"
configfile: "config/config.yaml"


envvars:
"ZENODO_TOKEN",


include: "rules/common.smk"


Expand Down
37 changes: 22 additions & 15 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
def get_zenodo_tag(entry):
if "restricted-access-token-envvar" in entry:
return f"zenodo_{entry['deposition']}"
else:
return "zenodo"


# add path to callsets
for key, callset in config["variant-calls"].items():
if "path" not in callset and "zenodo" in callset:
filename = callset["zenodo"]["filename"]
callset["path"] = f"resources/zenodo/variant-calls/{key}/{filename}"
if "zenodo" in callset:
if "path" not in callset:
filename = callset["zenodo"]["filename"]
callset["path"] = f"resources/zenodo/variant-calls/{key}/{filename}"
tag = get_zenodo_tag(callset["zenodo"])
if tag != "zenodo":
workflow.storage_registry.register_storage(
provider="zenodo",
tag=tag,
restricted_access_token=os.environ[
callset["zenodo"]["restricted-access-token-envvar"]
],
)


def get_zenodo_input(wildcards):
entry = config[wildcards.section][wildcards.entry]["zenodo"]

provider = "zenodo"
if "restricted-access-token-envvar" in entry:
tag = f"zenodo_{entry['deposition']}"
storage.register_storage(
provider="zenodo",
tag=tag,
restricted_access_token=os.environ[
entry["restricted-access-token-envvar"]
],
)
provider = tag
return getattr(storage, provider)(
tag = get_zenodo_tag(entry)
return getattr(storage, tag)(
f"zenodo://record/{entry['deposition']}/{entry['filename']}"
)

0 comments on commit bffcbfd

Please sign in to comment.