Class SingleCellSparsityMetrics
java.lang.Object
ubic.gemma.core.analysis.singleCell.SingleCellSparsityMetrics
Compute sparsity metrics for single-cell data.
- Author:
- poirigui
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDefault threshold to use when determining if a value is expressed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExpressedCells(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.intgetNumberOfCells(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex) Calculate the number of cells with at least one gene expressed.intgetNumberOfCellsByDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex) Calculate the number of expressed cell by gene pairs.intgetNumberOfCellsByDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, CellLevelCharacteristics cellLevelCharacteristics, int characteristicIndex) intgetNumberOfDesignElements(Collection<SingleCellExpressionDataVector> vectors, int sampleIndex, CellLevelCharacteristics characteristic, int characteristicIndex) Calculate the number of genes expressed in at least one cell.intgetNumberOfDesignElements(SingleCellExpressionDataVector vector, int sampleIndex, CellLevelCharacteristics characteristic, int characteristicIndex) booleanCheck if sparsity metrics can be computed for a given collection of vectors.
-
Field Details
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLDDefault threshold to use when determining if a value is expressed.- See Also:
-
-
Constructor Details
-
SingleCellSparsityMetrics
public SingleCellSparsityMetrics() -
SingleCellSparsityMetrics
public SingleCellSparsityMetrics(double threshold) - Parameters:
threshold- exclusive value to use to assess if data on aScaleType.LINEARscale is expressed. The threshold is transformed depending on the scale type of the vectors being tested:ScaleType.COUNTusesMath.rint(double)ScaleType.LOG1PusesMath.log1p(double)ScaleType.LOG2usesMath.log(double)/Math.log(2)ScaleType.LNusesMath.log(double)ScaleType.LOG10usesMath.log10(double)
ScaleType.PERCENT,ScaleType.PERCENT1andScaleType.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 Details
-
isSupported
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)
-