问题
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 configurationremote 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