Perhaps the easiest way to do this would be to
1) replace all the stuff that is snakemake-specific with syntactically valid placeholders,
2) then run yapf on the modified file
3) then re-insert the snakemake specific stuff...
So that the below
rule get_gene_expression:
input:
expression_matrix
output:
"data/expression/series.csv"
run:
expression_matrix = pd.read_table(input[0])
expression_series = expression_matrix.sum(1).sort_values(ascending=False)
expression_series.to_csv(output[0], sep=" ")
becomes
for i in [1]: # snakemake
for j in [2]: # snakemake
expression_matrix = pd.read_table(input[0])
expression_series = expression_matrix.sum(1).sort_values(ascending=False)
expression_series.to_csv(output[0], sep=" ")
which you then can run yapf on. After yapf is run, the placeholder for i in [1] #snakemake
is replaced with rule get_gene_expression:
, for i in [2] #snakemake
is replaced with ``` input:
expression_matrix
output:
"data/expression/series.csv"
run:
Just throwing it out there for criticism. It is very, very hackish, but seems like the minimally intrusive way of using yapf with snakefiles.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.