Class SingleCellSparsityMetrics
- java.lang.Object
-
- ubic.gemma.core.analysis.singleCell.SingleCellSparsityMetrics
-
@Component public class SingleCellSparsityMetrics extends Object
Compute sparsity metrics for single cell data.- Author:
- poirigui
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_THRESHOLD
Default threshold to use when determining if a value is expressed.
-
Constructor Summary
Constructors Constructor Description SingleCellSparsityMetrics()
SingleCellSparsityMetrics(double threshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExpressedCells(SingleCellExpressionDataVector vector, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex, boolean[] isExpressed)
Populate a boolean vector that indicates if a cell has at least one expressed gene.int
getNumberOfCells(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
Calculate the number of cells with at least one gene expressed.int
getNumberOfCellsByDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
Calculate the number of expressed cell by gene pairs.int
getNumberOfCellsByDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
int
getNumberOfDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics characteristic, int characteristicIndex)
Calculate the number of genes expressed in at least one cell.int
getNumberOfDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, CellLevelCharacteristics characteristic, int characteristicIndex)
boolean
isSupported(SingleCellExpressionDataVector vector)
Check if sparsity metrics can be computed for a given collection of vectors.
-
-
-
Field Detail
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLD
Default threshold to use when determining if a value is expressed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SingleCellSparsityMetrics
public SingleCellSparsityMetrics()
-
SingleCellSparsityMetrics
public SingleCellSparsityMetrics(double threshold)
- Parameters:
threshold
- exclusive value to use to assess if data on aScaleType.LINEAR
scale is expressed. The threshold is transformed depending on the scale type of the vectors being tested:ScaleType.COUNT
usesMath.rint(double)
ScaleType.LOG1P
usesMath.log1p(double)
ScaleType.LOG2
usesMath.log(double)
/Math.log(2)
ScaleType.LN
usesMath.log(double)
ScaleType.LOG10
usesMath.log10(double)
ScaleType.PERCENT
,ScaleType.PERCENT1
andScaleType.LOGBASEUNKNOWN
, only zero is supported. If a scale type is not supported, an exception will be raised. You can useisSupported(SingleCellExpressionDataVector)
to safely perform the check.
-
-
Method Detail
-
isSupported
public boolean isSupported(SingleCellExpressionDataVector vector)
Check if sparsity metrics can be computed for a given collection of vectors.
-
getNumberOfCells
public int getNumberOfCells(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, @Nullable CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
Calculate the number of cells with at least one gene expressed.- Parameters:
characteristicIndex
- only cell with the given characteristic index will be considered
-
addExpressedCells
public void addExpressedCells(SingleCellExpressionDataVector vector, int sampleIndex, @Nullable CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex, boolean[] isExpressed)
Populate a boolean vector that indicates if a cell has at least one expressed gene.
-
getNumberOfDesignElements
public int getNumberOfDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, @Nullable CellLevelCharacteristics characteristic, int characteristicIndex)
Calculate the number of genes expressed in at least one cell.
-
getNumberOfDesignElements
public int getNumberOfDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, @Nullable CellLevelCharacteristics characteristic, int characteristicIndex)
-
getNumberOfCellsByDesignElements
public int getNumberOfCellsByDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, @Nullable CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
Calculate the number of expressed cell by gene pairs.
-
getNumberOfCellsByDesignElements
public int getNumberOfCellsByDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, @Nullable CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex)
-
-