pytometry.tl.normalize_autologicle

pytometry.tl.normalize_autologicle#

pytometry.tl.normalize_autologicle(adata, channels=None, m=4.5, q=0.05, inplace=True, return_params=False, params_override=None)#

Autologicle transformation.

Automatically apply a logicle transformation to specified channels in an AnnData object. Code adapted from the Cytofkit package (Chen et al. 2016). This function processes multiple channels within an AnnData object by applying a logicle transformation to each one.

Parameters:
  • adata (AnnData) – The AnnData object containing the data to be transformed.

  • channels (str | list[str] | None (default: None)) – A list of channel names to be logicle transformed.

  • m (float (default: 4.5)) – The upper limit for the transformation parameter ‘m’.

  • q (float (default: 0.05)) – The quantile to determine the lower threshold for the transformation.

  • return_params (bool (default: False)) – Whether to return the parameters used for the transformation.

  • params_override (list[dict] | None (default: None)) – A list of known parameter values in the same order as channels, with empty dict in case of no override.

Return type:

AnnData | list[dict] | None

Returns:

Depending on inplace, returns or updates adata in the following field adata.X is then a normalised adata object

Examples

params = pm.tl._autoLgcl_params(adata, channels=list(adata.var_names))
for channel in adata.var_names:
    channel_idx = np.where(adata.var_names == channel)[0][0]
    adata.X[:, channel_idx] = transforms.logicle(adata.X[:, channel_idx],
                                            channel_indices=[channel_idx],
                                            **params[channel])