Class MaskedExpressionDataMatrix<T>
- java.lang.Object
-
- ubic.gemma.core.datastructure.matrix.AbstractExpressionDataMatrix<T>
-
- ubic.gemma.core.datastructure.matrix.MaskedExpressionDataMatrix<T>
-
- Type Parameters:
T
- the type of data in the matrix
- All Implemented Interfaces:
ExpressionDataMatrix<T>
public class MaskedExpressionDataMatrix<T> extends AbstractExpressionDataMatrix<T> implements ExpressionDataMatrix<T>
A wrapper for anExpressionDataMatrix
that applies a mask to the data, allowing selective access to the underlying matrix.- See Also:
MatrixMask
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
columns()
Obtain the total number of columns.protected String
format(int row, int column)
Format a matrix entry at a particular row/column.T
get(int row, int column)
Access a single value of the matrix by row and column.T[]
getColumn(int column)
Access a single column of the matrix.protected String
getColumnLabel(int j)
Obtain a label suitable for describing a column of the matrix.CompositeSequence
getDesignElementForRow(int index)
Return a design element for a given index.List<CompositeSequence>
getDesignElements()
Obtain all the design elements in this data matrix.ExpressionExperiment
getExpressionExperiment()
Return the expression experiment this matrix is holding data for, if known.QuantitationType
getQuantitationType()
Obtain the quantitation type for this matrix.T[]
getRow(int index)
Access a single row of the matrix, by index.T[]
getRow(CompositeSequence designElement)
Return a row that 'came from' the given design element.ExpressionDataMatrixRowElement
getRowElement(int row)
Deprecated.List<ExpressionDataMatrixRowElement>
getRowElements()
Deprecated.int
getRowIndex(CompositeSequence designElement)
int[]
getRowIndices(CompositeSequence designElement)
Obtain all the rows that correspond to the given design element, ornull
if the design element is not found.protected String
getRowLabel(int i)
Obtain a label suitable for describing a row of the matrix.MaskedExpressionDataMatrix<T>
inverted()
static <T> MaskedExpressionDataMatrix<T>
maskColumns(ExpressionDataMatrix<T> matrix, boolean[] columnMask, T maskedValue)
Mask whole columns of the given matrix.static <T> MaskedExpressionDataMatrix<T>
maskElements(ExpressionDataMatrix<T> matrix, boolean[][] mask, T maskedValue)
Mask individual elements of the given matrix.static <T> MaskedExpressionDataMatrix<T>
maskElements(ExpressionDataMatrix<T> matrix, int[] i, int[] j, T maskedValue)
Mask individual elements of the given matrix at the specified coordinates.static <T> MaskedExpressionDataMatrix<T>
maskRows(ExpressionDataMatrix<T> matrix, boolean[] rowMask, T maskedValue)
Mask whole rows of the given matrix.int
rows()
-
Methods inherited from class ubic.gemma.core.datastructure.matrix.AbstractExpressionDataMatrix
format, format, formatRepresentation, toString
-
-
-
-
Method Detail
-
maskElements
public static <T> MaskedExpressionDataMatrix<T> maskElements(ExpressionDataMatrix<T> matrix, boolean[][] mask, @Nullable T maskedValue)
Mask individual elements of the given matrix.- Parameters:
maskedValue
- value to use for masked elements, usuallynull
- See Also:
MatrixMask.maskElements(int, int, boolean[][])
-
maskElements
public static <T> MaskedExpressionDataMatrix<T> maskElements(ExpressionDataMatrix<T> matrix, int[] i, int[] j, @Nullable T maskedValue)
Mask individual elements of the given matrix at the specified coordinates.This uses a sparse representation internally, which is more efficient for large matrices with few masked elements.
-
maskRows
public static <T> MaskedExpressionDataMatrix<T> maskRows(ExpressionDataMatrix<T> matrix, boolean[] rowMask, @Nullable T maskedValue)
Mask whole rows of the given matrix.- See Also:
MatrixMask.maskRows(int, int, boolean[])
-
maskColumns
public static <T> MaskedExpressionDataMatrix<T> maskColumns(ExpressionDataMatrix<T> matrix, boolean[] columnMask, @Nullable T maskedValue)
Mask whole columns of the given matrix.
-
getExpressionExperiment
@Nullable public ExpressionExperiment getExpressionExperiment()
Description copied from interface:ExpressionDataMatrix
Return the expression experiment this matrix is holding data for, if known.- Specified by:
getExpressionExperiment
in interfaceExpressionDataMatrix<T>
-
getQuantitationType
public QuantitationType getQuantitationType()
Description copied from interface:ExpressionDataMatrix
Obtain the quantitation type for this matrix.- Specified by:
getQuantitationType
in interfaceExpressionDataMatrix<T>
-
getDesignElements
public List<CompositeSequence> getDesignElements()
Description copied from interface:ExpressionDataMatrix
Obtain all the design elements in this data matrix.- Specified by:
getDesignElements
in interfaceExpressionDataMatrix<T>
-
getDesignElementForRow
public CompositeSequence getDesignElementForRow(int index)
Description copied from interface:ExpressionDataMatrix
Return a design element for a given index.- Specified by:
getDesignElementForRow
in interfaceExpressionDataMatrix<T>
-
columns
public int columns()
Description copied from interface:ExpressionDataMatrix
Obtain the total number of columns.- Specified by:
columns
in interfaceExpressionDataMatrix<T>
-
getColumn
public T[] getColumn(int column)
Description copied from interface:ExpressionDataMatrix
Access a single column of the matrix.- Specified by:
getColumn
in interfaceExpressionDataMatrix<T>
- Parameters:
column
- index- Returns:
- T[]
-
rows
public int rows()
- Specified by:
rows
in interfaceExpressionDataMatrix<T>
- Returns:
- int
-
getRow
public T[] getRow(int index)
Description copied from interface:ExpressionDataMatrix
Access a single row of the matrix, by index. A complete row is returned.- Specified by:
getRow
in interfaceExpressionDataMatrix<T>
- Parameters:
index
- i- Returns:
- t[]
-
getRow
@Nullable public T[] getRow(CompositeSequence designElement)
Description copied from interface:ExpressionDataMatrix
Return a row that 'came from' the given design element.- Specified by:
getRow
in interfaceExpressionDataMatrix<T>
- Parameters:
designElement
- de- Returns:
- the corresponding row or null if the design element is not found in the matrix
-
getRowIndex
public int getRowIndex(CompositeSequence designElement)
- Specified by:
getRowIndex
in interfaceExpressionDataMatrix<T>
- Returns:
- the index for the given design element, or -1 if not found
-
getRowIndices
@Nullable public int[] getRowIndices(CompositeSequence designElement)
Description copied from interface:ExpressionDataMatrix
Obtain all the rows that correspond to the given design element, ornull
if the design element is not found.- Specified by:
getRowIndices
in interfaceExpressionDataMatrix<T>
-
getRowElements
@Deprecated public List<ExpressionDataMatrixRowElement> getRowElements()
Deprecated.- Specified by:
getRowElements
in interfaceExpressionDataMatrix<T>
- Returns:
- list of elements representing the row 'labels'.
-
getRowElement
@Deprecated public ExpressionDataMatrixRowElement getRowElement(int row)
Deprecated.- Specified by:
getRowElement
in interfaceExpressionDataMatrix<T>
-
get
public T get(int row, int column)
Description copied from interface:ExpressionDataMatrix
Access a single value of the matrix by row and column.- Specified by:
get
in interfaceExpressionDataMatrix<T>
-
inverted
public MaskedExpressionDataMatrix<T> inverted()
-
getRowLabel
protected String getRowLabel(int i)
Description copied from class:AbstractExpressionDataMatrix
Obtain a label suitable for describing a row of the matrix.- Specified by:
getRowLabel
in classAbstractExpressionDataMatrix<T>
-
getColumnLabel
protected String getColumnLabel(int j)
Description copied from class:AbstractExpressionDataMatrix
Obtain a label suitable for describing a column of the matrix.- Specified by:
getColumnLabel
in classAbstractExpressionDataMatrix<T>
-
format
protected String format(int row, int column)
Description copied from class:AbstractExpressionDataMatrix
Format a matrix entry at a particular row/column.- Specified by:
format
in classAbstractExpressionDataMatrix<T>
-
-