本文整理汇总了Java中org.rosuda.REngine.REngineException类的典型用法代码示例。如果您正苦于以下问题:Java REngineException类的具体用法?Java REngineException怎么用?Java REngineException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
REngineException类属于org.rosuda.REngine包,在下文中一共展示了REngineException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
}
示例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;
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
}
示例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());
}
}
示例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());
}
}