Python调用R

最后发布时间:2021-07-27 13:58:29 浏览量:
import pyRserve
conn = pyRserve.connect()
conn.r("library(httpgd)")


r_code = '''
library(maftools)
laml.maf = system.file('extdata', 'tcga_laml.maf.gz', package = 'maftools') 
laml.clin = system.file('extdata', 'tcga_laml_annot.tsv', package = 'maftools') 
laml = read.maf(maf = laml.maf, clinicalData = laml.clin)
s <- hgd_inline({
    plot.new()
    oncoplot(maf = laml) 
})
'''

res = conn.r(r_code)
print(res)