Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eb_filter wrapper assuming ANN/CSQ is present #506

Merged
merged 10 commits into from
May 6, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def input_function(wildcards):
filter_nb = int(wildcards["filter_nb"])
ebfilter_config = self.config["filter_list"][filter_nb - 1][self.filter_name]
parameters.update(ebfilter_config)
parameters["has_annotation"] = self.config.get("has_annotation", False)
return parameters

return input_function
Expand Down Expand Up @@ -731,6 +732,7 @@ def get_params(self, action):
self._validate_action(action)
parameters = self.config["eb_filter"]
parameters.update(self.config["filter_sets"]["dkfz_and_ebfilter"])
parameters["has_annotation"] = self.config.get("has_annotation", False)
return parameters

@dictify
Expand Down
7 changes: 6 additions & 1 deletion snappy_wrappers/wrappers/eb_filter/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

params = dict(snakemake.params)["args"]
filter_name = params["filter_name"] if "filter_name" in params else ""
has_annotation = str(params["has_annotation"] if "has_annotation" in params else False)

if "interval" in params:
cmd_fetch = "tabix --print-header {} {}".format(
Expand Down Expand Up @@ -61,7 +62,11 @@
filter=$(echo "$filter" | sed -e "s/^ || //")
ann="CSQ"
zgrep -q "^##INFO=<ID=CSQ," {snakemake.input.vcf} || ann="ANN"
filter="$filter || $ann ~ \"stream_gene_variant\""
if [[ '{has_annotation}' == "True" ]]; then
filter="$filter || $ann ~ \"stream_gene_variant\""
else
filter="$filter"
fi
{cmd_fetch} \
| bcftools view \
-e "$filter" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def test_one_filter_step_part_get_params(somatic_variant_filtration_workflow_lis
assert actual == expected

wildcards = Wildcards(fromdict={"filter_nb": 2})
expected = {"filter_name": "ebfilter_2", "threshold": 2.3}
expected = {"filter_name": "ebfilter_2", "threshold": 2.3, "has_annotation": True}
actual = somatic_variant_filtration_workflow_list.get_params("one_ebfilter", "run")(wildcards)
assert actual == expected

Expand Down
Loading