how to use Rserve usage with PHP

风流意气都作罢 提交于 2019-12-11 08:27:17

问题


I have to run a script from php, getting the data from a from:

Here is my script:

library(pathview)

pv.out <- pathview(gene.data = gene.d,gene.idtype = geneid,cpd.data = cpd.d,cpd.idtype=cpdid,pathway.id = pathway,species = species,out.suffix = suffix,kegg.native = kegg,sign.pos =pos,same.layer = layer,keys.align = align,split.group = split,expand.node = expand,multi.state=multistate,match.data = matchd ,node.sum=nsum,key.pos = kpos,cpd.lab.offset= offset,limit = list(gene = glmt, cpd = clmt), bins = list(gene = gbins, cpd= cbins),low = list(gene = glow, cpd = clow),mid = list(gene = gmid, cpd = cmid), high = list(gene = ghigh, cpd =chigh),discrete = list(gene = gdisc, cpd = cdisc))

save.image("workenv.Rdata")

write.table(pv.out$plot.data.gene,file=paste(paste(paste("genedata.",species,sep=""),pathway,sep=""),".txt",sep=""),quote = FALSE)
write.table(pv.out$plot.data.cpd,file=paste(paste(paste("cpddata.",species,sep=""),pathway,sep=""),".txt",sep=""),quote = FALSE)

After a long google search and patience I found the solution. First to load library from server side you need to cinfigure the Rserv.conf file. If you dont have Rserv.conf file you can create in /etc folder

(/etc/Rserv.conf) and write the following below is my configuration
remote enable encoding utf8 eval library(pathview) source /home/ybhavnasi/Desktop/Script_Rserv.R eval xx <- 1 port 6311 plaintext enable

and in php using php rserv library on github (https://github.com/cturbelin/rserve-php) I am able to call the function on scripts loaded by server. calling eval function

来源:https://stackoverflow.com/questions/30465768/how-to-use-rserve-usage-with-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!