tacco.preprocessing.normalize_platform

normalize_platform(adata, reference, annotation_key=None, reference_annotation_key=None, counts_location=None, gene_keys=None, inplace=True, return_rescaling_factors=False, reg_a=0.0, reg_b=0.0, tol=1e-12, verbose=1)[source]

Normalize the expression data and/or profiles in an AnnData to conform with the expression in another dataset. In effect rescales all genes.

Parameters:
  • adata – An AnnData containing expression, annotation, and/or profiles. This data will be rescaled.

  • reference – Another AnnData containing expression, annotation, and/or profiles to be used as reference.

  • annotation_key – The .obs/.obsm/.varm annotation key for adata, or alternatively annotation fractions for adata, which have to correspond to the profiles given in reference.varm[reference_annotation_key]. If None, no annotation information is used and the overall expression determines the rescaling.

  • reference_annotation_key – The .obs/.obsm/.varm annotation key for reference, or alternatively annotation fractions for reference, which have to correspond to the profiles given in adata.varm[annotation_key]. If None, no annotation information is used and the overall expression determines the rescaling.

  • counts_location – A string or tuple specifying where the count matrix is stored, e.g. ‘X’, (‘raw’,’X’), (‘raw’,’obsm’,’my_counts_key’), (‘layer’,’my_counts_key’), … For details see counts().

  • gene_keys – String or list of strings specifying additional count-like .var and .varm annotations to scale along with the platform normalization. The annotation_key is included automatically. Note that the any normalization is generally destroyed for these keys and they have to be renormalized if necessary. If True, take all .var and .varm keys.

  • inplace – Whether to update the input AnnData or return a copy.

  • return_rescaling_factors – Whether to return the rescaling factors instead of the rescaled data.

  • reg_a – Weight of per gene rescaling factor regularization

  • reg_b – Weight of per profile rescaling factor regularization

  • tol – Solver tolerance.

  • verbose – Level of verbosity, with 0 (no output), 1 (some output), …

Returns:

Returns an AnnData containing the rescaled adata, depending on inplace either as copy or as a reference to the original adata. If return_rescaling_factors, no rescalng is performed and the factors to do so are returned instead.