Class ExpressionDataDoubleMatrix
- java.lang.Object
-
- ubic.gemma.core.datastructure.matrix.BaseExpressionDataMatrix<Double>
-
- ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix
-
- All Implemented Interfaces:
Serializable
,ExpressionDataMatrix<Double>
public class ExpressionDataDoubleMatrix extends BaseExpressionDataMatrix<Double>
A data structure that holds a reference to the data for a given expression experiment. The data can be queried by row or column, returning data for a specific DesignElement or data for a specific BioAssay. This class is not database aware so the vectors provided must already be 'thawed'.- Author:
- pavlidis, keshav
- See Also:
- Serialized Form
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
columns()
Total number of columns.Double
get(int row, int column)
Access a single value of the matrix.Double[][]
get(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
Access a submatrixDouble
get(CompositeSequence designElement, BioAssay bioAssay)
Access a single value of the matrix.Double[]
getColumn(Integer index)
Access a single column of the matrix.Double[]
getColumn(BioAssay bioAssay)
Access a single column of the matrix.Double[][]
getColumns(List<BioAssay> bioAssays)
Access a submatrix slice by columnsDoubleMatrix<CompositeSequence,BioMaterial>
getMatrix()
Map<CompositeSequence,Double>
getRanks()
Double[][]
getRawMatrix()
Access the entire matrix.double[]
getRawRow(Integer index)
Double[]
getRow(Integer index)
Access a single row of the matrix, by index.Double[]
getRow(CompositeSequence designElement)
Return a row that 'came from' the given design element.List<CompositeSequence>
getRowNames()
Double[][]
getRows(List<CompositeSequence> designElements)
Access a submatrixboolean
hasMissingValues()
int
rows()
void
set(int row, int column, Double value)
Set a value in the matrix, by indexvoid
set(CompositeSequence designElement, BioAssay bioAssay, Double value)
void
setRow(int rowIndex, Double[] data)
Sets the row of matrix to the input data.Collection<ProcessedExpressionDataVector>
toProcessedDataVectors()
Collection<RawExpressionDataVector>
toRawDataVectors()
Same as toProcessedDataVectors but uses RawExpressionDataVectorString
toString()
protected void
vectorsToMatrix(Collection<? extends DesignElementDataVector> vectors)
ConvertDesignElementDataVector
s into Double matrix.-
Methods inherited from class ubic.gemma.core.datastructure.matrix.BaseExpressionDataMatrix
columns, getBestBioAssayDimension, getBioAssayDimension, getBioAssaysForColumn, getBioMaterialForColumn, getColumnIndex, getDesignElementForRow, getDesignElements, getExpressionExperiment, getQuantitationTypes, getRowElement, getRowElements, getRowIndex
-
-
-
-
Constructor Detail
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix()
To comply with bean specifications. Not to be instantiated.
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends DesignElementDataVector> vectors)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionExperiment ee, Collection<ProcessedExpressionDataVector> vectors)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends DesignElementDataVector> dataVectors, Collection<QuantitationType> quantitationTypes)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends DesignElementDataVector> dataVectors, QuantitationType quantitationType)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionDataDoubleMatrix sourceMatrix, DoubleMatrix<CompositeSequence,BioMaterial> dataMatrix, Collection<QuantitationType> quantitationTypes)
Create a data matrix like sourceMatrix but use the values and quantitations from dataMatrix.Note: The rows can be different from the original matrix, but the columns must be the same.
- Parameters:
sourceMatrix
- source matrix from which most of the meta-data will be importeddataMatrix
- data matrix to usequantitationTypes
- quantitation types used by the dataMatrix
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionDataDoubleMatrix sourceMatrix, List<CompositeSequence> rowsToUse)
Create a matrix based on another one's selected rows.- Parameters:
rowsToUse
- rowssourceMatrix
- matrix
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionExperiment ee, QuantitationType qt, DoubleMatrix<CompositeSequence,BioMaterial> matrix)
Create a matrix given a 'raw' matrix that uses the same samples as the experiment. Only simple situations are supported (one platform, not subsetting the dataset).- Parameters:
ee
- to be associated with thisqt
- to be associated with thismatrix
- with valid row and column elements, and the data
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionDataDoubleMatrix sourceMatrix, List<BioMaterial> columnsToUse, BioAssayDimension reorderedDim)
Create a matrix based on another one's selected columns. The results will be somewhat butchered - only a single BioAssayDimension and the ranks will be copied over (not recomputed based on the selected columns).- Parameters:
columnsToUse
- columnssourceMatrix
- matrixreorderedDim
- the reordered bioAssayDimension.
-
-
Method Detail
-
columns
public int columns()
Description copied from interface:ExpressionDataMatrix
Total number of columns.- Returns:
- int
-
get
public Double get(CompositeSequence designElement, BioAssay bioAssay)
Description copied from interface:ExpressionDataMatrix
Access a single value of the matrix. Note that because there can be multiple bioassays per column and multiple designelements per row, it is possible for this method to retrieve a data that does not come from the bioassay and/or designelement arguments.- Parameters:
designElement
- debioAssay
- ba- Returns:
- T t
-
get
public Double get(int row, int column)
Description copied from interface:ExpressionDataMatrix
Access a single value of the matrix. This is generally the easiest way to do it.- Parameters:
row
- rowcolumn
- col- Returns:
- t
-
get
public Double[][] get(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
Description copied from interface:ExpressionDataMatrix
Access a submatrix- Parameters:
designElements
- debioAssays
- bas- Returns:
- T[][]
-
getColumn
public Double[] getColumn(BioAssay bioAssay)
Description copied from interface:ExpressionDataMatrix
Access a single column of the matrix.- Parameters:
bioAssay
- i- Returns:
- T[]
-
getColumn
public Double[] getColumn(Integer index)
Description copied from interface:ExpressionDataMatrix
Access a single column of the matrix.- Parameters:
index
- index- Returns:
- T[]
-
getColumns
public Double[][] getColumns(List<BioAssay> bioAssays)
Description copied from interface:ExpressionDataMatrix
Access a submatrix slice by columns- Parameters:
bioAssays
- ba- Returns:
- t[][]
-
getRawMatrix
public Double[][] getRawMatrix()
Description copied from interface:ExpressionDataMatrix
Access the entire matrix.- Returns:
- T[][]
-
getRow
public Double[] getRow(CompositeSequence designElement)
Description copied from interface:ExpressionDataMatrix
Return a row that 'came from' the given design element.- Parameters:
designElement
- de- Returns:
- t
-
getRow
public Double[] getRow(Integer index)
Description copied from interface:ExpressionDataMatrix
Access a single row of the matrix, by index. A complete row is returned.- Parameters:
index
- i- Returns:
- t[]
-
getRows
public Double[][] getRows(List<CompositeSequence> designElements)
Description copied from interface:ExpressionDataMatrix
Access a submatrix- Parameters:
designElements
- de- Returns:
- T[][]
-
hasMissingValues
public boolean hasMissingValues()
- Returns:
- true if any values are null or NaN (for Doubles); all other values are considered non-missing.
-
rows
public int rows()
- Returns:
- int
-
set
public void set(int row, int column, Double value)
Description copied from interface:ExpressionDataMatrix
Set a value in the matrix, by index- Parameters:
row
- rowcolumn
- colvalue
- val
-
toProcessedDataVectors
public Collection<ProcessedExpressionDataVector> toProcessedDataVectors()
- Returns:
- Convert this to a collection of vectors.
-
toRawDataVectors
public Collection<RawExpressionDataVector> toRawDataVectors()
Same as toProcessedDataVectors but uses RawExpressionDataVector- Returns:
- Convert this to a collection of vectors.
-
getMatrix
public DoubleMatrix<CompositeSequence,BioMaterial> getMatrix()
-
getRanks
public Map<CompositeSequence,Double> getRanks()
- Returns:
- The expression level ranks (based on mean signal intensity in the vectors); this will be empty if the vectors used to construct the matrix were not ProcessedExpressionDataVectors.
-
getRawRow
public double[] getRawRow(Integer index)
-
getRowNames
public List<CompositeSequence> getRowNames()
-
set
public void set(CompositeSequence designElement, BioAssay bioAssay, Double value)
-
setRow
public void setRow(int rowIndex, Double[] data)
Sets the row of matrix to the input data.- Parameters:
rowIndex
- The row index of the data in the matrix to be replaced.data
- The input data.
-
vectorsToMatrix
protected void vectorsToMatrix(Collection<? extends DesignElementDataVector> vectors)
ConvertDesignElementDataVector
s into Double matrix.- Specified by:
vectorsToMatrix
in classBaseExpressionDataMatrix<Double>
-
-