Skip to content

Commit

Permalink
[bugfix] KeyError: 'no inserts_bedfile defined for protocol None'
Browse files Browse the repository at this point in the history
- proto == None cast as a str
  • Loading branch information
DrYak committed Oct 3, 2024
1 parent dc2a1a0 commit e2ef699
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions workflow/rules/signatures.smk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ __maintainer__ = "Ivan Topolsky"
__email__ = "[email protected]"


wildcard_constraints:
proto=".*",


def all_vocs(dir):
if not dir:
return []
Expand All @@ -14,7 +18,12 @@ def all_vocs(dir):


def proto_inserts(wildcards):
return protocol_proto_option(proto=wildcards.proto, option="inserts_bedfile")
proto = (
None
if isinstance(wildcards.proto, str) and wildcards.proto in {"None", ""}
else wildcards.proto
)
return protocol_proto_option(proto=proto, option="inserts_bedfile")


rule amplicons:
Expand Down Expand Up @@ -47,7 +56,8 @@ rule amplicons:


def get_sample_amplicons(wildcards):
return cohortdir("amplicons.%s.yaml" % get_sample_protocol(wildcards))
proto = get_sample_protocol(wildcards)
return cohortdir("amplicons.%s.yaml" % ("" if proto is None else proto))


rule cooc:
Expand Down Expand Up @@ -86,10 +96,15 @@ rule cooc:


def proto_datasets(wildcards):
proto = (
None
if isinstance(wildcards.proto, str) and wildcards.proto in {"None", ""}
else wildcards.proto
)
return [
sample_paths[s_rec]
for s_rec, s_row in sample_table.items()
if s_row.protocol == wildcards.proto
if s_row.protocol == proto
]


Expand Down

0 comments on commit e2ef699

Please sign in to comment.