示例#1
0
def rrunner(scriptstring,clean=False):
    """help function if no rpy is available - now disabled """
    scriptfile=str(os.getpid())+'execute.R'
    out=open(scriptfile,'w')
    out.write(scriptstring)
    out.close()

    command  ='R CMD BATCH --no-restore --slave --no-save '+scriptfile
    ret=fhutils.execwrapper(command)
    if ret == 0 and clean == True:
        os.remove(scriptfile)
        os.remove(scriptfile+'out')
    else:
        os.rename(scriptfile,scriptfile+str(fhutils.dtk()))
        os.rename(scriptfile+'out',scriptfile+'.out'+str(fhutils.dtk()))
示例#2
0
def rrunner(scriptstring, clean=False):
    """help function if no rpy is available - now disabled """
    scriptfile = str(os.getpid()) + 'execute.R'
    out = open(scriptfile, 'w')
    out.write(scriptstring)
    out.close()

    command = 'R CMD BATCH --no-restore --slave --no-save ' + scriptfile
    ret = fhutils.execwrapper(command)
    if ret == 0 and clean == True:
        os.remove(scriptfile)
        os.remove(scriptfile + 'out')
    else:
        os.rename(scriptfile, scriptfile + str(fhutils.dtk()))
        os.rename(scriptfile + 'out', scriptfile + '.out' + str(fhutils.dtk()))
示例#3
0
def rrunner(scriptstring, datafile, clean=True):
    scriptfile = str(os.getpid()) + 'execute.R'
    out = open(scriptfile, 'w')
    out.write(scriptstring)
    out.close()

    command = 'R CMD BATCH --no-restore --slave --no-save ' + scriptfile
    ret = fhutils.execwrapper(command)
    if ret == 0:
        if datafile:
            os.remove(datafile)
        os.remove(scriptfile)
        os.remove(scriptfile + 'out')
    else:
        if datafile:
            os.rename(datafile, datafile + str(fhutils.dtk()))
        os.rename(scriptfile, scriptfile + str(fhutils.dtk()))
        os.rename(scriptfile + 'out', scriptfile + '.out' + str(fhutils.dtk()))