rapids_singlecell.pp.scale#
- rapids_singlecell.pp.scale(data, *, zero_center=True, max_value=None, copy=False, layer=None, obsm=None, mask_obs=None, inplace=True)[source]#
Scales matrix to unit variance and clips values
- Parameters:
- data
Union[AnnData,ndarray,csc_matrix,csr_matrix,Array] The (annotated) data matrix of shape
n_obs×n_vars. Rows correspond to cells and columns to genes. If a matrix is passed instead of anAnnDataobject, the scaled matrix is returned.- zero_center
bool(default:True) If
False, omit zero-centering variables, which allows to handle sparse input efficiently.- max_value
float|None(default:None) Clip (truncate) to this value after scaling. If
None, do not clip.- copy
bool(default:False) Whether this function should be performed inplace. If an AnnData object is passed, this also determines if a copy is returned. Only applies to
AnnDatainput.- layer
str|None(default:None) If provided, which element of layers to scale.
- obsm
str|None(default:None) If provided, which element of obsm to scale.
- mask_obs
ndarray|str|None(default:None) Restrict both the derivation of scaling parameters and the scaling itself to a certain set of observations. The mask is specified as a boolean array or a string referring to an array in
obs. If the matrix is in csc format and a mask is provided, the matrix will be transformed to csr format.- inplace
bool(default:True) If True, update AnnData with results. Otherwise, return results. See below for details of what is returned. For matrix input the scaled matrix is always returned.
- data
- Return type:
- Returns:
Returns a scaled copy or updates
datawith a scaled version of the originalXanddata.layers['layer'], depending oninplace. If a matrix is passed, the scaled matrix is returned.