From: Endre Bakken Stovner <notifications@github.com>
To: kyleam/snakemake-mode <snakemake-mode@noreply.github.com>
Subject: Re: yapf for snakefiles (#18)
Date: Fri, 08 Jul 2016 01:03:48 -0700 [thread overview]
Message-ID: <kyleam/snakemake-mode/issues/18/231299696@github.com> (raw)
In-Reply-To: <kyleam/snakemake-mode/issues/18@github.com>
[-- 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 --]
next prev parent reply other threads:[~2016-07-08 8:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 7:41 yapf for snakefiles (#18) Endre Bakken Stovner
2016-07-08 8:03 ` Endre Bakken Stovner [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://git.kyleam.com/snakemake-mode
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=kyleam/snakemake-mode/issues/18/231299696@github.com \
--to=notifications@github.com \
--cc=reply+0013cd7c3974a9f08f43748664edced11353b143675f7aa392cf000000011397206492a169ce09cdb427@reply.github.com \
--cc=snakemake-mode@noreply.github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).