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:
command = """#r
library(csaw)
param = readParam(minq=50, restrict=c({chromosomes_as_string}))"""
print(command)
R(command)
or
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}")
https://github.com/kyleam/snakemake-mode/pull/6
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub