use of ubic.gemma.core.datastructure.matrix.MatrixWriter in project Gemma by PavlidisLab.
the class ExpressionDataFileServiceImpl method writeDesignMatrix.
/**
* Writes out the experimental design for the given experiment. The bioassays (col 0) matches match the header row
* of the data matrix printed out by the {@link MatrixWriter}.
*
* @return file that was written
*/
private File writeDesignMatrix(File file, ExpressionExperiment expressionExperiment) throws IOException {
OutputStream oStream;
oStream = new GZIPOutputStream(new FileOutputStream(file));
try (Writer writer = new OutputStreamWriter(oStream)) {
ExperimentalDesignWriter edWriter = new ExperimentalDesignWriter();
edWriter.write(writer, expressionExperiment, true);
}
return file;
}
use of ubic.gemma.core.datastructure.matrix.MatrixWriter in project Gemma by PavlidisLab.
the class ExpressionDataFileServiceImpl method writeJson.
private void writeJson(File file, ExpressionDataMatrix<?> expressionDataMatrix) throws IOException {
try (Writer writer = new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(file)))) {
MatrixWriter matrixWriter = new MatrixWriter();
matrixWriter.writeJSON(writer, expressionDataMatrix);
}
}
use of ubic.gemma.core.datastructure.matrix.MatrixWriter in project Gemma by PavlidisLab.
the class ExpressionDataFileServiceImpl method writeJson.
private void writeJson(File file, PrimitiveType representation, Collection<DesignElementDataVector> vectors) throws IOException {
this.rawExpressionDataVectorService.thawRawAndProcessed(vectors);
ExpressionDataMatrix<?> expressionDataMatrix = ExpressionDataMatrixBuilder.getMatrix(representation, vectors);
try (Writer writer = new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(file)))) {
MatrixWriter matrixWriter = new MatrixWriter();
matrixWriter.writeJSON(writer, expressionDataMatrix);
}
}
use of ubic.gemma.core.datastructure.matrix.MatrixWriter in project Gemma by PavlidisLab.
the class LinearModelAnalyzer method outputForDebugging.
/**
* Create files that can be used in R to check the results.
*/
private void outputForDebugging(ExpressionDataDoubleMatrix dmatrix, ObjectMatrix<String, String, Object> designMatrix) {
MatrixWriter mw = new MatrixWriter();
try (FileWriter writer = new FileWriter(File.createTempFile("data.", ".txt"));
FileWriter out = new FileWriter(File.createTempFile("design.", ".txt"))) {
mw.write(writer, dmatrix, null, true, false);
ubic.basecode.io.writer.MatrixWriter<String, String> dem = new ubic.basecode.io.writer.MatrixWriter<>(out);
dem.writeMatrix(designMatrix, true);
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations