Closed FelixMoelder closed 1 year ago
This is the full rule:
rule annotate_dgidb:
input:
"results/calls/{prefix}.bcf",
params:
datasources=(
"-s {}".format(" ".join(config["annotations"]["dgidb"]["datasources"]))
if config["annotations"]["dgidb"].get("datasources", "")
else ""
),
output:
"results/calls/{prefix}.dgidb.bcf",
log:
"logs/annotate-dgidb/{prefix}.log",
conda:
"../envs/rbt.yaml"
resources:
dgidb_requests=1,
shell:
"rbt vcf-annotate-dgidb {input} {params.datasources} > {output} 2> {log}"
The part with the if config else is moved to the left.
I think this is potentially connected to #115. I'm pretty vague on how the if-else parsing works. @bricoletc might be better able to figure this out.
Apologies I've got low bandwith at the moment, with my last year of thesis, (and @mbhall88 is defending his!) however i will take a look at it in the next few weeks
This also happens with nesting outside (but in combination with) rules. Here is a minimal example:
if True:
def func1():
"""this function will stay indented"""
pass
rule break_snakefmt_044:
shell: ""
def func2():
"""this function will be unindented"""
pass
I think this label could get a help wanted
label? Assuming it's doable for a non-maintainer to tackle.
Feel free to tackle this @corneliusroemer. It has been bugging me too. I'm still trying to figure out a couple of issues on #151 and then I was going to try and tackle this. But feel free to have a go 👍
I wonder if anyone would like to test out #164 as that fixes the two examples in this issue?
It looks like
snakefmt 0.4.4
adds wrong indentations when formatting a snakemake rule containing a if-else-closure.As an example the following output will be created for a proper formatted rule:
A minimal example is attached. Snakefile.zip