Class MexMatrixWriter
- java.lang.Object
-
- ubic.gemma.core.datastructure.matrix.io.MexMatrixWriter
-
- All Implemented Interfaces:
ExpressionDataMatrixWriter<SingleCellExpressionDataMatrix<?>>,SingleCellExpressionDataMatrixWriter
public class MexMatrixWriter extends Object implements SingleCellExpressionDataMatrixWriter
WritesSingleCellExpressionDataMatrixto the 10x MEX format.The data is written as a TAR archive containing the following entries for each bioassay:
{bioAssayName}/barcodes.tsv,{bioAssayName}/features.tsv,{bioAssayName}/matrix.mtx. If using the directory output, individual files are compressed and will have a.gzextension.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description MexMatrixWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intwrite(Stream<SingleCellExpressionDataVector> vectors, int numVecs, Map<BioAssay,Long> nnzBySample, Map<CompositeSequence,Set<Gene>> cs2gene, Path outputDir)Writes a stream of vectors to a directory.intwrite(SingleCellExpressionDataMatrix<?> matrix, OutputStream stream)Write the matrix to the given output stream.intwrite(SingleCellExpressionDataMatrix<?> matrix, Writer stream)Write the matrix to the given writer.intwrite(SingleCellExpressionDataMatrix<?> matrix, Map<CompositeSequence,Set<Gene>> cs2gene, OutputStream stream)Write a MEX matrix as a TAR archive to the given output stream.intwrite(SingleCellExpressionDataMatrix<?> matrix, Map<CompositeSequence,Set<Gene>> cs2gene, Path outputDir)Write a matrix to a directory.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ubic.gemma.core.datastructure.matrix.io.ExpressionDataMatrixWriter
setAutoFlush, setScaleType
-
-
-
-
Method Detail
-
write
public int write(SingleCellExpressionDataMatrix<?> matrix, Writer stream) throws IOException
Description copied from interface:ExpressionDataMatrixWriterWrite the matrix to the given writer.- Specified by:
writein interfaceExpressionDataMatrixWriter<SingleCellExpressionDataMatrix<?>>- Returns:
- the number of vectors written
- Throws:
IOException
-
write
public int write(SingleCellExpressionDataMatrix<?> matrix, OutputStream stream) throws IOException
Description copied from interface:ExpressionDataMatrixWriterWrite the matrix to the given output stream.- Specified by:
writein interfaceExpressionDataMatrixWriter<SingleCellExpressionDataMatrix<?>>- Returns:
- the number of vectors written
- Throws:
IOException
-
write
public int write(SingleCellExpressionDataMatrix<?> matrix, @Nullable Map<CompositeSequence,Set<Gene>> cs2gene, OutputStream stream) throws IOException
Write a MEX matrix as a TAR archive to the given output stream.- Throws:
IOException
-
write
public int write(SingleCellExpressionDataMatrix<?> matrix, @Nullable Map<CompositeSequence,Set<Gene>> cs2gene, Path outputDir) throws IOException
Write a matrix to a directory.- Throws:
IOException
-
write
public int write(Stream<SingleCellExpressionDataVector> vectors, int numVecs, Map<BioAssay,Long> nnzBySample, @Nullable Map<CompositeSequence,Set<Gene>> cs2gene, Path outputDir) throws IOException
Writes a stream of vectors to a directory.- Parameters:
vectors- a stream of vectorsnumVecs- the total number of vectors to writennzBySample- the number of non-zeroes by samplecs2gene- a mapping of design elements to their corresponding gene(s)- Throws:
IOException
-
-