• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java REngineException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.rosuda.REngine.REngineException的典型用法代码示例。如果您正苦于以下问题:Java REngineException类的具体用法?Java REngineException怎么用?Java REngineException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



REngineException类属于org.rosuda.REngine包,在下文中一共展示了REngineException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeStringAsFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Write a file to the RServer.
 * @param outputFilename the filename
 * @param value The content of the file
 * @throws REngineException if an error occurs while writing the file
 */
public void writeStringAsFile(final String outputFilename, final String value)
    throws REngineException {

  if (outputFilename == null) {
    return;
  }

  try {

    final Writer writer =
        FileUtils.createBufferedWriter(getFileOutputStream(outputFilename));
    if (value != null) {
      writer.write(value);
      writer.close();
    }
  } catch (IOException e) {
    throw new REngineException(getRConnection(), "Error: " + e.getMessage());
  }

}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:27,代码来源:RSConnection.java


示例2: removeFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Remove a file on the RServer.
 * @param filename File to remove
 */
public void removeFile(final String filename) throws REngineException {

  // Test if the file exists
  final RConnection c = getRConnection();

  try {

    REXP exists = c.eval("file.exists(\"" + filename + "\")");
    if (exists.asInteger() == 1) {
      c.voidEval("file.remove(\"" + filename + "\")");
    }

  } catch (RserveException | REXPMismatchException e) {
    throw new REngineException(c, "RServe exception: " + e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:21,代码来源:RSConnection.java


示例3: executeRCode

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Execute a R code.
 * @param source code to execute
 * @throws REngineException if an error while executing the code
 */
public void executeRCode(final String source) throws REngineException {

  if (source == null) {
    return;
  }

  final RConnection c = getRConnection();

  try {

    // Execute the source
    c.voidEval("source(\"" + source + "\")");

  } catch (RserveException e) {
    throw new REngineException(c, "RServe exception: " + e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:23,代码来源:RSConnection.java


示例4: getOutputFiles

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
@Override
public void getOutputFiles() throws IOException {

  checkConnection();

  try {

    // Get all the filenames
    final List<String> filenames = this.rConnection.listFiles();

    for (String filename : filenames) {

      // Retrieve the file
      this.rConnection.getFile(filename,
          new File(getOutputDirectory(), filename));

      // Delete the file
      removeFile(filename);
    }

  } catch (REngineException | REXPMismatchException e) {
    throw new IOException(e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:25,代码来源:RserveRExecutor.java


示例5: removeFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
@Override
protected void removeFile(final String filename) throws IOException {

  checkConnection();

  // Check if Rserve files can be removed
  if (EoulsanRuntime.getSettings().isKeepRServeFiles()) {
    return;
  }

  // Remove file from Rserve server
  try {
    this.rConnection.removeFile(filename);
  } catch (REngineException e) {
    throw new IOException(e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:18,代码来源:RserveRExecutor.java


示例6: writerFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
@Override
public void writerFile(final String content, final String outputFilename)
    throws IOException {

  checkConnection();

  if (content == null) {
    throw new NullPointerException("content argument cannot be null");
  }

  if (outputFilename == null) {
    throw new NullPointerException("outputFilename argument cannot be null");
  }

  try (Writer writer = new OutputStreamWriter(
      this.rConnection.getFileOutputStream(outputFilename))) {
    writer.write(content);
  } catch (REngineException e) {
    throw new IOException(e);
  }

}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:23,代码来源:RserveRExecutor.java


示例7: CellHTS2

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
public CellHTS2(ScreenResult screenResult, 
                String title,
                String reportsPath,
                String saveRObjectsPath) throws RserveException, REngineException,
REXPMismatchException {
  this.screenResult = screenResult;
  this.rConnection = new RConnection();
  this.arrayDimensions = calculateArrayDimensions(screenResult);
  this.title = title;
  this.reportsPath = reportsPath;
  if (!StringUtils.isEmpty(saveRObjectsPath)) {
    this.saveRObjectsPath = saveRObjectsPath;
    File file = new File(saveRObjectsPath);
    if (file.exists()) {
      this.saveRObjects = true;
    }
    else {
      log.error(saveRObjectsPath +
        "does not exist (cellHTS2.saveRObjects.directory system property); R objects will not be saved");
    }
  }
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:23,代码来源:CellHTS2.java


示例8: getConfigureDbResultSlog

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
public String[][] getConfigureDbResultSlog() throws RserveException, REngineException, REXPMismatchException {
  
  // Example screenlog: data.frame(Plate=c(1),Well=c("A02"),Sample=c(1),Flag=c("NA"),Channel=c(1),stringsAsFactors=FALSE)
  
  RserveExtensions rserveExtensions = new RserveExtensions();
  REXP rexpPlate = rserveExtensions.tryEval(rConnection, "screenLog <- [email protected]; resultContent <- screenLog$Plate");
  REXP rexpWell = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Well");
  REXP rexpSample = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Sample");    //Sample = Replicate
  REXP rexpFlag = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Flag");
  REXP rexpChannel = rserveExtensions.tryEval(rConnection,"resultContent <- screenLog$Channel");
  
  String [][] result =null;
  if (!rexpPlate.isNull()) {
    // all have the same length
    result = new String[5][rexpPlate.asStrings().length];
    result[0] = rexpPlate.asStrings();
    result[1] = rexpWell.asStrings();
    result[2] = rexpSample.asStrings();
    result[3] = rexpFlag.asStrings();
    result[4] = rexpChannel.asStrings();
 
  }

  return result;
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:26,代码来源:CellHTS2.java


示例9: testCalculateArrayDimensions

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
public void testCalculateArrayDimensions()
  throws RserveException,
  REngineException,
  REXPMismatchException
{

  ScreenResult screenResult = MakeDummyEntitiesCellHTS2.makeSimpleDummyScreenResult();
  String title = "Dummy_Experiment";
  CellHTS2 cellHts2 = new CellHTS2(screenResult, title, ".", null);

  ArrayDimensions expected = new ArrayDimensions();

  expected.setNrChannels(1);
  expected.setNrColsPlate(2);
  expected.setNrPlates(2);
  expected.setNrReps(2);
  expected.setNrRowsPlate(2);
  expected.setNrWells(4);

  assertEquals(expected, cellHts2.getArrayDimensions());
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:22,代码来源:CellHTS2Test.java


示例10: normalizePlatesAssert

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
public void normalizePlatesAssert(NormalizePlatesMethod normalizePlatesMethod,
                                  NormalizePlatesScale normalizePlatesScale,
                                  int nrPlateColumns,
                                  NormalizePlatesNegControls normalizePlatesNegControls,
                                  boolean inclNS)
  throws RserveException,
  REngineException,
  REXPMismatchException
{
  normalizePlatesAssert(normalizePlatesMethod,
                        normalizePlatesScale,
                        nrPlateColumns,
                        NormalizePlatesNegControls.NEG,
                        inclNS,
                        false);
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:17,代码来源:CellHTS2Test.java


示例11: isAvailable

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
@Override
public boolean isAvailable() {

  final RSConnection connection = new RSConnection(this.serverName);

  try {
    connection.getRConnection();
    connection.disConnect();
  } catch (REngineException e) {
    return false;
  }

  return true;
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:15,代码来源:RserveRequirement.java


示例12: getRConnection

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Get the R connection.
 * @return Returns the RConnection
 * @throws REngineException
 */
public RConnection getRConnection() throws REngineException {

  if (this.rconnection == null) {
    connect();
  }

  return this.rconnection;
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:14,代码来源:RSConnection.java


示例13: getFileInputStream

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Create an inputStream on a file on RServer.
 * @param filename Name of the file on RServer to load
 * @return an inputStream
 * @throws REngineException if an exception occurs while reading file
 */
public InputStream getFileInputStream(final String filename)
    throws REngineException {

  final RConnection c = getRConnection();

  try {
    return c.openFile(filename);
  } catch (IOException e) {

    throw new REngineException(c, "Error: " + e.getMessage());
  }

}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:20,代码来源:RSConnection.java


示例14: getFileOutputStream

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Create an outputStream on a file on RServer.
 * @param filename Name of the file on RServer to write
 * @return an outputStream
 * @throws REngineException if an exception occurs while reading file
 */
public OutputStream getFileOutputStream(final String filename)
    throws REngineException {

  final RConnection c = getRConnection();

  try {
    return c.createFile(filename);
  } catch (IOException e) {

    throw new REngineException(c, "Error: " + e.getMessage());
  }

}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:20,代码来源:RSConnection.java


示例15: putFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Put a file from the RServer.
 * @param inputFile input file of the file to put
 * @param rServeFilename filename of the file to put
 * @throws REngineException if an error occurs while downloading the file
 */
public void putFile(final File inputFile, final String rServeFilename)
    throws REngineException {

  checkNotNull(inputFile, "inputFile argument cannot be null");
  checkNotNull(rServeFilename, "rServeFilename argument cannot be null");

  try {
    putFile(new FileInputStream(inputFile), rServeFilename);
  } catch (FileNotFoundException e) {
    throw new REngineException(getRConnection(),
        "file not found: " + e.getMessage());
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:20,代码来源:RSConnection.java


示例16: removeAllFiles

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Remove all the files of the working directory.
 * @throws REngineException if an error occurs while removing the file
 * @throws REXPMismatchException if an error occurs while removing the file
 */
public void removeAllFiles() throws REngineException, REXPMismatchException {

  for (String file : listFiles()) {
    removeFile(file);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:12,代码来源:RSConnection.java


示例17: setCommandArgs

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Override the commandArg() R function.
 * @param arguments the arguments
 * @throws REngineException if an error occurs while executing R code
 */
public void setCommandArgs(final List<String> arguments)
    throws REngineException {

  if (arguments == null) {
    throw new NullPointerException("arguments argument cannot be null");
  }

  final StringBuilder sb = new StringBuilder();
  sb.append("f <- function(trailingOnly = FALSE) { c(");

  boolean first = true;
  for (String arg : arguments) {

    if (first) {
      first = false;
    } else {
      sb.append(",");
    }
    sb.append('\'');
    sb.append(arg);
    sb.append('\'');
  }

  sb.append(") }");

  final RConnection c = getRConnection();

  try {

    // Execute the source
    c.voidEval(sb.toString());

  } catch (RserveException e) {
    throw new REngineException(c, "RServe exception: " + e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:42,代码来源:RSConnection.java


示例18: executeRnwCode

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Execute a R Sweave code.
 * @param source code to execute
 * @param latexOutput output latex filename
 * @throws REngineException if an error while executing the code
 */
public void executeRnwCode(final String source, final String latexOutput)
    throws REngineException {

  if (source == null) {
    return;
  }

  final RConnection c = getRConnection();

  final StringBuilder sb = new StringBuilder();
  sb.append("Sweave(\"");
  sb.append(source);
  sb.append('\"');

  if (latexOutput != null) {
    sb.append(", output=\"");
    sb.append(latexOutput);
    sb.append('\"');
  }
  sb.append(')');

  try {
    c.voidEval(sb.toString());
  } catch (RserveException e) {
    throw new REngineException(c, "Rserve exception: " + e);
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:34,代码来源:RSConnection.java


示例19: openFile

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Open a file to read on Rserve server.
 * @param filename the filename
 * @return an input stream
 * @throws REngineException if an error occurs while creating the input stream
 */
public RFileInputStream openFile(final String filename)
    throws REngineException {

  final RConnection c = getRConnection();

  RFileInputStream file;
  try {
    file = c.openFile(filename);
  } catch (IOException e) {
    throw new REngineException(c, "Error while opening file");
  }

  return file;
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:21,代码来源:RSConnection.java


示例20: getAllFiles

import org.rosuda.REngine.REngineException; //导入依赖的package包/类
/**
 * Get all the file on the Rserve server.
 * @param outPath the output path
 * @throws REngineException if an error occurs while retrieving the files
 * @throws REXPMismatchException if an error occurs while retrieving the files
 */
public void getAllFiles(final File outPath)
    throws REngineException, REXPMismatchException {

  if (outPath == null) {
    throw new NullPointerException("outPath argument cannot be null");
  }

  for (String file : listFiles()) {
    getFile(file, new File(outPath, file));
  }
}
 
开发者ID:GenomicParisCentre,项目名称:eoulsan,代码行数:18,代码来源:RSConnection.java



注:本文中的org.rosuda.REngine.REngineException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Link类代码示例发布时间:2022-05-23
下一篇:
Java Combine类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap