alphapepttools.metrics.number_detected#
- alphapepttools.metrics.number_detected(adata, *, layer=None, axis='obs', column='number_detected', inplace=True)#
Count the number of detected features per observation or detected observations per feature.
A value is considered detected if it is not a special value (NaN, zero, negative, or infinite).
- Parameters:
adata (
AnnData) – AnnData objectlayer (
str|None(default:None)) – Name of the layer to use. If None (default), the data matrix X is used.axis (
str(default:'obs')) –Axis along which to calculate the count. - “obs” (default): Count detected features per observation.
Result is added to adata.obs.
”var”: Count detected observations per feature. Result is added to adata.var.
column (
str(default:'number_detected')) – Name of the column to add. Default is “number_detected”.inplace (
bool(default:True)) – If True (default), modifies adata inplace and adds the result to adata.obs or adata.var. If False, returns the calculated values without modifying adata.
- Return type:
- Returns:
np.ndarray | None If inplace is False, returns the count values as an array. If inplace is True, modifies adata inplace and returns None.