* yapf for snakefiles (#18)
@ 2016-07-08 7:41 Endre Bakken Stovner
2016-07-08 8:03 ` Endre Bakken Stovner
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Endre Bakken Stovner @ 2016-07-08 7:41 UTC (permalink / raw)
To: kyleam/snakemake-mode
[-- Attachment #1: Type: text/plain, Size: 472 bytes --]
Would you be interested in having [yapf](https://github.com/google/yapf) for snakefiles? If you think it is desirable and feasible, I might start looking into it. I guess at first only yapfing the `rule:` portion should be the goal.
In the end hacking yapf to analyze snakefiles might be a goal...
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/18
[-- Attachment #2: Type: text/html, Size: 1239 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: yapf for snakefiles (#18)
2016-07-08 7:41 yapf for snakefiles (#18) Endre Bakken Stovner
@ 2016-07-08 8:03 ` Endre Bakken Stovner
2020-04-14 2:10 ` Kyle Meyer
2016-07-09 11:18 ` Endre Bakken Stovner
2016-10-21 21:30 ` Kyle Meyer
2 siblings, 1 reply; 6+ messages in thread
From: Endre Bakken Stovner @ 2016-07-08 8:03 UTC (permalink / raw)
To: kyleam/snakemake-mode
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]
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 or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/18#issuecomment-231299696
[-- Attachment #2: Type: text/html, Size: 2360 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: yapf for snakefiles (#18)
2016-07-08 7:41 yapf for snakefiles (#18) Endre Bakken Stovner
2016-07-08 8:03 ` Endre Bakken Stovner
@ 2016-07-09 11:18 ` Endre Bakken Stovner
2020-04-14 2:11 ` Kyle Meyer
2016-10-21 21:30 ` Kyle Meyer
2 siblings, 1 reply; 6+ messages in thread
From: Endre Bakken Stovner @ 2016-07-09 11:18 UTC (permalink / raw)
To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Comment
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
It seems harder to extend yapf than to implement my hackish proposal.
But I guess I could create my own Python script which 1) does the transformation, 2) calls yapf and then 3) translates the code into snakemake again.
I should have been clearer about why I posted this here. I was wondering about whether you might accept a PR for such a formatter if I write it. I doubt the yapf projects would be interested in PRs to support a relatively obscure DSL.
Anyways, will be sometime in the future so that I can use and tweak it myself for a while.
---
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/18#issuecomment-231529359
[-- Attachment #2: Type: text/html, Size: 1506 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: yapf for snakefiles (#18)
2016-07-08 7:41 yapf for snakefiles (#18) Endre Bakken Stovner
2016-07-08 8:03 ` Endre Bakken Stovner
2016-07-09 11:18 ` Endre Bakken Stovner
@ 2016-10-21 21:30 ` Kyle Meyer
2 siblings, 0 replies; 6+ messages in thread
From: Kyle Meyer @ 2016-10-21 21:30 UTC (permalink / raw)
To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Your activity
[-- Attachment #1: Type: text/plain, Size: 200 bytes --]
Closed #18.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/18#event-832530748
[-- Attachment #2: Type: text/html, Size: 2015 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-14 2:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 7:41 yapf for snakefiles (#18) Endre Bakken Stovner
2016-07-08 8:03 ` Endre Bakken Stovner
2020-04-14 2:10 ` Kyle Meyer
2016-07-09 11:18 ` Endre Bakken Stovner
2020-04-14 2:11 ` Kyle Meyer
2016-10-21 21:30 ` Kyle Meyer
Code repositories for project(s) associated with this public inbox
https://git.kyleam.com/snakemake-mode/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).