pytometry.preprocessing.compensate#

pytometry.preprocessing.compensate(adata, var_key=None, key='signal_type', comp_matrix=None, matrix_type='spillover', copy=False)#

Computes compensation for data channels.

Parameters
  • adata (AnnData) – AnnData object

  • var_key (str, optional) – key where to check if a feature is an area, height etc. type of value. Use var_names if None.

  • key (str, optional) – key where result vector is added to the adata.var. Defaults to ‘signal_type’.

  • comp_matrix (None, optional) – a custom compensation matrix. Please note that by default we use the spillover matrix directly for numeric stability.

  • matrix_type (str, optional) – whether to use a spillover matrix (default) or a compensation matrix. Only considered for custom compensation matrices. Usually, custom compensation matrices are the inverse of the spillover matrix. If you want to use a compensation matrix, not the spillover matrix, set matrix_type to compensation.

  • copy (bool, optional) – Return a copy instead of writing to adata. Defaults to False.

Return type

Optional[AnnData]

Returns

Depending on copy, returns or updates adata