discussion and development of Emacs Snakemake mode
 help / color / mirror / code / Atom feed
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:
        expression_matrix = pd.read_table(input[0])
        expression_series = expression_matrix.sum(1).sort_values(ascending=False)
        expression_series.to_csv(output[0], sep=" ")


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:

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:

[-- Attachment #2: Type: text/html, Size: 2360 bytes --]

  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 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:

  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 \
    --subject='Re: yapf for snakefiles (#18)' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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).