Class MatrixWriter
java.lang.Object
ubic.gemma.core.datastructure.matrix.io.MatrixWriter
- All Implemented Interfaces:
BulkExpressionDataMatrixWriter,ExpressionDataMatrixWriter<BulkExpressionDataMatrix<?>,BulkExpressionDataVector>
@ParametersAreNonnullByDefault
public class MatrixWriter
extends Object
implements BulkExpressionDataMatrixWriter
Writes
BulkExpressionDataMatrix to a tabular format.- Author:
- pavlidis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetAutoFlush(boolean autoFlush) Flush every time a complete line is written.voidsetExcludeSampleIdentifiers(boolean excludeSampleIdentifiers) Only include bioassays in the formed column name instead of prepending it with the sample name.voidsetScaleType(ScaleType scaleType) Set the scale type to use when writing the matrix.voidsetUseBioAssayIds(boolean useBioAssayIds) Use BioAssay IDs (and BioMaterial IDs) in the column names instead of names (or short names).voidsetUseRawColumnNames(boolean useRawColumnNames) Do not make the column names R-friendly.intwrite(BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, Writer writer) Write the matrix to the given writer.intwrite(BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, Map<CompositeSequence, Collection<Gene>> geneAnnotations, Writer writer) intwriteWithStringifiedGeneAnnotations(Writer writer, BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, Map<CompositeSequence, String[]> geneAnnotations) Alternate method that uses annotations in string form (e.g., read from another file).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ubic.gemma.core.datastructure.matrix.io.ExpressionDataMatrixWriter
write
-
Constructor Details
-
MatrixWriter
-
-
Method Details
-
write
public int write(BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, Writer writer) throws IOException Description copied from interface:ExpressionDataMatrixWriterWrite the matrix to the given writer.- Specified by:
writein interfaceExpressionDataMatrixWriter<BulkExpressionDataMatrix<?>,BulkExpressionDataVector> - Parameters:
vectorType- the type of vectors to write. This helps the writer determine how theQuantitationTypeof the matrix should be interpreted.- Returns:
- the number of vectors written
- Throws:
IOException
-
write
public int write(BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, @Nullable Map<CompositeSequence, Collection<Gene>> geneAnnotations, Writer writer) throws IOException- Parameters:
matrix- the matrixvectorType- the type of vector to writegeneAnnotations- Map of composite sequences to an array of delimited strings: [probe name,genes symbol, gene Name] -- these include the "|" to indicate multiple genes, and originate in the platform annotation files.writer- the writer to use- Throws:
IOException- when the write failed
-
writeWithStringifiedGeneAnnotations
public int writeWithStringifiedGeneAnnotations(Writer writer, BulkExpressionDataMatrix<?> matrix, Class<? extends BulkExpressionDataVector> vectorType, @Nullable Map<CompositeSequence, String[]> geneAnnotations) throws IOExceptionAlternate method that uses annotations in string form (e.g., read from another file).- Parameters:
writer- the writer to usematrix- the matrix to writevectorType- the type of vector to writegeneAnnotations- Map of composite sequences to an array of delimited strings: [probe name,genes symbol, gene Name] -- these include the "|" to indicate multiple genes, and originate in the platform annotation files.- Throws:
IOException- when the write failed- See Also:
-
setExcludeSampleIdentifiers
public void setExcludeSampleIdentifiers(boolean excludeSampleIdentifiers) Only include bioassays in the formed column name instead of prepending it with the sample name. -
setUseBioAssayIds
public void setUseBioAssayIds(boolean useBioAssayIds) Use BioAssay IDs (and BioMaterial IDs) in the column names instead of names (or short names). -
setUseRawColumnNames
public void setUseRawColumnNames(boolean useRawColumnNames) Do not make the column names R-friendly.- See Also:
-
setAutoFlush
public void setAutoFlush(boolean autoFlush) Description copied from interface:ExpressionDataMatrixWriterFlush every time a complete line is written.This is not very efficient, but it can be used to view the output of a matrix as it is being written.
- Specified by:
setAutoFlushin interfaceExpressionDataMatrixWriter<BulkExpressionDataMatrix<?>,BulkExpressionDataVector>
-
setScaleType
Description copied from interface:ExpressionDataMatrixWriterSet the scale type to use when writing the matrix.When null, the original values must be used.
- Specified by:
setScaleTypein interfaceExpressionDataMatrixWriter<BulkExpressionDataMatrix<?>,BulkExpressionDataVector>
-