From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 08 Jul 2016 00:41:36 -0700 From: Endre Bakken Stovner Reply-To: kyleam/snakemake-mode Message-ID: Subject: yapf for snakefiles (#18) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_577f593049d00_3a893fd8e6fc32b81589516"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: kyleam/snakemake-mode List-Archive: https://github.com/kyleam/snakemake-mode List-Post: List-Unsubscribe: , To: kyleam/snakemake-mode ----==_mimepart_577f593049d00_3a893fd8e6fc32b81589516 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 ----==_mimepart_577f593049d00_3a893fd8e6fc32b81589516 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Would you be interested in having 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, view it on GitHub, or mute the thread.

----==_mimepart_577f593049d00_3a893fd8e6fc32b81589516-- From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 08 Jul 2016 01:03:48 -0700 From: Endre Bakken Stovner Reply-To: kyleam/snakemake-mode Message-ID: In-Reply-To: References: Subject: Re: yapf for snakefiles (#18) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_577f5e64ce561_3a983fd8e6fc32b8177619f"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: kyleam/snakemake-mode List-Archive: https://github.com/kyleam/snakemake-mode List-Post: List-Unsubscribe: , To: kyleam/snakemake-mode ----==_mimepart_577f5e64ce561_3a983fd8e6fc32b8177619f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 ----==_mimepart_577f5e64ce561_3a983fd8e6fc32b8177619f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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.

----==_mimepart_577f5e64ce561_3a983fd8e6fc32b8177619f-- From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 09 Jul 2016 04:18:19 -0700 From: Endre Bakken Stovner Reply-To: kyleam/snakemake-mode Message-ID: In-Reply-To: References: Subject: Re: yapf for snakefiles (#18) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5780dd7b46672_72a93fd3946692a012350bc"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: kyleam/snakemake-mode List-Archive: https://github.com/kyleam/snakemake-mode List-Post: List-Unsubscribe: , To: kyleam/snakemake-mode Cc: Kyle Meyer , Comment ----==_mimepart_5780dd7b46672_72a93fd3946692a012350bc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 ----==_mimepart_5780dd7b46672_72a93fd3946692a012350bc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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, view it on GitHub, or mute the thread.

----==_mimepart_5780dd7b46672_72a93fd3946692a012350bc-- From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 21 Oct 2016 14:30:53 -0700 From: Kyle Meyer Reply-To: kyleam/snakemake-mode Message-ID: In-Reply-To: References: Subject: Re: yapf for snakefiles (#18) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_580a890de40f9_18bf3f909255929c813b2"; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: kyleam/snakemake-mode List-Archive: https://github.com/kyleam/snakemake-mode List-Post: List-Unsubscribe: , To: kyleam/snakemake-mode Cc: Kyle Meyer , Your activity ----==_mimepart_580a890de40f9_18bf3f909255929c813b2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 ----==_mimepart_580a890de40f9_18bf3f909255929c813b2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Closed #18.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

----==_mimepart_580a890de40f9_18bf3f909255929c813b2-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id 0JVrBoQblV7CTwAAsNZ9tg (envelope-from ) for ; Tue, 14 Apr 2020 02:10:12 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MCKSJYMblV6VXQAA1q6Kng (envelope-from ) for ; Tue, 14 Apr 2020 02:10:11 +0000 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id DB0B4681CAB for ; Tue, 14 Apr 2020 02:10:08 +0000 (UTC) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 8DC0A63DDD for ; Mon, 13 Apr 2020 22:10:08 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=5Mx1X62ywb0weqLUB/m84ISjYLE=; b=CPmFK3 PpBBz5YiHkzUqDyOxRtIpHtwNx5NHJ5GkeHLONu1H6QvH3F5OILYDw+sslM7flmf W/n+Z3h71KbFuMeVth+hf4PRDcNEbj38ndSpuSh64L9uGQypUS7RbAV7XgVEo9ud aKvYOk5ZRku+28bDZA1k4gxCbNplfv7c/uyzI= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 85F7863DDC for ; Mon, 13 Apr 2020 22:10:08 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=JULOdrtmOLKJ/6FxLKlwspba0n09Vq7AKXwqrxpCB+k=; b=O14UGhLCCObfdDPzXBjG29S0H9WayrzP/QyqY2gen4rBMV7+fyfPmfO+6Fu35J4tRdgEb5WzfEBdImEEbNhcpqHSJqdjvzeW8PF7m8N/3da+i06/1/ebWhmxPo+gdwdIEvV0XPg4zPGWPMcbF6S1NigNIJ4nns3a4LTKbCZUy7s= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id F2C7063DDB for ; Mon, 13 Apr 2020 22:10:07 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: snakemake-mode@inbox.kyleam.com Subject: Re: yapf for snakefiles (#18) In-Reply-To: References: Date: Tue, 14 Apr 2020 02:10:07 +0000 Message-ID: <87sgh6x1fk.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 102E1FFC-7DF5-11EA-BF63-C28CBED8090B-24757444!pb-smtp1.pobox.com X-Scanner: scn0 X-Spam-Score: -1.00 Authentication-Results: aspmx2.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=CPmFK3 P; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=O14UGhLC; dmarc=none; spf=pass (aspmx2.migadu.com: domain of kyle@kyleam.com designates 64.147.108.70 as permitted sender) smtp.mailfrom=kyle@kyleam.com X-Scan-Result: default: False [-1.00 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[pobox.com:s=sasl,kyleam.com:s=mesmtp]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(0.00)[-0.48123275854524]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 11403(-0.19), country: US(-0.01), ip: 64.147.108.70(0.00)]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[snakemake-mode@inbox.kyleam.com]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[kyleam.com]; R_SPF_ALLOW(-0.20)[+ip4:64.147.108.0/24]; MX_GOOD(-0.50)[cached: mx-5.rightbox.com]; DKIM_TRACE(0.00)[pobox.com:+,kyleam.com:+]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:64.147.108.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-TUID: MH04bvhEs/R4 ------------------------------------------------------------------------ Some replies are missing, as described at https://inbox.kyleam.com/snakemake-mode/874ktmyh4u.fsf@kyleam.com/ The text below is copied from https://github.com/kyleam/snakemake-mode/issues/18#issuecomment-231516187 ------------------------------------------------------------------------ I'm not familiar with yapf, but, at least at first glance, nothing seems Emacs-specific here. If you extend the command line program to support Snakemake files, [py-yapf](or a wrapper around it, if necesary) could be used to call it from Emacs. Am I missing something? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id KL5HHe8blV4rawAAsNZ9tg (envelope-from ) for ; Tue, 14 Apr 2020 02:11:59 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SDTJN+4blV6YPAAAB5/wlQ (envelope-from ) for ; Tue, 14 Apr 2020 02:11:58 +0000 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id 5080E681CAB for ; Tue, 14 Apr 2020 02:11:56 +0000 (UTC) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 6156463DED for ; Mon, 13 Apr 2020 22:11:56 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=V1kfkyORM6PY5GMXN3zje8mG+Gc=; b=SbI5tW LcLI+Ulx2QbL4UG+mFf+Yb/oQ0ETekAdzmnE3Blh2+rWblAL4xef00WNNg8lrYUh MgodOKj9n9rmNXbr3n0PmZqHrp/BhwC3wF14WM3dynsBpWr0CskuElkGU8CyA3rH 4zBmeNBMGrcFdGLtyx9vhBkjWzPUCOr/hdFgg= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 5889F63DEC for ; Mon, 13 Apr 2020 22:11:56 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=R+q9LGgUgkXxS8WAzAG+F7BDBWYphz420HZ+q0kTFtg=; b=GPA2u5kpsCjsB5nG5p1VL3Han21jFA1K5cVI7pTZAlFuvLq2yTizoD5hE3PUcpNzGleCQ3/vAlUC6MxSTnQib0+kCSm/i6awoRQKmIZExcnF3T49RE3u9K/jv10LoohVbb9d0BfOYe2hLvniRPoHYKUpbw6wv5sQRy3z/jpYiFo= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id CE4AB63DEB for ; Mon, 13 Apr 2020 22:11:55 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: snakemake-mode@inbox.kyleam.com Subject: Re: yapf for snakefiles (#18) In-Reply-To: References: Date: Tue, 14 Apr 2020 02:11:55 +0000 Message-ID: <87pncax1ck.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 50763860-7DF5-11EA-9C7D-C28CBED8090B-24757444!pb-smtp1.pobox.com X-Scanner: scn0 X-Spam-Score: -1.00 Authentication-Results: aspmx2.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=SbI5tW L; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=GPA2u5kp; dmarc=none; spf=pass (aspmx2.migadu.com: domain of kyle@kyleam.com designates 64.147.108.70 as permitted sender) smtp.mailfrom=kyle@kyleam.com X-Scan-Result: default: False [-1.00 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[pobox.com:s=sasl,kyleam.com:s=mesmtp]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(0.00)[-0.48124678064588]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.108.0/24]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[snakemake-mode@inbox.kyleam.com]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[kyleam.com]; IP_REPUTATION_HAM(0.00)[asn: 11403(-0.19), country: US(-0.01), ip: 64.147.108.70(0.00)]; MX_GOOD(-0.50)[cached: mx-5.rightbox.com]; DKIM_TRACE(0.00)[pobox.com:+,kyleam.com:+]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:64.147.108.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-TUID: HVvL7pEmICkF ------------------------------------------------------------------------ Some replies are missing, as described at https://inbox.kyleam.com/snakemake-mode/874ktmyh4u.fsf@kyleam.com/ The text below is copied from https://github.com/kyleam/snakemake-mode/issues/18#issuecomment-231539511 ------------------------------------------------------------------------ Thanks for the clarification. If you decide the go with elisp for implementing this, I'd suggest you do it as its own package. If you find it works well, I'm happy to link to it in Snakemake mode's README.