DataMatrixIO { public static void writeMatrixInclHeaderAndRowIDs(DataMatrix dataMatrix, String file, boolean doLogarithm) { FloatMatrix matrix = dataMatrix.getMatrix(); Map<String, Integer> id2index = new HashMap<>(); for (Map.Entry<Integer, Integer> entry : dataMatrix.getEntrezIdToRowIndex().entrySet()) { id2index.put(entry.getKey().toString(), entry.getValue()); } writeMatrixInclHeaderAndRowIDs(matrix, file, id2index, doLogarithm); } private  DataMatrixIO(); static void convertToMap(String matrixFileZip, String entrezId2indexFileZip, Path outfileName); static DataMatrix loadOffHeapDataMatrix(Path ppiMapPath); static DataMatrix loadInMemoryDataMatrix(Path ppiMapPath); static DataMatrix loadInMemoryDataMatrixFromFile(String matrixFileZip, String entrezId2indexFileZip, boolean shouldUseExponent); static void writeMatrix(DataMatrix dataMatrix, String file, boolean doLogarithm); static void writeMatrix(FloatMatrix matrix, String file, Map<String, Integer> id2index, boolean doLogarithm); static void writeMatrixInclHeaderAndRowIDs(DataMatrix dataMatrix, String file, boolean doLogarithm); static void writeMatrixInclHeaderAndRowIDs(FloatMatrix matrix, String file, Map<String, Integer> id2index, boolean doLogarithm);  }
@Test public void testWriteMatrixWithHeaders() throws Exception { Path outFile = Paths.get("target/testMatrixWithRowIdAndHeader"); DataMatrixIO.writeMatrixInclHeaderAndRowIDs(dataMatrix, outFile.toString(), true); assertFileExistsThenDelete(outFile); }