cycombinepy.correct_data

cycombinepy.correct_data(adata, label_key='cycombine_som', markers=None, batch_key='batch', covar=None, anchor=None, parametric=True, ref_batch=None, layer=None, out_layer='cycombine_corrected', copy=False)[source]

Per-cluster ComBat batch correction.

Parameters:
  • adata (AnnData) – AnnData with a cluster label in adata.obs[label_key] and a batch in adata.obs[batch_key].

  • label_key (str) – Column in adata.obs with the SOM cluster id (from create_som()).

  • markers (Optional[Iterable[str]]) – Var names to correct. If None, uses cycombinepy.get_markers().

  • batch_key (str) – Column in adata.obs giving the batch assignment.

  • covar (str | None) – Optional adata.obs columns used as ComBat covariates. Skew- and confound-detection follow the R logic at lines 455-506.

  • anchor (str | None) – Optional adata.obs columns used as ComBat covariates. Skew- and confound-detection follow the R logic at lines 455-506.

  • parametric (bool) – Parametric vs. non-parametric ComBat prior.

  • ref_batch – Optional reference batch that is kept unchanged.

  • layer (str | None) – If given, read the uncorrected matrix from this layer rather than X.

  • out_layer (str) – Name of the layer to store the corrected matrix in.

  • copy (bool) – If True, return a corrected copy; otherwise mutate in place.

Return type:

AnnData | None