Class ExpressionDataDoubleMatrix
- java.lang.Object
-
- ubic.gemma.core.datastructure.matrix.BaseExpressionDataMatrix<Double>
-
- ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix
-
- All Implemented Interfaces:
Serializable
,BulkExpressionDataMatrix<Double>
,ExpressionDataMatrix<Double>
,ExpressionDataPrimitiveDoubleMatrix
public class ExpressionDataDoubleMatrix extends BaseExpressionDataMatrix<Double> implements ExpressionDataPrimitiveDoubleMatrix
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
-
-
Field Summary
-
Fields inherited from class ubic.gemma.core.datastructure.matrix.BaseExpressionDataMatrix
bioAssayDimensions, columnAssayMap, columnBioAssayMapByInteger, columnBioMaterialMap, columnBioMaterialMapByInteger, expressionExperiment, quantitationTypes, rowDesignElementMapByInteger, rowElementMap
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
columns()
Obtain the total number of columns.Double
get(int row, int column)
Access a single value of the matrix by row and column.Double[][]
get(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
Access a submatrixDouble
get(CompositeSequence designElement, BioAssay bioAssay)
Access a single value of the matrix.double
getAsDouble(int row, int column)
Retrieve the value at the given row and column without boxing.double[][]
getAsDoubles(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
Double[]
getColumn(int index)
Access a single column of the matrix.Double[]
getColumn(BioAssay bioAssay)
Access a single column of the matrix.double[]
getColumnAsDoubles(int index)
Retrieve the given column without boxing.double[]
getColumnAsDoubles(BioAssay bioAssay)
Retrieve the given column without boxing.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[][]
getRawMatrixAsDoubles()
Obtain the raw matrix without boxing.Double[]
getRow(int index)
Access a single row of the matrix, by index.Double[]
getRow(CompositeSequence designElement)
Return a row that 'came from' the given design element.double[]
getRowAsDoubles(int index)
Retrieve a row without boxing.double[]
getRowAsDoubles(CompositeSequence designElement)
Retrieve the row for the given design element without boxing.List<CompositeSequence>
getRowNames()
boolean
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 BulkExpressionDataVector> vectors)
Populate this matrix from a given collection ofBulkExpressionDataVector
s.-
Methods inherited from class ubic.gemma.core.datastructure.matrix.BaseExpressionDataMatrix
addToRowMaps, columns, getBestBioAssayDimension, getBioAssayDimension, getBioAssayForColumn, getBioAssaysForColumn, getBioMaterialForColumn, getColumnIndex, getColumnIndex, getDesignElementForRow, getDesignElements, getExpressionExperiment, getQuantitationType, getQuantitationTypes, getRowElement, getRowElement, getRowElements, getRowIndex, init, selectVectors, selectVectors, selectVectors, selectVectors, setMatBioAssayValues, setUpColumnElements
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ubic.gemma.core.datastructure.matrix.ExpressionDataMatrix
getDesignElementForRow, getDesignElements, getRowElement, getRowElement, getRowElements, getRowIndex
-
-
-
-
Constructor Detail
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix()
To comply with bean specifications. Not to be instantiated.
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends BulkExpressionDataVector> vectors)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(ExpressionExperiment ee, Collection<? extends BulkExpressionDataVector> vectors)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends BulkExpressionDataVector> dataVectors, Collection<QuantitationType> quantitationTypes)
-
ExpressionDataDoubleMatrix
public ExpressionDataDoubleMatrix(Collection<? extends BulkExpressionDataVector> 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
Obtain the total number of columns.- Specified by:
columns
in interfaceExpressionDataMatrix<Double>
-
get
public Double get(CompositeSequence designElement, BioAssay bioAssay)
Description copied from interface:BulkExpressionDataMatrix
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.- Specified by:
get
in interfaceBulkExpressionDataMatrix<Double>
- 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 by row and column.- Specified by:
get
in interfaceExpressionDataMatrix<Double>
-
getAsDouble
public double getAsDouble(int row, int column)
Description copied from interface:ExpressionDataPrimitiveDoubleMatrix
Retrieve the value at the given row and column without boxing.- Specified by:
getAsDouble
in interfaceExpressionDataPrimitiveDoubleMatrix
- See Also:
ExpressionDataMatrix.get(int, int)
-
get
public Double[][] get(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
Description copied from interface:BulkExpressionDataMatrix
Access a submatrix- Specified by:
get
in interfaceBulkExpressionDataMatrix<Double>
- Parameters:
designElements
- debioAssays
- bas- Returns:
- T[][]
-
getAsDoubles
public double[][] getAsDoubles(List<CompositeSequence> designElements, List<BioAssay> bioAssays)
-
getColumn
public Double[] getColumn(BioAssay bioAssay)
Description copied from interface:BulkExpressionDataMatrix
Access a single column of the matrix.- Specified by:
getColumn
in interfaceBulkExpressionDataMatrix<Double>
- Parameters:
bioAssay
- i- Returns:
- T[]
-
getColumnAsDoubles
public double[] getColumnAsDoubles(BioAssay bioAssay)
Retrieve the given column without boxing.- See Also:
getColumn(BioAssay)
-
getColumn
public Double[] getColumn(int index)
Description copied from interface:ExpressionDataMatrix
Access a single column of the matrix.- Specified by:
getColumn
in interfaceExpressionDataMatrix<Double>
- Parameters:
index
- index- Returns:
- T[]
-
getColumnAsDoubles
public double[] getColumnAsDoubles(int index)
Description copied from interface:ExpressionDataPrimitiveDoubleMatrix
Retrieve the given column without boxing.- Specified by:
getColumnAsDoubles
in interfaceExpressionDataPrimitiveDoubleMatrix
- See Also:
ExpressionDataMatrix.getColumn(int)
-
getColumns
public Double[][] getColumns(List<BioAssay> bioAssays)
Description copied from interface:BulkExpressionDataMatrix
Access a submatrix slice by columns- Specified by:
getColumns
in interfaceBulkExpressionDataMatrix<Double>
- Parameters:
bioAssays
- ba- Returns:
- t[][]
-
getRawMatrix
public Double[][] getRawMatrix()
Description copied from interface:BulkExpressionDataMatrix
Access the entire matrix.- Specified by:
getRawMatrix
in interfaceBulkExpressionDataMatrix<Double>
- Returns:
- T[][]
-
getRawMatrixAsDoubles
public double[][] getRawMatrixAsDoubles()
Obtain the raw matrix without boxing.- See Also:
getRawMatrix()
-
getRow
public Double[] getRow(CompositeSequence designElement)
Description copied from interface:ExpressionDataMatrix
Return a row that 'came from' the given design element.- Specified by:
getRow
in interfaceExpressionDataMatrix<Double>
- Parameters:
designElement
- de- Returns:
- the corresponding row or null if the design element is not found in the matrix
-
getRowAsDoubles
public double[] getRowAsDoubles(CompositeSequence designElement)
Description copied from interface:ExpressionDataPrimitiveDoubleMatrix
Retrieve the row for the given design element without boxing.- Specified by:
getRowAsDoubles
in interfaceExpressionDataPrimitiveDoubleMatrix
- See Also:
ExpressionDataMatrix.getRow(CompositeSequence)
-
getRow
public Double[] 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<Double>
- Parameters:
index
- i- Returns:
- t[]
-
getRowAsDoubles
public double[] getRowAsDoubles(int index)
Description copied from interface:ExpressionDataPrimitiveDoubleMatrix
Retrieve a row without boxing.- Specified by:
getRowAsDoubles
in interfaceExpressionDataPrimitiveDoubleMatrix
- See Also:
ExpressionDataMatrix.getRow(int)
-
hasMissingValues
public boolean hasMissingValues()
- Specified by:
hasMissingValues
in interfaceBulkExpressionDataMatrix<Double>
- Returns:
- true if any values are null or NaN (for Doubles); all other values are considered non-missing.
-
rows
public int rows()
- Specified by:
rows
in interfaceExpressionDataMatrix<Double>
- Returns:
- int
-
set
public void set(int row, int column, @Nullable Double value)
Description copied from interface:BulkExpressionDataMatrix
Set a value in the matrix, by index- Specified by:
set
in interfaceBulkExpressionDataMatrix<Double>
- 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.
-
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 BulkExpressionDataVector> vectors)
Populate this matrix from a given collection ofBulkExpressionDataVector
s.- Specified by:
vectorsToMatrix
in classBaseExpressionDataMatrix<Double>
-
-