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: Support R syntax highlighting in R("""-blocks (#6)
Date: Wed, 13 Apr 2016 02:03:33 -0700	[thread overview]
Message-ID: <kyleam/snakemake-mode/pull/6@github.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

Uses purcells robust mmm-library: https://github.com/purcell/mmm-mode

Can be further updated to recognize other strings as embedded R. The template should be easy to follow.

I suggest something like `"""[Rr]` for the case where you need to run R-scripts using shell or write them in a variable to print/debug. But I leave it at your discretion.

Use-cases for suggestion above:

```python
        command = """#r
        library(csaw)
        param = readParam(minq=50, restrict=c({chromosomes_as_string}))"""
        print(command)
        R(command)
```

or 

```python
        run_voom_script = """#R
        library(edgeR)
        normfactors = tail(read.table("{input.normalization_file}", row.names=1, header=F), 18)
        colnames(normfactors) = c("norm.factors") # need this name for voom to accept the normfactors
        df = read.table("{input.infile}")

        x = DGEList(counts=df, norm.factors=as.matrix(normfactors))

        y = voom(x)
        write.table(y$E, "{output.outfile}", sep=" ")
        """.format(**locals())

        print(run_voom_script)

        # Must craete new instance of R-interpreter to avoid clashing library requirements
        with open(output.script, "w+") as script_handle:
            script_handle.write(run_voom_script)

        shell("Rscript {output.script}")
```
You can view, comment on, or merge this pull request online at:

  https://github.com/kyleam/snakemake-mode/pull/6

-- Commit Summary --

  * Support R syntax highlighting in R("""-blocks

-- File Changes --

    M snakemake-mode.el (15)

-- Patch Links --

https://github.com/kyleam/snakemake-mode/pull/6.patch
https://github.com/kyleam/snakemake-mode/pull/6.diff

---
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/pull/6

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

             reply	other threads:[~2016-04-13  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13  9:03 Endre Bakken Stovner [this message]
2016-04-13 13:26 ` Endre Bakken Stovner
2016-04-14  5:51 ` Endre Bakken Stovner
2016-04-14  6:09 ` Endre Bakken Stovner
2016-04-17 19:04 ` Endre Bakken Stovner
2016-04-18  4:22 ` Endre Bakken Stovner
2020-04-17  0:01 ` 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/pull/6@github.com \
    --to=notifications@github.com \
    --cc=reply+0013cd7cca42e95a1b1f72e8067273e4b9f79b650d09b9f792cf000000011325cd6592a169ce08d23506@reply.github.com \
    --cc=snakemake-mode@noreply.github.com \
    --subject='Re: Support R syntax highlighting in R("""-blocks (#6)' \
    /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

Code repositories for project(s) associated with this 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).