Search in sources :

Example 16 with CSVWriter

use of au.com.bytecode.opencsv.CSVWriter in project gatk by broadinstitute.

the class DecomposeSingularValues method writeMatrix.

private void writeMatrix(final RealMatrix m, final File outputFilename) throws IOException {
    final List<String[]> textTable = new ArrayList<>();
    for (int i = 0; i < m.getRowDimension(); i++) {
        textTable.add(Arrays.stream(m.getRow(i)).mapToObj(Double::toString).toArray(String[]::new));
    }
    final FileWriter fw = new FileWriter(outputFilename);
    CSVWriter csvWriter = new CSVWriter(fw, '\t', CSVWriter.NO_QUOTE_CHARACTER);
    csvWriter.writeAll(textTable);
    csvWriter.flush();
    csvWriter.close();
}
Also used : FileWriter(java.io.FileWriter) ArrayList(java.util.ArrayList) CSVWriter(au.com.bytecode.opencsv.CSVWriter)

Aggregations

CSVWriter (au.com.bytecode.opencsv.CSVWriter)16 FileWriter (java.io.FileWriter)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 OutputStreamWriter (java.io.OutputStreamWriter)4 File (java.io.File)3 StringWriter (java.io.StringWriter)2 Measure (com.secupwn.aimsicd.data.model.Measure)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ServletException (javax.servlet.ServletException)1 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)1 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)1 StringObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector)1 Text (org.apache.hadoop.io.Text)1 ResultMessage (org.graylog2.indexer.results.ResultMessage)1 ResultMessageSummary (org.graylog2.rest.models.messages.responses.ResultMessageSummary)1 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)1 DBSTypedObject (org.jkiss.dbeaver.model.struct.DBSTypedObject)1