Class ExpressionDataDoubleMatrix
- java.lang.Object
-
- ubic.gemma.core.datastructure.matrix.AbstractExpressionDataMatrix<T>
-
- ubic.gemma.core.datastructure.matrix.AbstractMultiAssayExpressionDataMatrix<Double>
-
- ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix
-
- All Implemented Interfaces:
BulkExpressionDataMatrix<Double>
,BulkExpressionDataPrimitiveDoubleMatrix
,ExpressionDataMatrix<Double>
,ExpressionDataPrimitiveDoubleMatrix
,MultiAssayBulkExpressionDataMatrix<Double>
public class ExpressionDataDoubleMatrix extends AbstractMultiAssayExpressionDataMatrix<Double> implements BulkExpressionDataPrimitiveDoubleMatrix
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
-
-
Field Summary
-
Fields inherited from class ubic.gemma.core.datastructure.matrix.AbstractMultiAssayExpressionDataMatrix
bioAssayDimensions, columnAssayMap, columnBioAssayMapByInteger, columnBioMaterialMap, columnBioMaterialMapByInteger, expressionExperiment, quantitationTypes, rowDesignElementMapByInteger, rowElementMap
-
-
Constructor Summary
-
Method Summary
All 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 the value at the provided indices of the matrix.Double
get(int row, int column)
Access a single value of the matrix by row and column.double
getAsDouble(int row, int column)
Retrieve the value at the given row and column without boxing.Double[]
getColumn(int index)
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.DoubleMatrix<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[]
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)
Deprecated.void
set(CompositeSequence designElement, BioAssay bioAssay, Double value)
Collection<ProcessedExpressionDataVector>
toProcessedDataVectors()
Collection<RawExpressionDataVector>
toRawDataVectors()
Same as toProcessedDataVectors but uses RawExpressionDataVectorprotected void
vectorsToMatrix(Collection<? extends BulkExpressionDataVector> vectors)
Populate this matrix from a given collection ofBulkExpressionDataVector
s.-
Methods inherited from class ubic.gemma.core.datastructure.matrix.AbstractMultiAssayExpressionDataMatrix
addToRowMaps, columns, formatRepresentation, get, getBestBioAssayDimension, getBioAssayDimension, getBioAssayDimension, getBioAssayDimensions, getBioAssayForColumn, getBioAssaysForColumn, getBioMaterialForColumn, getColumn, getColumnIndex, getColumnIndex, getColumnLabel, getDesignElementForRow, getDesignElements, getExpressionExperiment, getQuantitationType, getQuantitationTypes, getRow, getRowElement, getRowElements, getRowIndex, getRowIndices, getRowLabel, selectVectors, selectVectors, selectVectors, setMatBioAssayValues, setUpColumnElements
-
Methods inherited from class ubic.gemma.core.datastructure.matrix.AbstractExpressionDataMatrix
format, format, toString
-
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.BulkExpressionDataMatrix
get, getBioAssayForColumn, getColumn, getColumnIndex
-
Methods inherited from interface ubic.gemma.core.datastructure.matrix.ExpressionDataMatrix
getDesignElementForRow, getDesignElements, getExpressionExperiment, getRow, getRowElement, getRowElements, getRowIndex, getRowIndices
-
-
-
-
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 dmatrix, DoubleMatrix<CompositeSequence,BioMaterial> copiedMatrix)
-
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(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)
-
getColumnAsDoubles
public double[] getColumnAsDoubles(BioAssay bioAssay)
Description copied from interface:BulkExpressionDataPrimitiveDoubleMatrix
Retrieve the given column without boxing.- Specified by:
getColumnAsDoubles
in interfaceBulkExpressionDataPrimitiveDoubleMatrix
- See Also:
BulkExpressionDataMatrix.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)
-
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.- Specified by:
getRawMatrixAsDoubles
in interfaceBulkExpressionDataPrimitiveDoubleMatrix
- See Also:
getRawMatrix()
-
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 and floats); any other value that is considered missing.
-
rows
public int rows()
- Specified by:
rows
in interfaceExpressionDataMatrix<Double>
- Returns:
- int
-
set
@Deprecated public void set(int row, int column, @Nullable Double value)
Deprecated.Modifying the matrix directly is not recommended, make a copy instead.
-
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)
-
format
protected String format(int row, int column)
Description copied from class:AbstractMultiAssayExpressionDataMatrix
Format the value at the provided indices of the matrix.- Specified by:
format
in classAbstractMultiAssayExpressionDataMatrix<Double>
-
vectorsToMatrix
protected void vectorsToMatrix(Collection<? extends BulkExpressionDataVector> vectors)
Populate this matrix from a given collection ofBulkExpressionDataVector
s.- Specified by:
vectorsToMatrix
in classAbstractMultiAssayExpressionDataMatrix<Double>
-
-