snakefmt
snakefmt copied to clipboard
snakefmt moves interspersed comments
I intentionally changed some triple quoted shell strings to separate concatenated strings so that I could intersperse comments, but even though the code works, snakefmt moved the comments to the beginning and end.
Desired (note the space between the + and the "):
shell:
# Concatenate all the files together
"cat {input:q} 2> {log.cat:q} | "
# Coordinate sort everything
+ "sortBed 2> {log.sort:q} | "
# Merge overlapping coordinates into individual expanded records
+ "mergeBed 2> {log.merge:q} 1> {output:q}"
snakefmt's munge:
shell:
# Concatenate all the files together
"cat {input:q} 2> {log.cat:q} | "
+"sortBed 2> {log.sort:q} | "
+"mergeBed 2> {log.merge:q} 1> {output:q}"
# Coordinate sort everything
# Merge overlapping coordinates into individual expanded records
It also requires that the + be at the beginning of the next line and won't let them be at the end. If they are at the end, it gived a confusing syntax error.
Desired:
shell:
# Concatenate all the files together
"cat {input:q} 2> {log.cat:q} | " +
# Coordinate sort everything
"sortBed 2> {log.sort:q} | " +
# Merge overlapping coordinates into individual expanded records
"mergeBed 2> {log.merge:q} 1> {output:q}"
snakefmt error:
snakefmt.exceptions.InvalidPython: Black error:
Cannot parse: 17:35: "cat {input:q} 2> {log.cat:q} | " +
How can I intersperse comments in multi-line shell strings without snakefmt moving them?
This is related to #129